Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Can someone help me or point me in the right direction for finishing the following pieces of code: ---------------------------------------------------------------------------------------------------------------------------------------- 1: GenomeMetric.java /** * Compute the

Can someone help me or point me in the right direction for finishing the following pieces of code: ---------------------------------------------------------------------------------------------------------------------------------------- 1: GenomeMetric.java

/** * Compute the Increasing Confidence Similarity Metric between (item) profiles. */

package similarity.metric.profile;

import profile.Profile; import similarity.metric.SimilarityMetric;

public class GenomeMetric implements SimilarityMetric { /** * constructor - creates a new CosineMetric object */ public GenomeMetric() { } /** * computes the similarity between profiles * @param profile 1 * @param profile 2 */ @Override public double getSimilarity(final Profile genomeX, final Profile genomeY) { // calculate similarity using weighted Jaccard return 0.0;

}

} ---------------------------------------------------------------------------------------------------------------------------------------- 2: IncConfidenceMetric.java

/** * Compute the Increasing Confidence Similarity Metric between (item) profiles. */

package similarity.metric.profile;

import java.util.Set; import similarity.metric.SimilarityMetric; import profile.Profile;

public class IncConfidenceMetric implements SimilarityMetric { private static double RATING_THRESHOLD = 4.0; // the threshold rating for liked items

/** * constructor - creates a new CosineMetric object */ public IncConfidenceMetric() { } /** * computes the similarity between profiles * @param profile 1 * @param profile 2 */ @Override public double getSimilarity(final Profile p1, final Profile p2) { // calculate similarity using conf(X => Y) / conf(!X => Y) return 0.0;

}

} ---------------------------------------------------------------------------------------------------------------------------------------- To be used by the: BrowsedItemRecommender.java class

package alg.np;

import java.util.List; import java.util.ArrayList;

import alg.Recommender; import profile.Profile; import similarity.SimilarityMap; import similarity.metric.SimilarityMetric; import util.reader.DatasetReader; import util.Item;

public class BrowsedItemRecommender extends Recommender { private SimilarityMap simMap; // similarity map - stores all item-item similarities private Integer itemId; // the item on which recommendation is based private Profile scores;

/** * constructor - creates a new BrowsedItemRecommender object */ public BrowsedItemRecommender(DatasetReader reader, final Integer itemId,final SimilarityMetric metric) { super(reader); this.simMap = new SimilarityMap(reader.getItems(), metric); if (this.simMap==null) { System.out.println("Null similarity map"); } setBrowsedItem(itemId); } public BrowsedItemRecommender(final DatasetReader reader, final Integer itemId,final SimilarityMap simMap) { super(reader); this.simMap = simMap; setBrowsedItem(itemId); } public void setBrowsedItem(Integer id) { this.itemId = id; setScores(); } private void setScores() { // get the item similarity profile scores = simMap.getSimilarities(itemId); } public Profile getRecommendationScores(final Integer userId) {

return scores; }

/** * @returns the recommendations based on the target item * @param itemId - the target item ID */ public List getRecommendations(final Integer userId) {

// User profile Profile userProfile = reader.getUserProfiles().get(userId); if (scores==null || scores.getIds().size()==0) { return new ArrayList(); } return getRecommendationsFromScores(userProfile,scores); } } ----------------------------------------------------------------------------------------------------------------------------------------

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Databases And Information Systems 25th European Conference Adbis 2021 Tartu Estonia August 24 26 2021 Proceedings Lncs 12843

Authors: Ladjel Bellatreche ,Marlon Dumas ,Panagiotis Karras ,Raimundas Matulevicius

1st Edition

3030824713, 978-3030824716

More Books

Students also viewed these Databases questions