Class MachineLearningWekaRecommender<U>
java.lang.Object
es.uam.eps.ir.ranksys.rec.AbstractRecommender<U,I>
es.uam.eps.ir.ranksys.rec.fast.AbstractFastRecommender<U,I>
es.uam.eps.ir.ranksys.rec.fast.FastRankingRecommender<U,U>
es.uam.eps.ir.relison.links.recommendation.UserFastRankingRecommender<U>
es.uam.eps.ir.relison.links.recommendation.algorithms.supervised.MachineLearningWekaRecommender<U>
- Type Parameters:
U
- type of the users.
- All Implemented Interfaces:
es.uam.eps.ir.ranksys.core.index.ItemIndex<U>
,es.uam.eps.ir.ranksys.core.index.UserIndex<U>
,es.uam.eps.ir.ranksys.fast.index.FastItemIndex<U>
,es.uam.eps.ir.ranksys.fast.index.FastUserIndex<U>
,es.uam.eps.ir.ranksys.rec.fast.FastRecommender<U,U>
,es.uam.eps.ir.ranksys.rec.Recommender<U,U>
public class MachineLearningWekaRecommender<U> extends UserFastRankingRecommender<U>
Contact recommendation algorithm that uses supervised classification techniques to generate the
recommendation. It uses the Weka library.
-
Field Summary
Fields Modifier and Type Field Description private weka.core.FastVector
attributes
The list of attributes.private weka.classifiers.Classifier
classifier
Weka classifier.private java.util.Map<Pair<U>,java.lang.Integer>
relation
Relation between test instances and true edgesprivate weka.core.Instances
testSet
Test instances: contains the instances for the links we want to recommend.Fields inherited from class es.uam.eps.ir.relison.links.recommendation.UserFastRankingRecommender
graph
-
Constructor Summary
Constructors Constructor Description MachineLearningWekaRecommender(FastGraph<U> graph, weka.classifiers.Classifier classifier, java.lang.String trainInstances, java.lang.String testInstances, java.lang.String featureData, org.ranksys.formats.parsing.Parser<U> parser)
Constructor.MachineLearningWekaRecommender(FastGraph<U> graph, weka.classifiers.Classifier classifier, java.lang.String trainInstances, java.lang.String testInstances, org.ranksys.formats.parsing.Parser<U> parser)
Constructor.MachineLearningWekaRecommender(FastGraph<U> graph, weka.classifiers.Classifier classifier, weka.core.Instances trainSet, weka.core.Instances testSet, java.util.Map<Pair<U>,java.lang.Integer> relation, weka.core.FastVector attributes)
Constructor -
Method Summary
Modifier and Type Method Description it.unimi.dsi.fastutil.ints.Int2DoubleMap
getScoresMap(int uidx)
Methods inherited from class es.uam.eps.ir.relison.links.recommendation.UserFastRankingRecommender
getFreq, getFreq, getGraph
Methods inherited from class es.uam.eps.ir.ranksys.rec.fast.FastRankingRecommender
getRecommendation
Methods inherited from class es.uam.eps.ir.ranksys.rec.fast.AbstractFastRecommender
getRecommendation, getRecommendation, getRecommendation, getRecommendation, getRecommendation, getRecommendation, getRecommendation, iidx2item, item2iidx, numItems, numUsers, uidx2user, user2uidx
Methods inherited from class es.uam.eps.ir.ranksys.rec.AbstractRecommender
getRecommendation, getRecommendation
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface es.uam.eps.ir.ranksys.fast.index.FastItemIndex
containsItem, getAllIidx, getAllItems, iidx2item, iidx2item, item2iidx, item2iidx
-
Field Details
-
classifier
private final weka.classifiers.Classifier classifierWeka classifier. -
testSet
private final weka.core.Instances testSetTest instances: contains the instances for the links we want to recommend. -
relation
Relation between test instances and true edges -
attributes
private final weka.core.FastVector attributesThe list of attributes.
-
-
Constructor Details
-
MachineLearningWekaRecommender
public MachineLearningWekaRecommender(FastGraph<U> graph, weka.classifiers.Classifier classifier, java.lang.String trainInstances, java.lang.String testInstances, java.lang.String featureData, org.ranksys.formats.parsing.Parser<U> parser)Constructor. Reads the instances from three Weka files: a training set, a test set and a feature data file.- Parameters:
graph
- the training network.classifier
- the classifier to apply.trainInstances
- a file containing the training instances.testInstances
- a file containing the test instances.featureData
- a file containing the feature information.parser
- the user parser.
-
MachineLearningWekaRecommender
public MachineLearningWekaRecommender(FastGraph<U> graph, weka.classifiers.Classifier classifier, java.lang.String trainInstances, java.lang.String testInstances, org.ranksys.formats.parsing.Parser<U> parser) throws java.io.IOExceptionConstructor. Reads the instances from two files in the LETOR format.- Parameters:
graph
- the training network.classifier
- the classifier to apply.trainInstances
- a file containing the training instances.testInstances
- a file containing the test instances.parser
- the user parser.- Throws:
java.io.IOException
- if something fails while reading the files.
-
MachineLearningWekaRecommender
public MachineLearningWekaRecommender(FastGraph<U> graph, weka.classifiers.Classifier classifier, weka.core.Instances trainSet, weka.core.Instances testSet, java.util.Map<Pair<U>,java.lang.Integer> relation, weka.core.FastVector attributes)Constructor- Parameters:
graph
- the training graph.classifier
- Weka classifiertrainSet
- instances in the training settestSet
- instances in the test set.relation
- relation between pairs of users and instances.attributes
- list of attributes and possible values for nominal attributes.
-
-
Method Details
-
getScoresMap
public it.unimi.dsi.fastutil.ints.Int2DoubleMap getScoresMap(int uidx)
-