The factmac action learns a factorization machine model. Factorization machines are a general predictor like support vector machines (SVMs) and tensor factorization models. They are particularly effective for high-dimensional sparse data, such as recommendation systems.
| Parameter | Description |
|---|---|
| table | Specifies the input data table. |
| target | Specifies the target variable for the model. |
| inputs | Specifies the variables to be used in the training. |
| nominals | Specifies the nominal variables to be used in the training. |
| nFactors | Specifies the number of factors to be estimated. Default is 5. |
| maxIter | Specifies the maximum number of iterations. Default is 30. |
| learnStep | Specifies the learning step size for the optimization. Default is 0.001. |
| outModel | Specifies the output data table in which to save the estimated factorization machine parameters. |
| output | Specifies the output data table in which to save the scored observations. |
| saveState | Specifies the output data table in which to save the state of the factorization machine for future scoring. |
| nonNegative | When set to True, performs nonnegative factorization. Default is FALSE. |
| applyRowOrder | Specifies that the action uses a prespecified row ordering (requires orderby/groupby in partition). |
| seed | Specifies the seed value for random number generation. |
Creates a dataset 'ratings' simulating user-item interactions often used in recommendation systems.
| 1 | DATA mycas.ratings; |
| 2 | INPUT user item rating; |
| 3 | DATALINES; |
| 4 | 1 1 5 |
| 5 | 1 2 3 |
| 6 | 1 4 2 |
| 7 | 2 1 4 |
| 8 | 2 3 2 |
| 9 | 2 5 5 |
| 10 | 3 2 5 |
| 11 | 3 3 3 |
| 12 | 3 6 4 |
| 13 | 4 1 2 |
| 14 | 4 4 5 |
| 15 | 4 6 1 |
| 16 | ; |
| 17 | RUN; |
Trains a factorization machine model using default settings on the ratings data.
| 1 | PROC CAS; |
| 2 | factmac.factmac / |
| 3 | TABLE='ratings', |
| 4 | target='rating', |
| 5 | inputs={'user', 'item'}, |
| 6 | nominals={'user', 'item'}; |
| 7 | RUN; |
Trains a model with specific factors, iteration limits, learning step, and saves the model and scoring state.
| 1 | PROC CAS; |
| 2 | factmac.factmac / |
| 3 | TABLE='ratings', |
| 4 | target='rating', |
| 5 | inputs={'user', 'item'}, |
| 6 | nominals={'user', 'item'}, |
| 7 | nFactors=10, |
| 8 | maxIter=50, |
| 9 | learnStep=0.005, |
| 10 | outModel={name='factmac_factors', replace=TRUE}, |
| 11 | saveState={name='factmac_state', replace=TRUE}, |
| 12 | OUTPUT={casOut={name='scored_ratings', replace=TRUE}, copyVars={'user', 'item', 'rating'}}; |
| 13 | RUN; |