Search in sources :

Example 1 with UserCfTrainBatchOp

use of com.alibaba.alink.operator.batch.recommendation.UserCfTrainBatchOp in project Alink by alibaba.

the class Chap24 method c_7.

static void c_7() throws Exception {
    if (!new File(DATA_DIR + USERCF_MODEL_FILE).exists()) {
        getSourceRatings().link(new UserCfTrainBatchOp().setUserCol(USER_COL).setItemCol(ITEM_COL).setRateCol(RATING_COL)).link(new AkSinkBatchOp().setFilePath(DATA_DIR + USERCF_MODEL_FILE));
        BatchOperator.execute();
    }
    MemSourceBatchOp test_data = new MemSourceBatchOp(new Long[] { 50L }, ITEM_COL);
    new UserCfUsersPerItemRecommender().setItemCol(ITEM_COL).setRecommCol(RECOMM_COL).setModelData(new AkSourceBatchOp().setFilePath(DATA_DIR + USERCF_MODEL_FILE)).transform(test_data).print();
    getSourceRatings().filter("user_id IN (276,429,222,864,194,650,896,303,749,301) AND item_id=50").print();
    new UserCfUsersPerItemRecommender().setItemCol(ITEM_COL).setRecommCol(RECOMM_COL).setExcludeKnown(true).setModelData(new AkSourceBatchOp().setFilePath(DATA_DIR + USERCF_MODEL_FILE)).transform(test_data).print();
}
Also used : MemSourceBatchOp(com.alibaba.alink.operator.batch.source.MemSourceBatchOp) AkSourceBatchOp(com.alibaba.alink.operator.batch.source.AkSourceBatchOp) AkSinkBatchOp(com.alibaba.alink.operator.batch.sink.AkSinkBatchOp) File(java.io.File) UserCfTrainBatchOp(com.alibaba.alink.operator.batch.recommendation.UserCfTrainBatchOp)

Aggregations

UserCfTrainBatchOp (com.alibaba.alink.operator.batch.recommendation.UserCfTrainBatchOp)1 AkSinkBatchOp (com.alibaba.alink.operator.batch.sink.AkSinkBatchOp)1 AkSourceBatchOp (com.alibaba.alink.operator.batch.source.AkSourceBatchOp)1 MemSourceBatchOp (com.alibaba.alink.operator.batch.source.MemSourceBatchOp)1 File (java.io.File)1