
org.reco4j.engine.RecommenderBuilderThread Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of reco4j-core Show documentation
Show all versions of reco4j-core Show documentation
Reco4j is an open source project aims at developing a recommendation framework based on graph data sources. We choose graph databases for several reasons. They are NoSQL databases, so "schemaless". This means that it is possible to extend the basic data structure with intermediate information, i.e. similarity value between item and so on. Moreover, since every information is expressed with properties, nodes and relations, the recommendation process can be customized to work on every graph.
Reco4j can be used on every graph where "user" and "item" is represented by node and the preferences are modelled as relationship between them.
Current implementation leverage on Neo4j as first graph database integrated in our framework.
The newest version!
/*
* RecommenderThread.java
*
* Copyright (C) 2013 Alessandro Negro
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
package org.reco4j.engine;
import java.sql.Timestamp;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.reco4j.dataset.UserItemDataset;
import org.reco4j.graph.IGraph;
import org.reco4j.recommender.IRecommender;
/**
*
** @author Alessandro Negro
*/
public class RecommenderBuilderThread extends Thread
{
private static final Logger logger = Logger.getLogger(RecommenderEngine.class.getName());
private IGraph learningDataSet;
private IRecommender recommender;
private UserItemDataset userItemDataSet;
public RecommenderBuilderThread(IRecommender recommender, IGraph learningDataSet)
{
this.learningDataSet = learningDataSet;
this.recommender = recommender;
this.userItemDataSet = null;
}
public RecommenderBuilderThread(IRecommender recommender, IGraph learningDataSet, UserItemDataset userItemDataSet)
{
this(recommender, learningDataSet);
this.userItemDataSet = userItemDataSet;
}
@Override
public void run()
{
logger.log(Level.INFO, ">>>>>>>>>>>>>>>>>>>>: Load recommender start: {0}", new Timestamp(System.currentTimeMillis()));
recommender.loadRecommender(learningDataSet);
logger.log(Level.INFO, ">>>>>>>>>>>>>>>>>>>>:Load recommender end: {0}", new Timestamp(System.currentTimeMillis()));
logger.log(Level.INFO, ">>>>>>>>>>>>>>>>>>>>:Build recommendre start: {0}", new Timestamp(System.currentTimeMillis()));
if (userItemDataSet != null)
recommender.buildRecommender(learningDataSet, userItemDataSet);
else
recommender.buildRecommender(learningDataSet);
logger.log(Level.INFO, ">>>>>>>>>>>>>>>>>>>>:Build recommendre end: {0}", new Timestamp(System.currentTimeMillis()));
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy