|
@@ -8,14 +8,12 @@ import com.tzld.piaoquan.ad.engine.commons.score.model.FMModel;
|
|
|
import com.tzld.piaoquan.recommend.feature.domain.ad.base.AdRankItem;
|
|
|
import com.tzld.piaoquan.recommend.feature.domain.ad.base.UserAdFeature;
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
|
+import org.apache.commons.collections4.MapUtils;
|
|
|
import org.apache.commons.lang.exception.ExceptionUtils;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.Collections;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
+import java.util.*;
|
|
|
import java.util.concurrent.*;
|
|
|
|
|
|
|
|
@@ -132,29 +130,28 @@ public class VlogRovFMScorer extends BaseFMModelScorer {
|
|
|
final Map<String, String> sceneFeatureMap) {
|
|
|
|
|
|
|
|
|
- // Map<String, String> featureMap = new HashMap<>();
|
|
|
- // if (MapUtils.isNotEmpty(item.getFeatureMap())) {
|
|
|
- // featureMap.putAll(item.getFeatureMap());
|
|
|
- // }
|
|
|
- // if (MapUtils.isNotEmpty(userFeatureMap)) {
|
|
|
- // featureMap.putAll(userFeatureMap);
|
|
|
- // }
|
|
|
- // if (MapUtils.isNotEmpty(sceneFeatureMap)) {
|
|
|
- // featureMap.putAll(sceneFeatureMap);
|
|
|
- // }
|
|
|
+ Map<String, String> featureMap = new HashMap<>();
|
|
|
+ if (MapUtils.isNotEmpty(item.getFeatureMap())) {
|
|
|
+ featureMap.putAll(item.getFeatureMap());
|
|
|
+ }
|
|
|
+ if (MapUtils.isNotEmpty(userFeatureMap)) {
|
|
|
+ featureMap.putAll(userFeatureMap);
|
|
|
+ }
|
|
|
+ if (MapUtils.isNotEmpty(sceneFeatureMap)) {
|
|
|
+ featureMap.putAll(sceneFeatureMap);
|
|
|
+ }
|
|
|
|
|
|
double pro = 0.0;
|
|
|
- // if (MapUtils.isNotEmpty(featureMap)) {
|
|
|
- // try {
|
|
|
- // pro = model.score(featureMap);
|
|
|
- // // LOGGER.info("fea : {}, score:{}", JSONUtils.toJson(featureMap), pro);
|
|
|
- // } catch (Exception e) {
|
|
|
- // LOGGER.error("score error for doc={} exception={}", item.getVideoId(), ExceptionUtils.getFullStackTrace(e));
|
|
|
- // }
|
|
|
- // }
|
|
|
- // item.setScoreRov(pro);
|
|
|
- // item.getScoresMap().put("RovFMScore", pro);
|
|
|
- // item.setAllFeatureMap(featureMap);
|
|
|
+ if (MapUtils.isNotEmpty(featureMap)) {
|
|
|
+ try {
|
|
|
+ pro = model.score(featureMap);
|
|
|
+ // LOGGER.info("fea : {}, score:{}", JSONUtils.toJson(featureMap), pro);
|
|
|
+ } catch (Exception e) {
|
|
|
+ LOGGER.error("score error for doc={} exception={}", item.getVideoId(), ExceptionUtils.getFullStackTrace(e));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ item.setLrScore(pro);
|
|
|
+ item.getScoreMap().put("ctcvrScore", pro);
|
|
|
return pro;
|
|
|
}
|
|
|
}
|