org.apache.mahout.cf.taste.impl.recommender.svd
Class FilePersistenceStrategy

java.lang.Object
  extended by org.apache.mahout.cf.taste.impl.recommender.svd.FilePersistenceStrategy
All Implemented Interfaces:
PersistenceStrategy

public class FilePersistenceStrategy
extends Object
implements PersistenceStrategy

Provides a file-based persistent store.


Constructor Summary
FilePersistenceStrategy(File file)
           
 
Method Summary
 Factorization load()
          Load a factorization from a persistent store.
 void maybePersist(Factorization factorization)
          Write a factorization to a persistent store unless it already contains an identical factorization.
static Factorization readBinary(DataInput in)
           
protected static void writeBinary(Factorization factorization, DataOutput out)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FilePersistenceStrategy

public FilePersistenceStrategy(File file)
Parameters:
file - the file to use for storage. If the file does not exist it will be created when required.
Method Detail

load

public Factorization load()
                   throws IOException
Description copied from interface: PersistenceStrategy
Load a factorization from a persistent store.

Specified by:
load in interface PersistenceStrategy
Returns:
a Factorization or null if the persistent store is empty.
Throws:
IOException

maybePersist

public void maybePersist(Factorization factorization)
                  throws IOException
Description copied from interface: PersistenceStrategy
Write a factorization to a persistent store unless it already contains an identical factorization.

Specified by:
maybePersist in interface PersistenceStrategy
Throws:
IOException

writeBinary

protected static void writeBinary(Factorization factorization,
                                  DataOutput out)
                           throws IOException
Throws:
IOException

readBinary

public static Factorization readBinary(DataInput in)
                                throws IOException
Throws:
IOException


Copyright © 2008–2014 The Apache Software Foundation. All rights reserved.