Question
Can someone help me finish the following piece of Java code? package alg.np; import java.util.List; import java.util.Set; import alg.Recommender; import profile.Profile; import util.reader.DatasetReader; import org.apache.commons.math3.distribution.NormalDistribution;
Can someone help me finish the following piece of Java code?
package alg.np;
import java.util.List; import java.util.Set;
import alg.Recommender; import profile.Profile; import util.reader.DatasetReader;
import org.apache.commons.math3.distribution.NormalDistribution;
public class PopularityRecommender extends Recommender { // threshold above which a rating is considered to be an upvote private Double ratingThreshold; // significance level for Wilson score private Double significanceLevel; // a profile of scores used to sort the items for recommendation private Profile scores;
/** * constructor - creates a new PopularityRecommender object * @param reader - dataset reader * @param ratingThreshold * @param significanceLevel */ public PopularityRecommender(final DatasetReader reader, double ratingThreshold, double significanceLevel) { super(reader); this.ratingThreshold = ratingThreshold; this.significanceLevel = significanceLevel; setScores(); } /** * constructor - creates a new PopularityRecommender object * @param reader - dataset reader * @param ratingThreshold * */ public PopularityRecommender(final DatasetReader reader, double ratingThreshold) { super(reader); this.ratingThreshold = ratingThreshold; this.significanceLevel = 1.0; setScores(); } public void setSignificanceLevel(double level) { // scores are recomputed whenever the significance level is // changed this.significanceLevel = level; setScores(); } public void setRatingThreshold(double threshold) { // scores are recomputed whenever the rating threshold is // changed this.ratingThreshold = threshold; setScores(); } private void setScores() { scores = new Profile(0); // Get all the items in the dataset Set
/** * @returns the recommendations based on the target item * @param itemId - the target item ID */ public List
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started