Example usage for org.apache.mahout.cf.taste.impl.model.jdbc PostgreSQLJDBCDataModel PostgreSQLJDBCDataModel

List of usage examples for org.apache.mahout.cf.taste.impl.model.jdbc PostgreSQLJDBCDataModel PostgreSQLJDBCDataModel

Introduction

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

Prototype

public PostgreSQLJDBCDataModel(DataSource dataSource, String preferenceTable, String userIDColumn,
        String itemIDColumn, String preferenceColumn, String timestampColumn) 

Source Link

Document

Creates a using the given javax.sql.DataSource and default table/column names.

Usage

From source file:com.github.gurelkaynak.recommendationengine.jdbi.DataModelFactory.java

public ReloadFromJDBCDataModel build(PGPoolingDataSource dataSource) throws TasteException {
    return new ReloadFromJDBCDataModel(new PostgreSQLJDBCDataModel(dataSource, this.table, this.userField,
            this.itemField, this.ratingField, null));
}

From source file:com.unresyst.DealRecommender.java

License:Apache License

public DealRecommender() throws IOException, TasteException, InterruptedException {
    // run pg:ingress to open up hole in Heroku firewall
    // according to Heroku documentation, connections made through this hole
    // will remain open after the hole closes (60 seconds)
    runCommand("source \"$HOME/.rvm/scripts/rvm\"", "rvm use ree-1.8.7-head@deallist-backend > /dev/null",
            "heroku pg:ingress --app rewardsnap-ds-production");

    PGPoolingDataSource source = new PGPoolingDataSource();
    source.setServerName("ec2-174-129-209-243.compute-1.amazonaws.com");
    source.setDatabaseName("ds20669xa45e2uv");
    source.setUser("uq88n3pavsbyot");
    source.setPassword("p8tj3rn061zvbthpc9e7nfbxv0");

    PostgreSQLJDBCDataModel model = new PostgreSQLJDBCDataModel(source, "ratings", "user_id", "deal_id",
            "rating", "created_at");
    recommender = new CachingRecommender(new SlopeOneRecommender(model));
}