predictionio 的validScores方法 有點問題,因為model對象中的一個屬性類型為Map<String, Item> items,在數(shù)據(jù)量很大的時候,肯定是不行,所以優(yōu)化一下,采用join+filter的模式,代碼如下
創(chuàng)新互聯(lián)專注于桃源網(wǎng)站建設(shè)服務(wù)及定制,我們擁有豐富的企業(yè)做網(wǎng)站經(jīng)驗。 熱誠為您提供桃源營銷型網(wǎng)站建設(shè),桃源網(wǎng)站制作、桃源網(wǎng)頁設(shè)計、桃源網(wǎng)站官網(wǎng)定制、小程序定制開發(fā)服務(wù),打造桃源網(wǎng)絡(luò)公司原創(chuàng)品牌,更為您提供桃源網(wǎng)站排名全網(wǎng)營銷落地服務(wù)。
return all.mapToPair(new PairFunction<ItemScore, String, ItemScore>() {
@Override
public Tuple2<String, ItemScore> call(ItemScore idUser) throws Exception {
return new Tuple2<>(idUser.getItemEntityId(), idUser);
}
}).join(model.getItems()).filter(new Function<Tuple2<String,Tuple2<ItemScore,Item>>, Boolean>() {
@Override
public Boolean call(Tuple2<String,Tuple2<ItemScore,Item>> itemScore) throws Exception {
/*Item item = items.get(itemScore.getItemEntityId());*/
Item item =itemScore._2._2;
//logger.info("join end");
return (item!=null && /*item != null
&& */passWhitelistCriteria(whitelist, itemScore._2._1.getItemEntityId())
&& passBlacklistCriteria(blacklist, itemScore._2._1.getItemEntityId())
/* && passCategoryCriteria(categories, item)*/
/* && passUnseenCriteria(seenItemEntityIds, itemScore.getItemEntityId())*///看過或買過的不要
/* && passAvailabilityCriteria(unavailableItemEntityIds, itemScore.getItemEntityId())*/);
}
}).map(new Function<Tuple2<String, Tuple2<ItemScore,Item>>, ItemScore>() {
@Override
public ItemScore call(Tuple2<String, Tuple2<ItemScore,Item>> userItemCount) throws Exception {
return userItemCount._2._1;
}
});
當(dāng)前題目:predictionio優(yōu)化
當(dāng)前URL:http://bm7419.com/article2/gijjoc.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供企業(yè)建站、網(wǎng)站建設(shè)、網(wǎng)站營銷、網(wǎng)站收錄、、外貿(mào)建站
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)