Example usage for org.apache.mahout.cf.taste.impl.model GenericBooleanPrefDataModel toDataMap

List of usage examples for org.apache.mahout.cf.taste.impl.model GenericBooleanPrefDataModel toDataMap

Introduction

In this page you can find the example usage for org.apache.mahout.cf.taste.impl.model GenericBooleanPrefDataModel toDataMap.

Prototype

public static FastByIDMap<FastIDSet> toDataMap(FastByIDMap<PreferenceArray> data) 

Source Link

Usage

From source file:io.prediction.engines.base.mahout.AllValidItemsCandidateItemsStrategy.java

License:Apache License

public AllValidItemsCandidateItemsStrategy(long[] validItemIDs, DataModel seenDataModel) throws TasteException {
    super();/*from   w w  w  .j ava  2 s  .  c o  m*/
    if (seenDataModel != null)
        this.seenDataMap = GenericBooleanPrefDataModel.toDataMap(seenDataModel);
    else
        this.seenDataMap = null;

    this.validItemIDs = validItemIDs;
}

From source file:nl.gridline.zieook.client.tools.ZieOokEvaluatorTest.java

License:Apache License

@Ignore
private static GenericBooleanPrefDataModel createDataBooleanModel(String input) {
    try {//  w  ww .  j a  v  a 2 s .c  om
        return new GenericBooleanPrefDataModel(GenericBooleanPrefDataModel.toDataMap(createDataModel(input)));
    } catch (TasteException e) {
        LOG.error("failed to read data", e);
        fail();
    }
    return null;
}

From source file:org.zaizi.mahout.eval.IRMahoutEvaluator.java

License:Open Source License

public double evaluate(RecommenderBuilder builder, DataModel datamodel) throws TasteException {

    DataModelBuilder modelBuilder = new DataModelBuilder() {

        public DataModel buildDataModel(FastByIDMap<PreferenceArray> trainingData) {
            return new GenericBooleanPrefDataModel(GenericBooleanPrefDataModel.toDataMap(trainingData));
        }/*from  w  ww.  ja va 2s .c om*/
    };

    return evaluator.evaluate(builder, modelBuilder, datamodel, null, precisionAt,
            GenericRecommenderIRStatsEvaluator.CHOOSE_THRESHOLD, evaluationPercentage).getF1Measure();

}

From source file:tv.icntv.recommend.algorithm.test.RecommendFactory.java

License:Apache License

public static DataModel buildDataModelNoPref(String file) throws TasteException, IOException {
    return new GenericBooleanPrefDataModel(
            GenericBooleanPrefDataModel.toDataMap(new FileDataModel(new File(file))));
}

From source file:tv.icntv.recommend.algorithm.test.RecommendFactory.java

License:Apache License

public static DataModelBuilder buildDataModelNoPrefBuilder() {
    return new DataModelBuilder() {
        @Override/*from   ww w. ja  v  a 2  s  . c  o m*/
        public DataModel buildDataModel(FastByIDMap<PreferenceArray> trainingData) {
            return new GenericBooleanPrefDataModel(GenericBooleanPrefDataModel.toDataMap(trainingData));
        }
    };
}