|
@@ -12,17 +12,6 @@ public class AdActionFeature {
|
|
|
private double ctr=0d;
|
|
|
private double cvr=0d;
|
|
|
|
|
|
- private double ceilLog(Double key) {
|
|
|
- return Math.ceil(Math.log(key + 1));
|
|
|
- }
|
|
|
-
|
|
|
- private double bucketRatioFeature(Double key) {
|
|
|
- long bucket = Math.round(Math.log((key + 1) * 50));
|
|
|
- if (bucket > 50)
|
|
|
- bucket = 50;
|
|
|
- return (double) bucket;
|
|
|
- }
|
|
|
-
|
|
|
|
|
|
public void setAdView(Object key) {
|
|
|
if (key == null) {
|
|
@@ -73,56 +62,10 @@ public class AdActionFeature {
|
|
|
|
|
|
|
|
|
|
|
|
- public void setOriginAdView(Object key) {
|
|
|
- if (key == null) {
|
|
|
- this.adView = 0.0;
|
|
|
- } else {
|
|
|
- String formateKey = key.toString().replace("\\N", "0");
|
|
|
- this.adView = ceilLog(Double.valueOf(formateKey));
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- public void setOriginAdClick(Object key) {
|
|
|
- if (key == null) {
|
|
|
- this.adClick = 0.0;
|
|
|
- } else {
|
|
|
- String formateKey = key.toString().replace("\\N", "0");
|
|
|
- this.adClick = ceilLog(Double.valueOf(formateKey));
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- public void setOriginAdConversion(Object key) {
|
|
|
- if (key == null) {
|
|
|
- this.adConversion = 0.0;
|
|
|
- } else {
|
|
|
- String formateKey = key.toString().replace("\\N", "0");
|
|
|
- this.adConversion = ceilLog(Double.valueOf(formateKey));
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- public void setOriginCtr(Object key) {
|
|
|
- if (key == null) {
|
|
|
- this.ctr = 0.0;
|
|
|
- } else {
|
|
|
- String formateKey = key.toString().replace("\\N", "0");
|
|
|
- this.ctr = bucketRatioFeature(Double.valueOf(formateKey));
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- public void setOriginCvr(Object key) {
|
|
|
- if (key == null) {
|
|
|
- this.cvr = 0.0;
|
|
|
- } else {
|
|
|
- String formateKey = key.toString().replace("\\N", "0");
|
|
|
- this.cvr = bucketRatioFeature(Double.valueOf(formateKey));
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
public static void main(String args[]){
|
|
|
|
|
|
AdActionFeature adActionFeature = new AdActionFeature();
|
|
|
- adActionFeature.setOriginAdView("563266.0");
|
|
|
+ // adActionFeature.setOriginAdView("3861");
|
|
|
System.out.println(String.valueOf(adActionFeature.getAdView()));
|
|
|
}
|
|
|
|