## org.apache.mahout.cf.taste.example.netflix
Class NetflixDataModel

    java.lang.Object
      org.apache.mahout.cf.taste.example.netflix.NetflixDataModel

All Implemented Interfaces:
  Serializable, Refreshable, DataModel

    public final class NetflixDataModel

extends Object
implements DataModel

This is a `DataModel` that reads the Netflix data set, as represented in its unpacked file structure. Note that unpacking the distribution entails untarring the main archive, then untarring the archive of training set data files.

See Also:
  Serialized Form

Constructor Summary
`NetflixDataModel(File dataDirectory, boolean useSubset)`

Method Summary
`LongPrimitiveIterator` `getItemIDs()`
`FastIDSet` `getItemIDsFromUser(long userID)`
`float` `getMaxPreference()`
`float` `getMinPreference()`
`int` `getNumItems()`
`int` `getNumUsers()`
`int` `getNumUsersWithPreferenceFor(long... itemIDs)`
`PreferenceArray` `getPreferencesForItem(long itemID)`
`PreferenceArray` `getPreferencesFromUser(long id)`
`Long` `getPreferenceTime(long userID, long itemID)`
`Float` `getPreferenceValue(long userID, long itemID)`
`LongPrimitiveIterator` `getUserIDs()`
`boolean` `hasPreferenceValues()`
`void` `refresh(Collection<Refreshable> alreadyRefreshed)`
`void` `removePreference(long userID, long itemID)`
`void` `setPreference(long userID, long itemID, float value)`
`String` `toString()`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### NetflixDataModel

    public NetflixDataModel(File dataDirectory,
                            boolean useSubset)
                     throws IOException

Parameters:
  `dataDirectory` - root directory of Netflix data set, unpacked
  `useSubset` - if true, will use only a small fraction of the data -- may be useful for quick experiments
Throws:
  `IOException`

Method Detail

### getUserIDs

    public LongPrimitiveIterator getUserIDs()
                                     throws TasteException

  Specified by:
    `getUserIDs` in interface `DataModel`
  Throws:
    `TasteException`

### getPreferencesFromUser

    public PreferenceArray getPreferencesFromUser(long id)
                                           throws TasteException

  Specified by:
    `getPreferencesFromUser` in interface `DataModel`
  Throws:
    `TasteException`

### getItemIDsFromUser

    public FastIDSet getItemIDsFromUser(long userID)
                                 throws TasteException

  Specified by:
    `getItemIDsFromUser` in interface `DataModel`
  Throws:
    `TasteException`

### getItemIDs

    public LongPrimitiveIterator getItemIDs()
                                     throws TasteException

  Specified by:
    `getItemIDs` in interface `DataModel`
  Throws:
    `TasteException`

### getPreferencesForItem

    public PreferenceArray getPreferencesForItem(long itemID)
                                          throws TasteException

  Specified by:
    `getPreferencesForItem` in interface `DataModel`
  Throws:
    `TasteException`

### getPreferenceValue

    public Float getPreferenceValue(long userID,
                                    long itemID)
                             throws TasteException

  Specified by:
    `getPreferenceValue` in interface `DataModel`
  Throws:
    `TasteException`

### getPreferenceTime

    public Long getPreferenceTime(long userID,
                                  long itemID)
                           throws TasteException

  Specified by:
    `getPreferenceTime` in interface `DataModel`
  Throws:
    `TasteException`

### getNumItems

    public int getNumItems()
                    throws TasteException

  Specified by:
    `getNumItems` in interface `DataModel`
  Throws:
    `TasteException`

### getNumUsers

    public int getNumUsers()
                    throws TasteException

  Specified by:
    `getNumUsers` in interface `DataModel`
  Throws:
    `TasteException`

### getNumUsersWithPreferenceFor

    public int getNumUsersWithPreferenceFor(long... itemIDs)
                                     throws TasteException

  Specified by:
    `getNumUsersWithPreferenceFor` in interface `DataModel`
  Throws:
    `TasteException`

### setPreference

    public void setPreference(long userID,
                              long itemID,
                              float value)

  Specified by:
    `setPreference` in interface `DataModel`

### removePreference

    public void removePreference(long userID,
                                 long itemID)

  Specified by:
    `removePreference` in interface `DataModel`

### refresh

    public void refresh(Collection<Refreshable> alreadyRefreshed)

  Specified by:
    `refresh` in interface `Refreshable`

### hasPreferenceValues

    public boolean hasPreferenceValues()

  Specified by:
    `hasPreferenceValues` in interface `DataModel`

### getMaxPreference

    public float getMaxPreference()

  Specified by:
    `getMaxPreference` in interface `DataModel`

### getMinPreference

    public float getMinPreference()

  Specified by:
    `getMinPreference` in interface `DataModel`

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

Copyright © 2008-2010 The Apache Software Foundation. All Rights Reserved.