Package Database.Primitives

Examples of Database.Primitives.Similarity


  Song other = songs.getSong(Integer.parseInt(data[1]));
        if (other == null) {
            System.err.println("Could not find other song id:"+Integer.parseInt(data[1]));
        }
        double neighborSim = Double.parseDouble(data[2]);
        Similarity sim = new Similarity(other, neighborSim);
        main.addToNeighborhood(sim);
       
       
    }
View Full Code Here


            if (neighbor == null) {
                System.err.println("Reading Neighborhood database found Song that wasn't already constructed.  Exiting.");
                System.exit(1);
            }
            double neighborSim = Double.parseDouble(splitData[2]);
            Similarity sim = new Similarity(neighbor, neighborSim);
            currentSong.addToNeighborhood(sim);
        } else {
            System.err.println("Unexpected format for similarity line: " + dataLine);
        }
    }
View Full Code Here

                 * users have rated both songs If negative, should not
                 * recommend...
                 */
                double sim = numerator / Math.sqrt(denominator_left * denominator_right);
                if (userCount > Main.getOptions().getRatingCountThreshold()) {
                    Similarity is = new Similarity(j, sim);
                    i.getNeighborhood().insert(is);
                }

                //attempt to add to neighborhood (it will only be added if it should be)
            }
View Full Code Here

                     * not recommend...
                     */

                    double sim = numerator / Math.sqrt(denominator_left * denominator_right);
                    if (userCount > threshold) {
                        Similarity is = new Similarity(j, sim);
                        context.write(new IntWritable(i.getID()), new Text(is.toString()));
                    }
                }
            }
        }
View Full Code Here

        public void reduce(IntWritable songId, Iterable<Text> sim,
                Context context) throws IOException, InterruptedException {
            Similarities neih = new Similarities();
            for (Text s : sim) {
//                System.out.println("sim " + s.toString());
                neih.insert(new Similarity(s.toString()));
            }

            for (Similarity s : neih) {
                context.write(songId, new Text(s.toString()));
            }
View Full Code Here

TOP

Related Classes of Database.Primitives.Similarity

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.