Example usage for org.apache.mahout.cf.taste.impl.model.mongodb MongoDBDataModel MongoDBDataModel

List of usage examples for org.apache.mahout.cf.taste.impl.model.mongodb MongoDBDataModel MongoDBDataModel

Introduction

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

Prototype

public MongoDBDataModel(String host, int port, String database, String collection, boolean manage,
        boolean finalRemove, DateFormat format) throws UnknownHostException 

Source Link

Document

Creates a new MongoDBDataModel with MongoDB basic configuration (without authentication)

Usage

From source file:com.aguin.stock.recommender.MongoDBUserModel.java

License:Apache License

public static MongoDBDataModel instance() {
    if (mmdb == null) {
        try {// w ww  .  j a  v  a  2 s. com
            mmdb = new MongoDBDataModel(dbHost, dbPort, dbUser, dbCollectionName, true, true, null);
        } catch (UnknownHostException e) {
            e.printStackTrace();
        } catch (MongoException e) {
            e.printStackTrace();
        }
    }
    return mmdb;
}

From source file:com.aguin.stock.recommender.StockRecommender.java

License:Apache License

public static void main(String... args) throws FileNotFoundException, TasteException, IOException {

    MongoDBDataModel model = new MongoDBDataModel("localhost", ServerAddress.defaultPort(), "userdb", "prefs",
            true, true, null);//from w  ww . j a  v  a  2  s.co m
    // create a slope one recommender on the data
    CachingRecommender slopeOneRecommender = new CachingRecommender(new SlopeOneRecommender(model));
    run(model, slopeOneRecommender);
}