List of usage examples for org.apache.mahout.cf.taste.impl.recommender.svd ALSWRFactorizer ALSWRFactorizer
public ALSWRFactorizer(DataModel dataModel, int numFeatures, double lambda, int numIterations, boolean usesImplicitFeedback, double alpha, int numTrainingThreads) throws TasteException
From source file:org.plista.kornakapi.core.training.FactorizationbasedInMemoryTrainer.java
License:Apache License
@Override protected void doTrain(File targetFile, DataModel inmemoryData, int numProcessors) throws IOException { try {//from ww w . j a v a 2 s . c o m if (inmemoryData.getNumItems() >= 5 && inmemoryData.getNumUsers() >= 10) {//preventing matrix singularity ALSWRFactorizer factorizer = new ALSWRFactorizer(inmemoryData, conf.getNumberOfFeatures(), conf.getLambda(), conf.getNumberOfIterations(), conf.isUsesImplicitFeedback(), conf.getAlpha(), numProcessors); long start = System.currentTimeMillis(); Factorization factorization = factorizer.factorize(); long estimateDuration = System.currentTimeMillis() - start; if (log.isInfoEnabled()) { log.info("Model trained in {} ms", estimateDuration); } new FilePersistenceStrategy(targetFile).maybePersist(factorization); } } catch (Exception e) { throw new IOException(e); } }