Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Numeric.Recommender.ALS
Synopsis
- data ALSParams = ALSParams {}
- data ALSResult = ALSResult {
- cost :: Double
- itemFeature :: !(Matrix Double)
- userFeature :: !(Matrix Double)
- data ALSModel u i = ALSModel {
- encodeUser :: u -> Maybe Int
- decodeUser :: Int -> u
- encodeItem :: i -> Maybe Int
- decodeItem :: Int -> i
- pairs :: [(Int, Int)]
- results :: [ALSResult]
- buildModel :: (Functor f, Foldable f) => ALSParams -> (u -> Int) -> (Int -> u) -> (i -> Int) -> (Int -> i) -> f (u, i) -> ALSModel u i
- buildModelRated :: (Functor f, Foldable f) => ALSParams -> (u -> Int) -> (Int -> u) -> (i -> Int) -> (Int -> i) -> f (u, (i, Double)) -> ALSModel u i
- recommend :: ALSModel u i -> Int -> IntMap [(i, Bool)]
- related :: ALSModel u i -> Int -> IntMap [(i, Double)]
- byDimensions :: ALSModel u i -> Int -> [[(i, Double)]]
Documentation
Constructors
ALSParams | |
Constructors
ALSResult | |
Fields
|
Constructors
ALSModel | |
Fields
|
Arguments
:: (Functor f, Foldable f) | |
=> ALSParams | |
-> (u -> Int) | |
-> (Int -> u) | |
-> (i -> Int) | |
-> (Int -> i) | |
-> f (u, i) | User-item pairs |
-> ALSModel u i |
Build recommendations based on users' unrated item choices.
Takes conversion functions to/from Int representation for user
supplied data types. Use id
if you're already based on them.
The implementation follows the one in the recommenderlab library in CRAN. For further details, see "Large-scale Parallel Collaborative Filtering for the Netflix Prize" by Yunhong Zhou, Dennis Wilkinson, Robert Schreiber and Rong Pan.
Arguments
:: (Functor f, Foldable f) | |
=> ALSParams | |
-> (u -> Int) | |
-> (Int -> u) | |
-> (i -> Int) | |
-> (Int -> i) | |
-> f (u, (i, Double)) | User-item pairs, rated |
-> ALSModel u i |
Build model for data with ratings.
Per user recommendations. Results include items user has selected and the snd in the tuple is False for those items.
The result IntMap uses dense user representation as the key. Access with encodeUser.
The feature matrix gives nFactors-dimensional coordinates for the items. As such similar results can be found with using norm.
The result IntMap uses dense item representation as the key. Access with encodeItem.
byDimensions :: ALSModel u i -> Int -> [[(i, Double)]] Source #
Sort items by components of the feature matrix. This could be used for visualization purposes or to sort items along some feature axis. The interpretation of them is totally up to the user but it's not unreasonable to expect items close to each other in this representation to be in some sense similar.
There's no guarantee that the results are stable between different models even with only small differences.