Commit dd6c5ed6 authored by mxx's avatar mxx

正负反馈

parents
/.gradle/
/.idea/
/build/
/class/
/*/build/
/*/out/
/nezha-compute-alg/build/
/nezha-compute-api/build/
/nezha-compute-biz/build/
/nezha-compute-common/build/
/nezha-compute-deploy/build/
/nezha-compute-mllib/build/
/nezha-compute-stat/build/
/duiba-rcmd-alg/build/
*.iml
*.DS_Store
*.class
\ No newline at end of file
//buildscript {
// repositories {
// mavenLocal()
// maven { url 'http://nexus.dui88.com:8081/nexus/content/groups/public/' }
// mavenCentral()
// maven { url 'https://repository.cloudera.com/content/repositories/releases/' }
// }
//}
allprojects {
apply plugin: 'maven'
apply plugin: 'scala'
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'eclipse'
group = 'cn.com.duiba.nezha-compute'
version = '1.23.4-SNAPSHOT'
// JVM 版本号要求
sourceCompatibility = 1.7
targetCompatibility = 1.7
// configurations {
// //编译期排除commons模块
// //在整个构建过程中排除pkaq.tiger:share
// all*.exclude group: 'com.esotericsoftware.kryo' ,module: 'kryo'
//
// }
}
subprojects {
// java编译的时候缺省状态下会因为中文字符而失败
[compileJava, compileTestJava, javadoc]*.options*.encoding = 'UTF-8'
dependencies {
compile(group: 'org.apache.spark', name: 'spark-core_2.10', version: '1.6.0') {
exclude group: 'javax.servlet'//, module: 'servlet-api'
exclude group: 'io.netty'//, module: 'servlet-api'
}
// scala
compile group: 'org.scala-lang', name: 'scala-library', version: '2.10.4'
compile(group: 'org.apache.spark', name: 'spark-mllib_2.10', version: '1.6.0') {
exclude group: 'javax.servlet'//, module: 'servl et-api'
exclude group: 'io.netty'//, module: 'servlet-api'
}
// hbase
compile(group: 'org.apache.hbase', name: 'hbase-client', version: '1.2.0') {
// exclude group: 'io.netty'//, module: 'servlet-api'
// exclude group: 'com.google.guava'//, module: 'servlet-api'
}
// https://mvnrepository.com/artifact/org.scalanlp/breeze-viz_2.10
compile group: 'org.scalanlp', name: 'breeze-viz_2.10', version: '0.11.2'
// json
compile group: 'com.alibaba', name: 'fastjson', version: '1.2.6'
// jackson
compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.4.4'
// scopt
compile group: 'com.github.scopt', name: 'scopt_2.10', version: '3.3.0'
compile group: 'com.hankcs', name: 'hanlp', version: 'portable-1.3.1'
testCompile group: 'junit', name: 'junit', version: '4.11'
compile(group: 'com.google.guava', name: 'guava', version: '14.0.1') {
force = true
}
//
// compile(group: 'com.esotericsoftware', name: 'kryo', version: '4.0.1') {
// force = true
// }
//
// compile(group: 'com.esotericsoftware.kryo', name: 'kryo', version: '2.21.9') {
// force = true
// }
repositories {
mavenLocal()
maven { url "http://nexus.dui88.com:8081/nexus/content/groups/public/" }
maven { url "http://repo.maven.apache.org/maven2" }
mavenCentral()
maven { url 'https://repository.cloudera.com/content/repositories/releases/' }
}
}
uploadArchives {
repositories {
mavenDeployer {
repository(url: "http://nexus.dui88.com:8081/nexus/content/repositories/snapshots/") {
authentication(userName: "admin", password: "admin123")
}
pom.project {
name project.name
packaging 'jar'
description 'notify client'
url 'www.duiba.com.cn'
scm {
url ''
connection ''
developerConnection ''
}
licenses {
license {
name 'No License'
url 'http://www.duiba.com.cn'
distribution 'repo'
}
}
developers {
developer {
id 'xuhengfei'
name 'Hengfei Xu'
}
}
}
}
}
}
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
artifacts {
archives sourcesJar
}
task listJars(description: 'Display all compile jars.') << {
configurations.compile.each { File file -> println file.name }
}
}
----------------------------------------------------------------
Tue Aug 08 17:53:20 CST 2017:
Booting Derby version The Apache Software Foundation - Apache Derby - 10.10.2.0 - (1582446): instance a816c00e-015d-c143-4d70-00001bbd4f08
on database directory C:\Users\pc\AppData\Local\Temp\spark-c4ff8077-66ca-4b0c-94ad-67253a5b23d4\metastore with class loader java.net.URLClassLoader@b35fb1c
Loaded from file:/C:/Users/pc/.m2/repository/org/apache/derby/derby/10.10.2.0/derby-10.10.2.0.jar
java.vendor=Oracle Corporation
java.runtime.version=1.7.0_79-b15
user.dir=C:\Users\pc\IdeaProjects\tuia-nezha-compute
os.name=Windows 7
os.arch=amd64
os.version=6.1
derby.system.home=null
Database Class Loader started - derby.database.classpath=''
group 'cn.com.duiba.nezha-compute'
version '1.10.0-SNAPSHOT'
apply plugin: 'java'
sourceCompatibility = 1.8
repositories {
mavenCentral()
}
dependencies {
testCompile group: 'junit', name: 'junit', version: '4.12'
}
#Wed Nov 22 13:57:13 CST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.2-all.zip
#!/usr/bin/env bash
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn ( ) {
echo "$*"
}
die ( ) {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
esac
# For Cygwin, ensure paths are in UNIX format before anything is touched.
if $cygwin ; then
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
fi
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >&-
APP_HOME="`pwd -P`"
cd "$SAVED" >&-
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
JVM_OPTS=("$@")
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windowz variants
if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
goto execute
:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
dependencies {
compile project(':nezha-compute-api')
compile project(':nezha-compute-common')
compile project(':nezha-compute-mllib')
}
\ No newline at end of file
package cn.com.duiba.nezha.compute.alg;
import cn.com.duiba.nezha.compute.alg.vo.BackendAdvertStatDo;
import cn.com.duiba.nezha.compute.alg.vo.StatDo;
import cn.com.duiba.nezha.compute.common.util.AssertUtil;
import cn.com.duiba.nezha.compute.common.util.DataUtil;
import com.alibaba.fastjson.JSON;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class BackendOptimizer {
public static Map<String, Double> backendTypePriorityMap = new HashMap<>();
static {
backendTypePriorityMap.put("1", 1.0);
backendTypePriorityMap.put("2", 1.0);
backendTypePriorityMap.put("3", 1.0);
backendTypePriorityMap.put("4", 0.0);
backendTypePriorityMap.put("5", 0.0);
backendTypePriorityMap.put("6", 0.0);
backendTypePriorityMap.put("7", 0.0);
backendTypePriorityMap.put("8", 0.2);
}
/**
* 后端转化,可优化后端行为&广告认定
*
* @param appAdvertStatMap
* @param globalAdvertStatMap
* @return (广告ID、后端转化数据类型、统计信息)
*/
public static Map<Long, BackendAdvertStatDo> getBackendAdvertStatInfo(Map<Long, StatDo> appAdvertStatMap,
Map<Long, StatDo> globalAdvertStatMap) {
Map<Long, BackendAdvertStatDo> ret = new HashMap<>();
if (AssertUtil.isAllNotEmpty(globalAdvertStatMap)) {
if (appAdvertStatMap == null) {
appAdvertStatMap = new HashMap<>();
}
for (Map.Entry<Long, StatDo> entry : globalAdvertStatMap.entrySet()) {
Long advertId = entry.getKey();
StatDo globalStatDo = entry.getValue();
StatDo appStatDo = appAdvertStatMap.get(advertId);
String type = getTaskBackendType(globalStatDo);
if (type != null) {
BackendAdvertStatDo backendAdvertStatDo = new BackendAdvertStatDo();
backendAdvertStatDo.setAdvertId(advertId);
backendAdvertStatDo.setBackendType(type);
backendAdvertStatDo.setAvgBackendCvr(getTaskBackendCvr(globalStatDo, type));
backendAdvertStatDo.setCBackendCvr(getTaskBackendCvr(appStatDo, type));
ret.put(advertId, backendAdvertStatDo);
}
}
}
return ret;
}
/**
* 广告后端转化优化-智能竞价因子
*
* @param advertPreInfo 预估数据
* @param advertStatInfo 统计数据
* @return 优化因子
*/
public static Map<Long, Double> getBackendAdvertInfo(Map<Long, Double> advertPreInfo,
Map<Long, BackendAdvertStatDo> advertStatInfo) {
Map<Long, Double> ret = new HashMap<>();
if (AssertUtil.isAllNotEmpty(advertPreInfo, advertStatInfo)) {
for (Map.Entry<Long, BackendAdvertStatDo> entry : advertStatInfo.entrySet()) {
Long advertId = entry.getKey();
BackendAdvertStatDo backendAdvertStatDo = entry.getValue();
Double preBackendCvr = advertPreInfo.get(advertId);
if (backendAdvertStatDo != null && preBackendCvr != null) {
Double mergeCvr = getMergeBackendCvr(backendAdvertStatDo.getCBackendCvr(), preBackendCvr);
Double optFactor = getBackendOptFactor(mergeCvr, backendAdvertStatDo.getAvgBackendCvr());
if (optFactor != null) {
ret.put(advertId, optFactor);
}
}
}
}
return ret;
}
public static Double getBackendOptFactor(Double mergeCvr, Double avgCvr) {
Double ret = null;
if (AssertUtil.isAllNotEmpty(mergeCvr, avgCvr)) {
Double ratio = (mergeCvr + 0.001) / (avgCvr + 0.001);
// System.out.println("ratio=" + ratio + ",mCvr=" + mergeCvr + ",aCvr=" + avgCvr);
if (ratio <= 1.0 ) {
if(mergeCvr<0.1){
ret = ModelPredRectifier.sigmoidWithZoomAndIntervalMap((ratio - 0.5), 0.1, 1.01, 8);
}
if(mergeCvr>=0.1){
ret = ModelPredRectifier.sigmoidWithZoomAndIntervalMap((ratio - 0.2), 0.1, 1.01, 8);
}
} else if (ratio <= 2.0) {
ret = 1.05;
} else {
ret = 1.1;
}
}
return ret;
}
public static Double getMergeBackendCvr(Double statCvr, Double preCvr) {
Double ret = null;
if (statCvr != null && preCvr != null) {
ret = 0.4 * statCvr + 0.6 * preCvr;
}
// if (statCvr == null && preCvr != null) {
// ret = 1 * preCvr;
// }
//
// if (statCvr != null && preCvr == null) {
// ret = 1 * statCvr;
// }
return ret;
}
/**
* 计算目标后端类型的转化率
*
* @param statDo
* @param backendType
* @return
*/
public static Double getTaskBackendCvr(StatDo statDo, String backendType) {
Double ret = null;
if (statDo != null && backendType != null) {
Long actClickCnt = statDo.getActClickCnt();
Map<String, Long> backendCntMap = statDo.getBackendCntMap();
if (actClickCnt != null && actClickCnt >= 30 && AssertUtil.isNotEmpty(backendCntMap)) {
Long cnt = backendCntMap.get(backendType);
if (cnt == null) {
cnt = 0L;
}
ret = DataUtil.division(cnt, actClickCnt, 4);
}
}
return ret;
}
/**
* 计算目标后端类型
*
* @param statDo
* @return
*/
public static String getTaskBackendType(StatDo statDo) {
String ret = null;
if (statDo != null) {
Long actClickCnt = statDo.getActClickCnt();
Map<String, Long> backendCntMap = statDo.getBackendCntMap();
if (actClickCnt != null && actClickCnt >= 50 && AssertUtil.isNotEmpty(backendCntMap)) {
// 添加优先级权重,并过滤
Map<String, Double> filterMap = new HashMap<>();
for (Map.Entry<String, Long> entry : backendCntMap.entrySet()) {
String type = entry.getKey();
Long cnt = entry.getValue();
Double weight = backendTypePriorityMap.get(type);
if (cnt != null && cnt >= 10L && weight != null) {
filterMap.put(type, cnt * weight);
}
}
// 返回得分Top
ret = getValueTopOneFromMap(filterMap);
}
}
return ret;
}
/**
* 获取map 依据value大小排序的 top1 key
*
* @param map
* @return
*/
public static String getValueTopOneFromMap(Map<String, Double> map) {
String ret = null;
if (AssertUtil.isNotEmpty(map)) {
Double maxValue = 1.0;
for (Map.Entry<String, Double> entry : map.entrySet()) {
Double val = entry.getValue();
if (val != null && val > maxValue) {
maxValue = val;
ret = entry.getKey();
}
}
}
return ret;
}
public static void main(String[] args) {
StatDo statDo = new StatDo();
statDo.setAdvertId(1L);
statDo.setActClickCnt(40L);
Map<String, Long> bcMap = new HashMap<>();
// bcMap.put("1",6L);
bcMap.put("3", 4L);
statDo.setBackendCntMap(bcMap);
Map<Long, StatDo> appAdvertStatMap = new HashMap<>();
appAdvertStatMap.put(1L, statDo);
StatDo statDo2 = new StatDo();
statDo2.setAdvertId(1L);
statDo2.setActClickCnt(300L);
Map<String, Long> bcMap2 = new HashMap<>();
bcMap2.put("2", 40L);
bcMap2.put("1", 50L);
statDo2.setBackendCntMap(bcMap2);
Map<Long, StatDo> globalAdvertStatMap = new HashMap<>();
globalAdvertStatMap.put(1L, statDo2);
Map<Long, BackendAdvertStatDo> ret1 = getBackendAdvertStatInfo(appAdvertStatMap, globalAdvertStatMap);
//Map<Long, BackendAdvertStatDo> ret1= getBackendAdvertStatInfo(null,null);
System.out.println("ret1=" + JSON.toJSONString(ret1));
Map<Long, Double> advertPreInfo = new HashMap<>();
advertPreInfo.put(1L, 0.1);
Map<Long, Double> ret2 = getBackendAdvertInfo(advertPreInfo, ret1);
System.out.println("ret2=" + JSON.toJSONString(ret2));
}
}
package cn.com.duiba.nezha.compute.alg;
import cn.com.duiba.nezha.compute.alg.util.CategoryFeatureDictUtil;
import cn.com.duiba.nezha.compute.api.dict.CategoryFeatureDict;
import cn.com.duiba.nezha.compute.api.enums.SerializerEnum;
import cn.com.duiba.nezha.compute.mllib.model.SparseFMModel;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.Serializable;
import java.util.List;
/**
* Created by pc on 2016/12/22.
*/
public class BaseAlgorithm implements Serializable {
private static final Logger logger = LoggerFactory.getLogger(BaseAlgorithm.class);
private CategoryFeatureDictUtil categoryFeatureDictUtil = null;
private List<String> featureIdxList = null;
private List<String> featureCollectionList = null;
public BaseAlgorithm() {
}
public List<String> getFeatureIdxList() {
if (this.featureIdxList == null) {
return null;
} else {
return this.featureIdxList;
}
}
public CategoryFeatureDictUtil getDictUtil() {
if (this.categoryFeatureDictUtil == null) {
this.categoryFeatureDictUtil = new CategoryFeatureDictUtil();
}
return this.categoryFeatureDictUtil;
}
public void setFeatureDict(CategoryFeatureDict dict) {
getDictUtil().setFeatureDict(dict);
}
public void setFeatureDict(String dict, SerializerEnum serializerEnum) {
System.out.println("setFeatureDict");
getDictUtil().setFeatureDict(dict, serializerEnum);
}
public void setModel(SparseFMModel model) {
}
public void setModel(String modelStr, SerializerEnum serializerEnum) {
}
public void setFeatureIdxList(List<String> featureIdxList) {
this.featureIdxList = featureIdxList;
}
public void setFeatureIdxList(String featureIdxStr, SerializerEnum serializerEnum) {
System.out.println("setFeatureIdxList");
this.featureIdxList = getDictUtil().getFeatureIdxList(featureIdxStr, serializerEnum);
}
public String getFeatureIdxListStr(SerializerEnum serializerEnum) {
return getDictUtil().featureIdxList2Str(getFeatureIdxList(), serializerEnum);
}
public void setFeatureCollectionList(List<String> featureCollectionList) {
this.featureCollectionList = featureCollectionList;
}
public void setFeatureCollectionList(String featureCollectionStr, SerializerEnum serializerEnum) {
System.out.println("setFeatureCollectionList");
this.featureCollectionList = getDictUtil().getFeatureCollectionList(featureCollectionStr, serializerEnum);
}
public String getFeatureCollectionListStr(SerializerEnum serializerEnum) {
return getDictUtil().featureCollectionList2Str(getFeatureCollectionList(), serializerEnum);
}
public List<String> getFeatureCollectionList() {
if (this.featureCollectionList == null) {
return null;
} else {
return this.featureCollectionList;
}
}
public String getFeatureDictStr(SerializerEnum serializerEnum) {
return getDictUtil().getFeatureDictStr(serializerEnum);
}
public String getModelStr(SerializerEnum serializerEnum) {
return "this model";
}
}
package cn.com.duiba.nezha.compute.alg;
import cn.com.duiba.nezha.compute.alg.util.FMModelUtil;
import cn.com.duiba.nezha.compute.alg.vo.VectorResult;
import cn.com.duiba.nezha.compute.api.PredResultVo;
import cn.com.duiba.nezha.compute.api.dto.AdvertModelEntity;
import cn.com.duiba.nezha.compute.api.enums.SerializerEnum;
import cn.com.duiba.nezha.compute.mllib.model.SparseFMModel;
import org.apache.spark.mllib.linalg.SparseVector;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
/**
* Created by pc on 2016/12/22.
*/
public class FM extends BaseAlgorithm implements Serializable, IAlgorithm {
private static final Logger logger = LoggerFactory.getLogger(FM.class);
private FMModelUtil modelUtil = null;
public FMModelUtil getModelUtil() {
if (this.modelUtil == null) {
this.modelUtil = new FMModelUtil();
}
return this.modelUtil;
}
public FM() {
}
public FM(String featureIdxList, String dict, String modelStr, String featureCollectionList, SerializerEnum serializerEnum) {
setFeatureDict(dict, serializerEnum);
setModel(modelStr, serializerEnum);
setFeatureIdxList(featureIdxList, serializerEnum);
setFeatureCollectionList(featureCollectionList, serializerEnum);
}
public FM(AdvertModelEntity entity) {
SerializerEnum serializerEnum = entity.getSerializerId() == SerializerEnum.KRYO.getIndex() ? SerializerEnum.KRYO : SerializerEnum.JAVA_ORIGINAL;
setFeatureDict(entity.getFeatureDictStr(), serializerEnum);
setFeatureIdxList(entity.getFeatureIdxListStr(), serializerEnum);
setFeatureCollectionList(entity.getFeatureCollectListStr(), serializerEnum);
setModel(entity.getModelStr(), serializerEnum);
}
public void setEntity(AdvertModelEntity entity) {
SerializerEnum serializerEnum = entity.getSerializerId() == SerializerEnum.KRYO.getIndex() ? SerializerEnum.KRYO : SerializerEnum.JAVA_ORIGINAL;
setFeatureDict(entity.getFeatureDictStr(), serializerEnum);
setFeatureIdxList(entity.getFeatureIdxListStr(), serializerEnum);
setFeatureCollectionList(entity.getFeatureCollectListStr(), serializerEnum);
setModel(entity.getModelStr(), serializerEnum);
}
public void setModel(SparseFMModel model) {
getModelUtil().setModel(model);
}
public void setModel(String modelStr, SerializerEnum serializerEnum) {
getModelUtil().setModel(modelStr, serializerEnum);
}
public String getModelStr(SerializerEnum serializerEnum) {
return getModelUtil().getModelStr(serializerEnum);
}
public Double predict(List<String> categoryList) {
Double ret = null;
try {
VectorResult vr = getDictUtil().oneHotSparseVectorEncode(getFeatureIdxList(), categoryList, getFeatureCollectionList());
if (vr != null && vr.getVector() != null) {
ret = getModelUtil().predict(vr.getVector());
}
} catch (Exception e) {
logger.error("predict happend error", e);
}
return ret;
}
public Double predict(Map<String, String> categoryMap) {
Double ret = null;
try {
// System.out.println("getFeatureCollectionList()"+getFeatureCollectionList());
VectorResult vr = getDictUtil().oneHotSparseVectorEncodeWithMap(getFeatureIdxList(), categoryMap, getFeatureCollectionList());
if (vr != null && vr.getVector() != null) {
// System.out.println("vr.getVector()"+vr.getVector());
ret = predictWithVector(vr.getVector());
}
} catch (Exception e) {
logger.error("predict happend error", e);
}
return ret;
}
public PredResultVo predictWithInfo(Map<String, String> categoryMap) {
PredResultVo ret = new PredResultVo();
try {
VectorResult vr = getDictUtil().oneHotSparseVectorEncodeWithMap(getFeatureIdxList(), categoryMap, getFeatureCollectionList());
if (vr != null && vr.getVector() != null) {
Double predValue = predictWithVector(vr.getVector());
ret.setPredValue(predValue);
ret.setNewFeatureNums(vr.getNewFeatureNums());
ret.setTotalFeatureNums(vr.getTotalFeatureNums());
}
} catch (Exception e) {
logger.error("predict happend error", e);
}
return ret;
}
public VectorResult predictWithVectorResult(Map<String, String> categoryMap) {
VectorResult ret = new VectorResult();
try {
VectorResult vr = getDictUtil().oneHotSparseVectorEncodeWithMap(getFeatureIdxList(), categoryMap, getFeatureCollectionList());
if (vr != null && vr.getVector() != null) {
Double predValue = predictWithVector(vr.getVector());
ret.setNewFeatureNums(vr.getNewFeatureNums());
ret.setTotalFeatureNums(vr.getTotalFeatureNums());
}
} catch (Exception e) {
logger.error("predict happend error", e);
}
return ret;
}
public Double predictWithVector(SparseVector vector) {
Double ret = null;
try {
if (vector != null) {
// System.out.println("vector " + vector);
ret = getModelUtil().predict(vector);
}
} catch (Exception e) {
logger.error("predict happend error", e);
}
return ret;
}
}
package cn.com.duiba.nezha.compute.alg;
import cn.com.duiba.nezha.compute.api.dto.AdvertModelEntity;
import com.alibaba.fastjson.JSONObject;
import java.io.Serializable;
/**
* Created by pc on 2016/12/22.
*/
public class FMTest implements Serializable {
private static final long serialVersionUID = -316102112618444133L;
public FM model = null;
public AdvertModelEntity entity = null;
public FM getModel() {
if (model == null) {
System.out.println("getModel");
model = new FM();
model.setEntity(entity);
System.out.print("model.getFeatureIdxList()=");
System.out.println(JSONObject.toJSONString(model.getFeatureIdxList()));
}
return model;
}
public void setEntity(AdvertModelEntity entity2) {
entity = entity2;
}
public AdvertModelEntity getEntity() {
return entity;
}
}
package cn.com.duiba.nezha.compute.alg;
import cn.com.duiba.nezha.compute.alg.util.CategoryFeatureDictUtil;
import cn.com.duiba.nezha.compute.alg.util.FMModelUtil;
import cn.com.duiba.nezha.compute.alg.vo.VectorResult;
import cn.com.duiba.nezha.compute.api.PredResultVo;
import cn.com.duiba.nezha.compute.api.dict.CategoryFeatureDict;
import cn.com.duiba.nezha.compute.api.dto.AdvertModelEntity;
import cn.com.duiba.nezha.compute.api.enums.SerializerEnum;
import cn.com.duiba.nezha.compute.mllib.model.SparseFMModel;
import org.apache.spark.mllib.linalg.SparseVector;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
/**
* Created by pc on 2016/12/22.
*/
public class FMbac implements Serializable ,IAlgorithm{
private static final Logger logger = LoggerFactory.getLogger(FMbac.class);
private CategoryFeatureDictUtil categoryFeatureDictUtil = null;
private FMModelUtil modelUtil = null;
private List<String> featureIdxList = null;
public FMbac() {
}
public FMbac(String featureIdxList, String dict, String modelStr, SerializerEnum serializerEnum) {
setFeatureDict(dict, serializerEnum);
setModel(modelStr, serializerEnum);
setFeatureIdxList(featureIdxList, serializerEnum);
}
public FMbac(AdvertModelEntity entity) {
SerializerEnum serializerEnum = entity.getSerializerId() == SerializerEnum.KRYO.getIndex() ? SerializerEnum.KRYO : SerializerEnum.JAVA_ORIGINAL;
setFeatureDict(entity.getFeatureDictStr(), serializerEnum);
setModel(entity.getModelStr(), serializerEnum);
setFeatureIdxList(entity.getFeatureIdxListStr(), serializerEnum);
}
public List<String> getFeatureIdxList() {
if (this.featureIdxList == null) {
return null;
} else {
return this.featureIdxList;
}
}
public CategoryFeatureDictUtil getDictUtil() {
if (this.categoryFeatureDictUtil == null) {
this.categoryFeatureDictUtil = new CategoryFeatureDictUtil();
}
return this.categoryFeatureDictUtil;
}
public FMModelUtil getModelUtil() {
if (this.modelUtil == null) {
this.modelUtil = new FMModelUtil();
}
return this.modelUtil;
}
public void setFeatureDict(CategoryFeatureDict dict) {
getDictUtil().setFeatureDict(dict);
}
public void setFeatureDict(String dict, SerializerEnum serializerEnum) {
getDictUtil().setFeatureDict(dict, serializerEnum);
}
public void setModel(SparseFMModel model) {
getModelUtil().setModel(model);
}
public void setModel(String modelStr, SerializerEnum serializerEnum) {
getModelUtil().setModel(modelStr, serializerEnum);
}
public void setFeatureIdxList(List<String> featureIdxList) {
this.featureIdxList = featureIdxList;
}
public void setFeatureIdxList(String featureIdxStr, SerializerEnum serializerEnum) {
this.featureIdxList = getDictUtil().getFeatureIdxList(featureIdxStr, serializerEnum);
}
public String getFeatureIdxListStr(SerializerEnum serializerEnum) {
return getDictUtil().featureIdxList2Str(getFeatureIdxList(), serializerEnum);
}
public String getFeatureDictStr(SerializerEnum serializerEnum) {
return getDictUtil().getFeatureDictStr(serializerEnum);
}
public String getModelStr(SerializerEnum serializerEnum) {
return getModelUtil().getModelStr(serializerEnum);
}
public Double predict(List<String> categoryList) {
Double ret = null;
try {
SparseVector sv = getDictUtil().oneHotSparseVectorEncode(getFeatureIdxList(), categoryList);
if (sv != null) {
ret = getModelUtil().predict(sv);
}
} catch (Exception e) {
logger.error("predict happend error", e);
}
return ret;
}
public Double predict(Map<String, String> categoryMap) {
Double ret = null;
try {
SparseVector sv = getDictUtil().oneHotSparseVectorEncodeWithMap(getFeatureIdxList(), categoryMap);
if (sv != null) {
ret = getModelUtil().predict(sv);
}
} catch (Exception e) {
logger.error("predict happend error", e);
}
return ret;
}
public PredResultVo predictWithInfo(Map<String, String> categoryMap) {
PredResultVo ret = new PredResultVo();
return ret;
}
public Double predictWithVector(SparseVector vector) {
Double ret = null;
try {
if (vector != null) {
System.out.println("vector " + vector);
ret = getModelUtil().predict(vector);
}
} catch (Exception e) {
logger.error("predict happend error", e);
}
return ret;
}
}
package cn.com.duiba.nezha.compute.alg;
import cn.com.duiba.nezha.compute.api.PredResultVo;
import java.util.List;
import java.util.Map;
/**
* Created by pc on 2017/7/11.
*/
public interface IAlgorithm {
Double predict(Map<String, String> categoryMap);
Double predict(List<String> categoryList);
PredResultVo predictWithInfo(Map<String, String> categoryMap);
}
package cn.com.duiba.nezha.compute.alg;
import cn.com.duiba.nezha.compute.alg.util.LogisticRegressionModelUtil;
import cn.com.duiba.nezha.compute.alg.vo.VectorResult;
import cn.com.duiba.nezha.compute.api.PredResultVo;
import cn.com.duiba.nezha.compute.api.dto.AdvertModelEntity;
import cn.com.duiba.nezha.compute.api.enums.SerializerEnum;
import org.apache.spark.mllib.classification.LogisticRegressionModel;
import org.apache.spark.mllib.linalg.SparseVector;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
/**
* Created by pc on 2016/12/22.
*/
public class LR extends BaseAlgorithm implements Serializable, IAlgorithm {
private static final Logger logger = LoggerFactory.getLogger(LR.class);
private LogisticRegressionModelUtil modelUtil = null;
public LogisticRegressionModelUtil getModelUtil() {
if (this.modelUtil == null) {
this.modelUtil = new LogisticRegressionModelUtil();
}
return this.modelUtil;
}
public LR() {
}
public LR(String featureIdxList, String dict, String modelStr, String featureCollectionList, SerializerEnum serializerEnum) {
setFeatureDict(dict, serializerEnum);
setModel(modelStr, serializerEnum);
setFeatureIdxList(featureIdxList, serializerEnum);
setFeatureCollectionList(featureCollectionList, serializerEnum);
}
public LR(AdvertModelEntity entity) {
SerializerEnum serializerEnum = entity.getSerializerId() == SerializerEnum.KRYO.getIndex() ? SerializerEnum.KRYO : SerializerEnum.JAVA_ORIGINAL;
setFeatureDict(entity.getFeatureDictStr(), serializerEnum);
setModel(entity.getModelStr(), serializerEnum);
setFeatureIdxList(entity.getFeatureIdxListStr(), serializerEnum);
setFeatureCollectionList(entity.getFeatureCollectListStr(), serializerEnum);
}
public void setEntity(AdvertModelEntity entity) {
SerializerEnum serializerEnum = entity.getSerializerId() == SerializerEnum.KRYO.getIndex() ? SerializerEnum.KRYO : SerializerEnum.JAVA_ORIGINAL;
setFeatureDict(entity.getFeatureDictStr(), serializerEnum);
setFeatureIdxList(entity.getFeatureIdxListStr(), serializerEnum);
setFeatureCollectionList(entity.getFeatureCollectListStr(), serializerEnum);
setModel(entity.getModelStr(), serializerEnum);
}
public void setModel(LogisticRegressionModel model) {
getModelUtil().setModel(model);
}
public void setModel(String modelStr, SerializerEnum serializerEnum) {
getModelUtil().setModel(modelStr, serializerEnum);
}
public String getModelStr(SerializerEnum serializerEnum) {
return getModelUtil().getModelStr(serializerEnum);
}
public Double predict(List<String> categoryList) {
Double ret = null;
try {
VectorResult vr = getDictUtil().oneHotSparseVectorEncode(getFeatureIdxList(), categoryList, getFeatureCollectionList());
if (vr != null && vr.getVector() != null) {
ret = getModelUtil().predict(vr.getVector());
}
} catch (Exception e) {
logger.error("predict happend error", e);
}
return ret;
}
public Double predict(Map<String, String> categoryMap) {
Double ret = null;
try {
VectorResult vr = getDictUtil().oneHotSparseVectorEncodeWithMap(getFeatureIdxList(), categoryMap, getFeatureCollectionList());
if (vr != null && vr.getVector() != null) {
ret = getModelUtil().predict(vr.getVector());
}
} catch (Exception e) {
logger.error("predict happend error", e);
}
return ret;
}
@Override
public PredResultVo predictWithInfo(Map<String, String> categoryMap) {
PredResultVo ret = new PredResultVo();
try {
VectorResult vr = getDictUtil().oneHotSparseVectorEncodeWithMap(getFeatureIdxList(), categoryMap, getFeatureCollectionList());
if (vr != null && vr.getVector() != null) {
Double predValue = predictWithVector(vr.getVector());
ret.setPredValue(predValue);
ret.setNewFeatureNums(vr.getNewFeatureNums());
ret.setTotalFeatureNums(vr.getTotalFeatureNums());
}
} catch (Exception e) {
logger.error("predict happend error", e);
}
return ret;
}
public Double predictWithVector(SparseVector vector) {
Double ret = null;
try {
if (vector != null) {
ret = getModelUtil().predict(vector);
}
} catch (Exception e) {
logger.error("predict happend error", e);
}
return ret;
}
}
package cn.com.duiba.nezha.compute.alg.util;
import cn.com.duiba.nezha.compute.api.enums.SerializerEnum;
import cn.com.duiba.nezha.compute.common.util.serialize.KryoUtil;
import cn.com.duiba.nezha.compute.common.util.serialize.SerializeTool;
import cn.com.duiba.nezha.compute.mllib.model.SparseFMModel;
import org.apache.spark.mllib.linalg.SparseVector;
import java.io.Serializable;
/**
* Created by pc on 2016/12/21.
*/
public class FMModelUtil implements Serializable {
private static final long serialVersionUID = -316102112618444922L;
private SparseFMModel model = null;
public void setModel(SparseFMModel model) {
this.model = model;
}
public void setModel(String modelStr, SerializerEnum serializerEnum) {
this.model = getModel(modelStr, serializerEnum);
}
public SparseFMModel getModel() {
// this.model.clearThreshold();
return this.model;
}
public SparseFMModel getModel(String src, SerializerEnum serializerEnum) {
SparseFMModel ret = null;
if (serializerEnum == SerializerEnum.JAVA_ORIGINAL) {
ret = SerializeTool.getObjectFromString(src);
}
if (serializerEnum == SerializerEnum.KRYO) {
ret = KryoUtil.deserializationObject(src, SparseFMModel.class);
}
return ret;
}
public String getModelStr(SparseFMModel model, SerializerEnum serializerEnum) {
String ret = null;
if (serializerEnum == SerializerEnum.JAVA_ORIGINAL) {
ret = SerializeTool.object2String(model);
}
if (serializerEnum == SerializerEnum.KRYO) {
ret = KryoUtil.serializationObject(model);
}
return ret;
}
public String getModelStr(SerializerEnum serializerEnum) {
return getModelStr(model, serializerEnum);
}
public Double predict(SparseVector data) {
if (getModel() == null) {
return null;
} else {
return getModel().predict(data);
}
}
}
package cn.com.duiba.nezha.compute.alg.util;
import cn.com.duiba.nezha.compute.api.enums.SerializerEnum;
import cn.com.duiba.nezha.compute.common.util.serialize.KryoUtil;
import cn.com.duiba.nezha.compute.common.util.serialize.SerializeTool;
import org.apache.spark.mllib.classification.LogisticRegressionModel;
import org.apache.spark.mllib.linalg.Vector;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.Serializable;
/**
* Created by pc on 2016/12/21.
*/
public class LogisticRegressionModelUtil implements Serializable {
private Logger logger = LoggerFactory.getLogger(this.getClass().getName());
private static final long serialVersionUID = -316102112618444922L;
private LogisticRegressionModel model = null;
public void setModel(LogisticRegressionModel model) {
this.model = model;
}
public void setModel(String modelStr, SerializerEnum serializerEnum) {
this.model = getModel(modelStr, serializerEnum);
}
public LogisticRegressionModel getModel() {
return this.model;
}
public LogisticRegressionModel getModel(String src, SerializerEnum serializerEnum) {
LogisticRegressionModel ret = null;
if (serializerEnum == SerializerEnum.JAVA_ORIGINAL) {
ret = SerializeTool.getObjectFromString(src);
}
if (serializerEnum == SerializerEnum.KRYO) {
ret = KryoUtil.deserializationObject(src, LogisticRegressionModel.class);
}
return ret;
}
public String getModelStr(LogisticRegressionModel model, SerializerEnum serializerEnum) {
String ret = null;
if (serializerEnum == SerializerEnum.JAVA_ORIGINAL) {
ret = SerializeTool.object2String(model);
}
if (serializerEnum == SerializerEnum.KRYO) {
ret = KryoUtil.serializationObject(model);
}
return ret;
}
public String getModelStr(SerializerEnum serializerEnum) {
return getModelStr(model, serializerEnum);
}
public Double predict(Vector data) {
if (getModel() == null) {
return null;
} else {
return getModel().predict(data);
}
}
}
package cn.com.duiba.nezha.compute.alg.util;
import cn.com.duiba.nezha.compute.alg.FM;
import cn.com.duiba.nezha.compute.api.PredResultVo;
import cn.com.duiba.nezha.compute.api.point.Point;
import cn.com.duiba.nezha.compute.api.vo.AlgFeatureVo;
import com.alibaba.fastjson.JSONObject;
import org.apache.spark.mllib.linalg.Matrix;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Created by pc on 2016/12/21.
*/
public class ReplayerUtil implements Serializable {
private static final long serialVersionUID = -316102112618444922L;
private FM model = null;
private Map<String, AlgFeatureVo> featuremap = null;
public void setModel(FM model) {
this.model = model;
}
public FM getModel() {
return this.model;
}
public void setFeaturemap() {
this.featuremap = setAlgFeatureMap();
}
public Map<String, AlgFeatureVo> getFeaturemap() {
if (featuremap == null) {
setFeaturemap();
}
return this.featuremap;
}
public List<Point.ModelFeature> getFeatureInfoList() throws Exception {
List<Point.ModelFeature> ret = new ArrayList<>();
if (featuremap == null) {
setFeaturemap();
}
for (AlgFeatureVo algFeatureVo : featuremap.values()) {
Point.ModelFeature modelFeature = new Point.ModelFeature(algFeatureVo.getFeatureId(),
algFeatureVo.getCategory(),
algFeatureVo.getFeatureCategorySize(),
algFeatureVo.getIndex(),
algFeatureVo.getSubIndex(),
algFeatureVo.getIntercept(),
algFeatureVo.getWeight(),
algFeatureVo.getFactor());
ret.add(modelFeature);
}
return ret;
}
public void predictWithInfo(Map<String, String> featureIdxMap) {
PredResultVo ret = new PredResultVo();
Map<String, AlgFeatureVo> featureMap = new HashMap<>();
try {
List<String> featureIdxList = getModel().getFeatureIdxList();
List<String> featureCollectionList = getModel().getFeatureCollectionList();
for (String featureIdx : featureIdxList) {
if (featureCollectionList.contains(featureIdx) && featureIdxMap.get(featureIdx) != null) {
String[] categoryArray = featureIdxMap.get(featureIdx).split(",", 0);
for (String category : categoryArray) {
print(featureIdx, category);
}
} else {
print(featureIdx, featureIdxMap.get(featureIdx));
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
public void print(String feature, String category) {
try {
if (category != null) {
category = category.toLowerCase();
}
if (getFeaturemap().containsKey(feature + "_" + category)) {
System.out.println(feature + "_" + category + "," + JSONObject.toJSONString(getFeaturemap().get(feature + "_" + category)));
} else {
System.out.println(feature + "_" + category + "," + JSONObject.toJSONString(getFeaturemap().get(feature + "_" + null)));
}
} catch (Exception e) {
}
}
public Map<String, AlgFeatureVo> setAlgFeatureMap() {
Map<String, AlgFeatureVo> ret = new HashMap<>();
try {
List<String> featureIdxList = getModel().getFeatureIdxList();
int totalFeatureNums = featureIdxList.size();
Point.FMModelParams params = getModel().getModelUtil().getModel().getFMModelParams();
org.apache.spark.mllib.linalg.Vector w = params.w();
Matrix v = params.v();
Double w0 = params.w0();
int sizeSum = 0;
for (int i = 0; i < totalFeatureNums; i++) {
String featureIdx = featureIdxList.get(i);
List<String> categoryList = getModel().getDictUtil().getFeature(featureIdx);
if (categoryList == null) {
categoryList = new ArrayList<>();
}
int categorySize = categoryList.size();
int categoryIdxNull = sizeSum;
Double categoryWNull = w.apply(categoryIdxNull);
List<Double> categoryVNull = new ArrayList<>();
for (int k = 0; k < v.numCols(); k++) {
categoryVNull.add(v.apply(categoryIdxNull, k));
}
//组装
AlgFeatureVo algFeatureVo1 = new AlgFeatureVo();
algFeatureVo1.setFeatureId(featureIdx);
algFeatureVo1.setFactor(JSONObject.toJSONString(categoryVNull));
algFeatureVo1.setIndex((long) categoryIdxNull);
algFeatureVo1.setWeight(categoryWNull);
algFeatureVo1.setCategory(null);
algFeatureVo1.setFeatureCategorySize((long) categorySize);
algFeatureVo1.setSubIndex(-1L);
algFeatureVo1.setIntercept(w0);
ret.put(featureIdx + "_" + null, algFeatureVo1);
for (int j = 0; j < categorySize; j++) {
String category = categoryList.get(j);
int categoryIdx = sizeSum + j + 1;
Double categoryW = w.apply(categoryIdx);
List<Double> categoryV = new ArrayList<>();
for (int k2 = 0; k2 < v.numCols(); k2++) {
categoryV.add(v.apply(categoryIdx, k2));
}
//组装
AlgFeatureVo algFeatureVo = new AlgFeatureVo();
algFeatureVo.setFeatureId(featureIdx);
algFeatureVo.setFactor(JSONObject.toJSONString(categoryV));
algFeatureVo.setIndex((long) categoryIdx);
algFeatureVo.setWeight(categoryW);
algFeatureVo.setCategory(category);
algFeatureVo.setFeatureCategorySize((long) categorySize);
algFeatureVo.setSubIndex((long) j);
algFeatureVo.setIntercept(w0);
ret.put(featureIdx + "_" + category, algFeatureVo);
}
sizeSum += categorySize + 1;
}
} catch (Exception e) {
e.printStackTrace();
}
return ret;
}
public static void getFactorList(Matrix v) {
}
}
package cn.com.duiba.nezha.compute.alg.vo;
public class BackendAdvertStatDo {
private Long advertId;
private String backendType;
private Double avgBackendCvr;
private Double cBackendCvr;
public Long getAdvertId() {
return advertId;
}
public void setAdvertId(Long advertId) {
this.advertId = advertId;
}
public String getBackendType() {
return backendType;
}
public void setBackendType(String backendType) {
this.backendType = backendType;
}
public Double getAvgBackendCvr() {
return avgBackendCvr;
}
public void setAvgBackendCvr(Double avgBackendCvr) { this.avgBackendCvr = avgBackendCvr; }
public Double getCBackendCvr() {
return cBackendCvr;
}
public void setCBackendCvr(Double cBackendCvr) { this.cBackendCvr = cBackendCvr; }
}
package cn.com.duiba.nezha.compute.alg.vo;
import java.util.Map;
public class StatDo {
private Long advertId;
private Long launchCnt;
private Long chargeCnt;
private Long actExpCnt;
private Long actClickCnt;
private Long chargeFees;
private Double mergeCtr;
private Double mergeCvr;
private Map<String, Long> backendCntMap; // 后端转化数据 Map集合 Key:1安装APP,2启动APP,3注册账户,4激活账户,5登录账户,6用户付费,7用户进件,8用户完件;Value:Cnt
public Long getAdvertId() {
return advertId;
}
public void setAdvertId(Long advertId) {
this.advertId = advertId;
}
public Long getLaunchCnt() {
return launchCnt;
}
public void setLaunchCnt(Long launchCnt) {
this.launchCnt = launchCnt;
}
public Long getChargeCnt() {
return chargeCnt;
}
public void setChargeCnt(Long chargeCnt) {
this.chargeCnt = chargeCnt;
}
public Long getActClickCnt() {
return actClickCnt;
}
public void setActClickCnt(Long actClickCnt) {
this.actClickCnt = actClickCnt;
}
public Long getActExpCnt() {
return actExpCnt;
}
public void setActExpCnt(Long actExpCnt) {
this.actExpCnt = actExpCnt;
}
public Long getChargeFees() {
return chargeFees;
}
public void setChargeFees(Long chargeFees) {
this.chargeFees = chargeFees;
}
public Double getMergeCtr() {
return mergeCtr;
}
public void setMergeCtr(Double mergeCtr) {
this.mergeCtr = mergeCtr;
}
public Double getMergeCvr() {
return mergeCvr;
}
public void setMergeCvr(Double mergeCvr) {
this.mergeCvr = mergeCvr;
}
public Map<String, Long> getBackendCntMap() {
return backendCntMap;
}
public void setBackendCntMap(Map<String, Long> backendCntMap) {
this.backendCntMap = backendCntMap;
}
}
package cn.com.duiba.nezha.compute.alg.vo;
import org.apache.spark.mllib.linalg.SparseVector;
import java.io.Serializable;
/**
* Created by pc on 2016/11/16.
*/
public class VectorResult implements Serializable {
private static final long serialVersionUID = -316102112618444133L;
private SparseVector vector;
private Double predValue;
private int newFeatureNums;
private int totalFeatureNums;
public SparseVector getVector() {
return vector;
}
public void setVector(SparseVector vector) {
this.vector = vector;
}
public int getNewFeatureNums() {
return newFeatureNums;
}
public void setNewFeatureNums(int newFeatureNums) {
this.newFeatureNums = newFeatureNums;
}
public int getTotalFeatureNums() {
return totalFeatureNums;
}
public void setTotalFeatureNums(int totalFeatureNums) {
this.totalFeatureNums = totalFeatureNums;
}
public Double getPredValue() {
return predValue;
}
public void setPredValue(Double predValue) {
this.predValue = predValue;
}
}
repositories {
mavenCentral()
}
package cn.com.duiba.nezha.compute.api;
import java.io.Serializable;
/**
* Created by pc on 2016/11/16.
*/
public class PredResultVo implements Serializable {
private static final long serialVersionUID = -316102112618444113L;
private Double predValue;
private int newFeatureNums;
private int totalFeatureNums;
public Double getPredValue() {
return predValue;
}
public void setPredValue(Double predValue) {
this.predValue = predValue;
}
public int getNewFeatureNums() {
return newFeatureNums;
}
public void setNewFeatureNums(int newFeatureNums) {
this.newFeatureNums = newFeatureNums;
}
public int getTotalFeatureNums() {
return totalFeatureNums;
}
public void setTotalFeatureNums(int totalFeatureNums) {
this.totalFeatureNums = totalFeatureNums;
}
}
package cn.com.duiba.nezha.compute.api.cachekey;
/**
* Created by pc on 2017/2/17.
*/
public class AdvertStatKey {
public static final String HBASE_PROFIX = "nz_ad_stat_"; //
public static final String STAT_PROFIX = "nz_ad_stat_"; //
public static final String CHEAK_PROFIX = "nz_ad_cheak_"; //
public static final String CTR_STAT_PROFIX = "nz_ad_ctr_stat_"; //
public static final String STAT_DIM_PROFIX = "nz_ad_stat_dim_"; //
public static final String STAT_SUB_DIM_PROFIX = "nz_ad_s_s_d_"; //
// public static String getAdvertStatRowKey(String advertId,
// String materialId,
// String advertType,
// String advertStatDimType,
// String statDimId) {
//
//
//
//
// String ret = HBASE_PROFIX + advertId + "_" +
// advertType + "_" +
// advertStatDimType + "_" +
// statDimId + "_";
//
// if (materialId != null) {
// ret = HBASE_PROFIX + advertId + "_" +
// advertType + "_" +
// advertStatDimType + "_" +
// statDimId + "_" + materialId;
// }
// return ret;
// }
public static String getAdvertStatRowKey(String advertId,
String materialId,
Long advertTimes,
String advertStatDimType,
String statDimId) {
if (advertTimes == null) {
advertTimes = 1L;
} else if (advertTimes >= 10) {
advertTimes = 10L;
}
String ret = HBASE_PROFIX + advertId + "_" +
advertTimes + "_" +
advertStatDimType + "_" +
statDimId + "_";
if (materialId != null) {
ret = HBASE_PROFIX + advertId + "_" +
advertTimes + "_" +
advertStatDimType + "_" +
statDimId + "_" + materialId;
}
return ret;
}
public static String getAdvertStatStatusKey() {
String ret = CHEAK_PROFIX + "_stat_update_time_";
return ret;
}
public static String getAdvertStatESKey(String advertId,
String advertType,
String advertStatDimType,
String statDimId) {
return STAT_PROFIX + advertId + "_" +
advertType + "_" +
advertStatDimType + "_" +
statDimId + "_";
}
public static String getAdvertCtrStatESKey(String advertId,
String advertType,
String advertStatDimType,
String statDimId,
String statIntervalId) {
return CTR_STAT_PROFIX + advertId + "_" +
advertType + "_" +
advertStatDimType + "_" +
statDimId + "_" +
statIntervalId + "_";
}
public static String getAdvertStatRedisKey(String statDimId) {
return STAT_DIM_PROFIX + statDimId + "_";
}
public static String getAdvertStatMongoDbKey(String advertId, String materialId, String appId, Long times) {
if (times == null) {
times = 1L;
} else if (times >= 10) {
times = 10L;
}
return STAT_DIM_PROFIX + appId + "_" + advertId + "_" + materialId + "_" + times;
}
public static String getAdvertStatMongoDbId(String advertId, String materialId, String appId, String timeinterval) {
return STAT_SUB_DIM_PROFIX + appId + "_" + advertId + "_" + materialId + "_" + timeinterval;
}
public static String getAdvertStatMongoDbKey(String advertId, String appId, Long times) {
if (times == null) {
times = 1L;
} else if (times >= 10) {
times = 10L;
}
return getAdvertStatMongoDbKey(advertId, null, appId, times);
}
// appId_advertId_day_hour
// day 20170905 hour 08
public static String getAdvertSubStatMongoDbKey(String advertId, String appId, String timeinterval) {
return getAdvertStatMongoDbId(advertId, null, appId, timeinterval);
}
}
package cn.com.duiba.nezha.compute.api.cachekey;
/**
* Created by pc on 2017/2/17.
*/
public class FeatureKey {
public static final String HBASE_COF_PROFIX = "nz_cof_"; //
public static final String HBASE_CI_PROFIX = "nz_cf_"; //
public static final String HBASE_DI_PROFIX = "nz_df_"; //
public static final String REDIS_PROFIX = "nzh_e_cof_"; //
public static final String REDIS_CF_PROFIX = "nzh_e_cf_"; //
public static String getConsumerOrderFeatureRowKey(String consumerId, String activityId) {
return HBASE_COF_PROFIX + consumerId + "_" + activityId + "_";
}
public static String getConsumerInfoMongoDbKey(String consumerId) {
// return REDIS_CF_PROFIX + consumerId + "_" ;
return consumerId;
}
public static String getConsumerInfoRowKey(String consumerId) {
return HBASE_CI_PROFIX + consumerId + "_" ;
}
public static String getDeviceInfoRowKey(String deviceId) {
return HBASE_DI_PROFIX + deviceId + "_" ;
}
public static String getConsumerOrderFeatureRedisKey(String consumerId, String activityId) {
return REDIS_PROFIX + consumerId + "_" + activityId + "_";
}
public static String getConsumerOrderFeatureRedisDateKey(String consumerId, String activityId, String date) {
return REDIS_PROFIX + consumerId + "_" + activityId + "_" + date + "_";
}
public static String getConsumerOrderFeatureESKey(String consumerId) {
return REDIS_PROFIX + consumerId+"_";
}
}
package cn.com.duiba.nezha.compute.api.cachekey;
/**
* Created by pc on 2017/2/17.
*/
public class ModelKey {
public static final String HBASE_PROFIX = "nz_cof_"; // consumer order rank
public static final String REDIS_PROFIX = "nzh_e_cof_"; // consumer order rank
// 模型Key
private static final String MODEL_DT_KEY_PREFIX = "nz_dt_model_";
// 模型Key
private static final String MODEL_LAST_KEY_PREFIX = "nz_last_model_";
public static String getConsumerOrderFeatureRowKey(String consumerId, String activityId) {
return HBASE_PROFIX + consumerId + "_" + activityId + "_";
}
/**
* @param modelKey
* @param dt
* @return
*/
public static String getDtModelKey(String modelKey, String dt) {
return MODEL_DT_KEY_PREFIX + modelKey + "_" + dt + "_";
}
/**
* @param modelKey
* @return
*/
public static String getLastModelKey(String modelKey) {
return MODEL_LAST_KEY_PREFIX + modelKey + "_";
}
}
package cn.com.duiba.nezha.compute.api.cachekey;
/**
* Created by pc on 2017/2/17.
*/
public class NezhaStatKey {
public static final String PROFIX = "nze_ad_stat"; //
/**
* 哪吒引擎模型预估Hbase存储
* @param algType
* @param advertId
* @param appId
* @return
*/
public static String getNezhaStatHbaseKey(Long algType,
Long advertId,
Long appId) {
return PROFIX+"_"+algType+"_"+advertId+"_"+appId;
}
/**
* 哪吒引擎模型预估MongoDb存储
* @param algType
* @param advertId
* @param appId
* @return
*/
public static String getNezhaStatMongoDbKey(Long algType,
Long advertId,
Long appId) {
return PROFIX+"_"+algType+"_"+advertId+"_"+appId;
}
}
package cn.com.duiba.nezha.compute.api.constant;
/**
* Created by pc on 2016/11/21.
*/
public class GlobalConstant {
public static String KAFKA_BROKERS = "nezha.compute.kafka.brokers";
public static String KAFKA_TOPICS_TUIA_LAUNCH_LOG = "nezha.compute.kafka.topics.tuia.launch.log";
public static String KAFKA_TOPICS_TUIA_CHARGE_LOG = "nezha.compute.kafka.topics.tuia.consume.log";
public static String ES_CLUSTER_NAME = "nezha.compute.es.cluster.name";
public static String ES_CLUSTER_HOST = "nezha.compute.es.cluster.nodes";
public static String ES_CLUSTER_POST = "nezha.compute.es.cluster.post";
//es
public static String AD_STAT_ES_INDEX = "nezha";
public static String AD_STAT_ES_TYPE = "ad_stat";
public static String AD_CTR_STAT_ES_TYPE = "ad_ctr";
// mongodb
public static String MATERIAL_STAT_COLLECTION_NAME = "material_stat";
public static String ADVERT_STAT_COLLECTION_NAME = "ad_ctr";
public static String ADVERT_INTERVAL_STAT_COLLECTION_NAME = "hourly_data";
public static String NEZHA_STAT_COLLECTION_NAME = "nezha_stat";
//es
public static String CONSUMER_FEATURE_ES_INDEX = "nezha";
public static String CONSUMER_FEATURE_ES_TYPE = "consumer_feature";
//es
public static String LR_MODEL_ES_INDEX = "nezha";
public static String LR_MODEL_ES_TYPE = "lr_model";
//es
public static String NZ_FEATURE_ES_INDEX = "nzhfeature";
public static String NZ_FEATURE_ES_TYPE = "feature";
public static String AD_GLOBAL = "global";
public static String MD_CAT_INDEX = "createdAt";
public static double DOUBLE_ZERO =0.000000000001;
public static double EPSILON =0.00000001;
public static double IE6 =0.000001 ;
}
package cn.com.duiba.nezha.compute.api.dict;
import java.io.Serializable;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Created by pc on 2016/12/15.
*/
public class CategoryFeatureDict implements Serializable {
private static final long serialVersionUID = -316102112618444923L;
private Map<String, List<String>> dict = new HashMap<>();
//
public Map<String, List<String>> getFeatureDict() {
return this.dict;
}
public void setFeatureDict(Map<String, List<String>> dict) {
this.dict = dict;
}
//
public List<String> getFeature(String featureIdx) {
return this.dict.get(featureIdx);
}
public void setFeature(String featureIdx, List<String> featureMap) {
this.dict.put(featureIdx, featureMap);
}
}
package cn.com.duiba.nezha.compute.api.dto;
import java.io.Serializable;
/**
* Created by pc on 2016/11/16.
*/
public class AdvertAppStatDto implements Serializable {
private static final long serialVersionUID = -316102112618444133L;
private String key;
private Long appId;
private Long advertId;
private Long materialId;
private AdvertCtrStatDto appCdStat;// 广告媒体维度,首次投放,当日 CTR
private AdvertCtrStatDto appR2dStat;// 广告媒体维度,首次投放,近2日 CTR
private AdvertCtrStatDto appR7dStat;// 广告媒体维度,首次投放,近7日CTR
private AdvertCtrStatDto appChStat;// 广告媒体维度,首次投放,当小时 CTR
private AdvertCtrStatDto appR2hStat;// 广告媒体维度,首次投放,近2小时CTR
public String getKey() {return key;}
public void setKey(String key) {this.key = key;}
public Long getAdvertId() {
return advertId;
}
public void setAdvertId(Long advertId) {
this.advertId = advertId;
}
public Long getMaterialId() {
return materialId;
}
public void setMaterialId(Long materialId) {
this.materialId = materialId;
}
public Long getAppId() {
return appId;
}
public void setAppId(Long appId) {
this.appId = appId;
}
public AdvertCtrStatDto getAppCdStat() {
return appCdStat;
}
public void setAppCdStat(AdvertCtrStatDto appCdStat) {
this.appCdStat = appCdStat;
}
public AdvertCtrStatDto getAppR2dStat() {
return appR2dStat;
}
public void setAppR2dStat(AdvertCtrStatDto appR2dStat) {
this.appR2dStat = appR2dStat;
}
public AdvertCtrStatDto getAppR7dStat() {
return appR7dStat;
}
public void setAppR7dStat(AdvertCtrStatDto appR7dStat) {
this.appR7dStat = appR7dStat;
}
public AdvertCtrStatDto getAppChStat() {
return appChStat;
}
public void setAppChStat(AdvertCtrStatDto appChStat) {
this.appChStat = appChStat;
}
public AdvertCtrStatDto getAppR2hStat() {
return appR2hStat;
}
public void setAppR2hStat(AdvertCtrStatDto appR2hStat) {
this.appR2hStat = appR2hStat;
}
}
package cn.com.duiba.nezha.compute.api.dto;
import java.io.Serializable;
/**
* Created by pc on 2016/11/16.
*/
public class AdvertCtrStatDto implements Serializable {
private static final long serialVersionUID = -316102112618444133L;
private String id;
private String advertId;
private String materialId;
private Long launchCnt;
private Long chargeCnt;
private Long actExpCnt;
private Long actClickCnt;
private Double ctr;
private Double cvr;
private Long chargeFees;
private String time;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getAdvertId() {
return advertId;
}
public void setAdvertId(String advertId) {
this.advertId = advertId;
}
public String getMaterialId() {
return materialId;
}
public void setMaterialId(String materialId) {
this.materialId = materialId;
}
public Long getLaunchCnt() {
return launchCnt;
}
public void setLaunchCnt(Long launchCnt) {
this.launchCnt = launchCnt;
}
public Long getChargeCnt() {
return chargeCnt;
}
public void setChargeCnt(Long chargeCnt) {
this.chargeCnt = chargeCnt;
}
public Long getActClickCnt() {
return actClickCnt;
}
public void setActClickCnt(Long actClickCnt) {
this.actClickCnt = actClickCnt;
}
public Long getActExpCnt() {
return actExpCnt;
}
public void setActExpCnt(Long actExpCnt) {
this.actExpCnt = actExpCnt;
}
public Double getCtr() {
return ctr;
}
public void setCtr(Double ctr) {
this.ctr = ctr;
}
public Double getCvr() {
return cvr;
}
public void setCvr(Double cvr) {
this.cvr = cvr;
}
public Long getChargeFees() {
return chargeFees;
}
public void setChargeFees(Long chargeFees) {
this.chargeFees = chargeFees;
}
public String getTime() {
return time;
}
public void setTime(String time) {
this.time = time;
}
}
package cn.com.duiba.nezha.compute.api.dto;
import java.io.Serializable;
/**
* Created by pc on 2016/11/16.
*/
public class AdvertMergeStatDto implements Serializable {
private static final long serialVersionUID = -316102112618444139L;
private String id;
private Long advertId;
private Long materialId;
private Long launchCnt;
private Long chargeCnt;
private Long actExpCnt;
private Long actClickCnt;
private Double mergeCtr;
private Double mergeCvr;
private String time;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public Long getAdvertId() {
return advertId;
}
public void setAdvertId(Long advertId) {
this.advertId = advertId;
}
public Long getMaterialId() {
return materialId;
}
public void setMaterialId(Long materialId) {
this.materialId = materialId;
}
public Long getLaunchCnt() {
return launchCnt;
}
public void setLaunchCnt(Long launchCnt) {
this.launchCnt = launchCnt;
}
public Long getChargeCnt() {
return chargeCnt;
}
public void setChargeCnt(Long chargeCnt) {
this.chargeCnt = chargeCnt;
}
public Long getActClickCnt() {
return actClickCnt;
}
public void setActClickCnt(Long actClickCnt) {
this.actClickCnt = actClickCnt;
}
public Long getActExpCnt() {
return actExpCnt;
}
public void setActExpCnt(Long actExpCnt) {
this.actExpCnt = actExpCnt;
}
public Double getMergeCtr() {
return mergeCtr;
}
public void setMergeCtr(Double mergeCtr) {
this.mergeCtr = mergeCtr;
}
public Double getMergeCvr() {
return mergeCvr;
}
public void setMergeCvr(Double mergeCvr) {
this.mergeCvr = mergeCvr;
}
public String getTime() {
return time;
}
public void setTime(String time) {
this.time = time;
}
}
package cn.com.duiba.nezha.compute.api.dto;
import java.io.Serializable;
/**
* Created by xuezhaoming on 16/8/2.
*/
public class AdvertModelEntity implements Serializable {
private static final long serialVersionUID = -316102112618444133L;
private int serializerId;
private String modelKey; // 模型key
private String dt; // 日期 yyyyMMdd
private String featureIdxListStr; // 特征索引列表序列化字符串
private String featureCollectListStr; // 特征索引列表序列化字符串
private String featureDictStr; // 特征索引字典序列化字符串
private String modelStr; // 模型序列化字符串
public int getSerializerId() { return serializerId; }
public void setSerializerId(int serializerId) { this.serializerId = serializerId; }
public String getModelKey() { return modelKey; }
public void setModelKey(String modelKey) { this.modelKey = modelKey; }
public String getDt() { return dt; }
public void setDt(String dt) { this.dt = dt; }
public String getFeatureIdxListStr() { return featureIdxListStr; }
public void setFeatureIdxListStr(String featureIdxListStr) { this.featureIdxListStr = featureIdxListStr; }
public String getFeatureCollectListStr() { return featureCollectListStr; }
public void setFeatureCollectListStr(String featureCollectListStr) { this.featureCollectListStr = featureCollectListStr; }
public String getFeatureDictStr() { return featureDictStr; }
public void setFeatureDictStr(String featureDictStr) { this.featureDictStr = featureDictStr; }
public String getModelStr() { return modelStr; }
public void setModelStr(String modelStr) { this.modelStr = modelStr; }
}
package cn.com.duiba.nezha.compute.api.dto;
import java.io.Serializable;
/**
* Created by pc on 2016/11/16.
*/
public class AdvertRStatDto implements Serializable {
private static final long serialVersionUID = -316102112618444133L;
private String advertId;
private Boolean isNewAdvert;
private Long launchCnt;
private Long exposureCnt;
private Long clickCnt;
private Long chargeCnt;
private Long actExpCnt;
private Long actClickCnt;
private Double cvr;
private Double ctr;
public String getAdvertId() {
return advertId;
}
public void setAdvertId(String advertId) {
this.advertId = advertId;
}
public Boolean getIsNewAdvert() {
return isNewAdvert;
}
public void setIsNewAdvert(Boolean isNewAdvert) {
this.isNewAdvert = isNewAdvert;
}
public Long getLaunchCnt() {
return launchCnt;
}
public void setLaunchCnt(Long launchCnt) {
this.launchCnt = launchCnt;
}
public Long getExposureCnt() {
return exposureCnt;
}
public void setExposureCnt(Long exposureCnt) {
this.exposureCnt = exposureCnt;
}
public Long getClickCnt() {
return clickCnt;
}
public void setClickCnt(Long clickCnt) {
this.clickCnt = clickCnt;
}
public Long getChargeCnt() {
return chargeCnt;
}
public void setChargeCnt(Long chargeCnt) {
this.chargeCnt = chargeCnt;
}
public Double getCtr() {
return ctr;
}
public void setCtr(Double ctr) {
this.ctr = ctr;
}
public Long getActClickCnt() {
return actClickCnt;
}
public void setActClickCnt(Long actClickCnt) {
this.actClickCnt = actClickCnt;
}
public Long getActExpCnt() {
return actExpCnt;
}
public void setActExpCnt(Long actExpCnt) {
this.actExpCnt = actExpCnt;
}
public Double getCvr() {
return cvr;
}
public void setCvr(Double cvr) {
this.cvr = cvr;
}
}
package cn.com.duiba.nezha.compute.api.dto;
import java.io.Serializable;
/**
* Created by pc on 2016/11/16.
*/
public class AdvertStatDto implements Serializable {
private static final long serialVersionUID = -316102112618444133L;
private String statKeyId;
private String advertId;
private String statDimId;
private String advertStatDimType;
private String advertType;
private String statIntervalId;
private Long launchCnt;
private Long exposureCnt;
private Long clickCnt;
private Long chargeCnt;
private Long actExpCnt;
private Long actClickCnt;
private Double cvr;
private Double ctr;
public String getStatKeyId() {
return statKeyId;
}
public void setStatKeyId(String statKeyId) {
this.statKeyId = statKeyId;
}
public String getAdvertId() {
return advertId;
}
public void setAdvertId(String advertId) {
this.advertId = advertId;
}
public String getStatDimId() {
return statDimId;
}
public void setStatDimId(String statDimID) {
this.statDimId = statDimID;
}
public String getAdvertType() {
return advertType;
}
public void setAdvertType(String advertType) {
this.advertType = advertType;
}
public String getAdvertStatDimType() {
return advertStatDimType;
}
public void setAdvertStatDimType(String advertStatDimType) {
this.advertStatDimType = advertStatDimType;
}
public String getStatIntervalId() {
return statIntervalId;
}
public void setStatIntervalId(String statIntervalId) {
this.statIntervalId = statIntervalId;
}
public Long getLaunchCnt() {
return launchCnt;
}
public void setLaunchCnt(Long launchCnt) {
this.launchCnt = launchCnt;
}
public Long getExposureCnt() {
return exposureCnt;
}
public void setExposureCnt(Long exposureCnt) {
this.exposureCnt = exposureCnt;
}
public Long getClickCnt() {
return clickCnt;
}
public void setClickCnt(Long clickCnt) {
this.clickCnt = clickCnt;
}
public Long getChargeCnt() {
return chargeCnt;
}
public void setChargeCnt(Long chargeCnt) {
this.chargeCnt = chargeCnt;
}
public Double getCtr() {
return ctr;
}
public void setCtr(Double ctr) {
this.ctr = ctr;
}
public Long getActClickCnt() {
return actClickCnt;
}
public void setActClickCnt(Long actClickCnt) {
this.actClickCnt = actClickCnt;
}
public Long getActExpCnt() {
return actExpCnt;
}
public void setActExpCnt(Long actExpCnt) {
this.actExpCnt = actExpCnt;
}
public Double getCvr() {
return cvr;
}
public void setCvr(Double cvr) {
this.cvr = cvr;
}
}
package cn.com.duiba.nezha.compute.api.dto;
import java.io.Serializable;
/**
* Created by pc on 2016/11/16.
*/
public class ConsumerDeviceFeatureDto implements Serializable {
// private static final long serialVersionUID = -316102112618444133L;
private String key;
private String deviceId;// 设备ID
private String consumerId;// 用户id
private Long age;// 年龄
private Long sex;// 性别
private String identifyId;// 用户id
private String osType;// 操作系统
private String osVersion;// 操作系统版本
private String vendor;// 设备厂商
private String model;// 设备型号
private String deviceType;// 设备类型(手机端,平板,PC)
private String screenSize;// 设备屏幕尺寸
private String serial;// Build.SERIAL
private String imei;// 设备IMEI号,15位数字
private String imsi;// 设备IMSI号,插入SIM卡时必填
private String androidId;// Android系统标识
private String idfa;// 设备idfa编号
private String idfv;// 设备idfv编号
private String mac;// 本机mac地址(ssid)
private String phone;// 手机号码
private String ipv4;// IPv4地址
private String connectionType;// 网络类型(2G,3G,4G)
private String operatorType;// 运营商(中国联通,中国移动,中国电信)
private String cellularId;// 基站ID
private String apMac;// 热点mac地址
private String rssi;// 热点信号强度
private String apName;// 热点名称
private String wifiType;// wifi类型
private String hotspotType;// 热点类型
private String country;// 国家
private String province;// 省
private String city;// 市
private String district;// 区
private String township;// 街道
public String getKey() {return key;}
public void setKey(String key) {this.key = key;}
public String getDeviceId() {return deviceId;}
public void setDeviceId(String deviceId) {this.deviceId = deviceId;}
public String getConsumerId() {return consumerId;}
public void setConsumerId(String consumerId) {this.consumerId = consumerId;}
public Long getAge() {return age;}
public void setAge(Long age) {this.age = age;}
public Long getSex() {return sex;}
public void setSex(Long sex) {this.sex = sex;}
public String getIdentifyId() {return identifyId;}
public void setIdentifyId(String identifyId) {this.identifyId = identifyId;}
public String getOsType() {return osType;}
public void setOsType(String osType) {this.osType = osType;}
public String getOsVersion() {return osVersion;}
public void setOsVersion(String osVersion) {this.osVersion = osVersion;}
public String getVendor() {return vendor;}
public void setVendor(String vendor) {this.vendor = vendor;}
public String getModel() {return model;}
public void setModel(String model) {this.model = model;}
public String getDeviceType() {return deviceType;}
public void setDeviceType(String deviceType) {this.deviceType = deviceType;}
public String getScreenSize() {return screenSize;}
public void setScreenSize(String screenSize) {this.screenSize = screenSize;}
public String getSerial() {return serial;}
public void setSerial(String serial) {this.serial = serial;}
public String getImei() {return imei;}
public void setImei(String imei) {this.imei = imei;}
public String getImsi() {return imsi;}
public void setImsi(String imsi) {this.imsi = imsi;}
public String getAndroidId() {return androidId;}
public void setAndroidId(String androidId) {this.androidId = androidId;}
public String getIdfa() {return idfa;}
public void setIdfa(String idfa) {this.idfa = idfa;}
public String getIdfv() {return idfv;}
public void setIdfv(String idfv) {this.idfv = idfv;}
public String getMac() {return mac;}
public void setMac(String mac) {this.mac = mac;}
public String getPhone() {return phone;}
public void setPhone(String phone) {this.phone = phone;}
public String getIpv4() {return ipv4;}
public void setIpv4(String ipv4) {this.ipv4 = ipv4;}
public String getConnectionType() {return connectionType;}
public void setConnectionType(String connectionType) {this.connectionType = connectionType;}
public String getOperatorType() {return operatorType;}
public void setOperatorType(String operatorType) {this.operatorType = operatorType;}
public String getCellularId() {return cellularId;}
public void setCellularId(String cellularId) {this.cellularId = cellularId;}
public String getApMac() {return apMac;}
public void setApMac(String apMac) {this.apMac = apMac;}
public String getRssi() {return rssi;}
public void setRssi(String rssi) {this.rssi = rssi;}
public String getApName() {return apName;}
public void setApName(String apName) {this.apName = apName;}
public String getWifiType() {return wifiType;}
public void setWifiType(String wifiType) {this.wifiType = wifiType;}
public String getHotspotType() {return hotspotType;}
public void setHotspotType(String hotspotType) {this.hotspotType = hotspotType;}
public String getCountry() {return country;}
public void setCountry(String country) {this.country = country;}
public String getProvince() {return province;}
public void setProvince(String province) {this.province = province;}
public String getCity() {return city;}
public void setCity(String city) {this.city = city;}
public String getDistrict() {return district;}
public void setDistrict(String district) {this.district = district;}
public String getTownship() {return township;}
public void setTownship(String township) {this.township = township;}
}
package cn.com.duiba.nezha.compute.api.dto;
import java.io.Serializable;
/**
* Created by pc on 2016/11/16.
*/
public class ConsumerOrderFeatureDto implements Serializable {
private static final long serialVersionUID = -316102112618444133L;
private String key;
private String consumerId; // rowkey p
private String orderRank;
private String dayOrderRank;
private String firstOrderTime;
private String lastOrderTime;
private String lastOrderId;
private String lastOrderChargeNums;
private String lastActivityId;
public String getKey() {return key;}
public void setKey(String key) {this.key = key;}
public String getConsumerId() {return consumerId;}
public void setConsumerId(String consumerId) {this.consumerId = consumerId;}
public String getOrderRank() {return orderRank;}
public void setOrderRank(String orderRank) {this.orderRank = orderRank;}
public String getDayOrderRank() {return dayOrderRank;}
public void setDayOrderRank(String dayOrderRank) {this.dayOrderRank = dayOrderRank;}
public String getFirstOrderTime() {return firstOrderTime;}
public void setFirstOrderTime(String firstOrderTime) {this.firstOrderTime = firstOrderTime;}
public String getLastOrderTime() {return lastOrderTime;}
public void setLastOrderTime(String lastOrderTime) {this.lastOrderTime = lastOrderTime;}
public String getLastOrderId() {return lastOrderId;}
public void setLastOrderId(String lastOrderId) {this.lastOrderId = lastOrderId;}
public String getLastOrderChargeNums() {return lastOrderChargeNums;}
public void setLastOrderChargeNums(String lastOrderChargeNums) {this.lastOrderChargeNums = lastOrderChargeNums;}
public String getLastActivityId() {return lastActivityId;}
public void setLastActivityId(String lastActivityId) {this.lastActivityId = lastActivityId;}
}
package cn.com.duiba.nezha.compute.api.dto;
import java.io.Serializable;
/**
* Created by pc on 2016/11/16.
*/
public class CorrectionInfo implements Serializable {
private static final long serialVersionUID = -316102112618444133L;
private Long advertId; //广告ID
private Long type; //1:CTR 2:CVR
private Double currentPreValue ; //模型预估值
private NezhaStatDto nezhaStatDto ; //预估值纠偏对象
private Double correctionFactor; //默认值 1.0
private Double reconstructionFactor; //默认值 1.0
public Long getAdvertId() {
return advertId;
}
public void setAdvertId(Long advertId) {
this.advertId = advertId;
}
public Long getType() {
return type;
}
public void setType(Long type) {
this.type = type;
}
public Double getCurrentPreValue() {
return currentPreValue;
}
public void setCurrentPreValue(Double currentPreValue) {
this.currentPreValue = currentPreValue;
}
public NezhaStatDto getNezhaStatDto() {
return nezhaStatDto;
}
public void setNezhaStatDto(NezhaStatDto nezhaStatDto) {
this.nezhaStatDto = nezhaStatDto;
}
public Double getCorrectionFactor() {
return correctionFactor;
}
public void setCorrectionFactor(Double correctionFactor) {
this.correctionFactor = correctionFactor;
}
public Double getReconstructionFactor() {
return reconstructionFactor;
}
public void setReconstructionFactor(Double reconstructionFactor) {
this.reconstructionFactor = reconstructionFactor;
}
}
package cn.com.duiba.nezha.compute.api.dto;
import java.io.Serializable;
/**
* Created by pc on 2016/11/16.
*/
public class FeatureIdxDto implements Serializable {
private static final long serialVersionUID = -316102112618444133L;
private String f101001; // MyStringUtil2.Long2String(cf.getAdvertId()))
private String f106001; // MyStringUtil2.Long2String(cf.getAccountId()));
private String f108001; // MyStringUtil2.Long2String(cf.getSlotId()));
private String f109001; // MyStringUtil2.Long2String(cf.getSlotType()));
private String f201001; // MyStringUtil2.Long2String(cf.getAppId()));
private String f202001; // cf.getAppCategory());
private String f301001; // MyStringUtil2.Long2String(cf.getOperatingActivityId()));
private String f302001; // MyStringUtil2.Long2String(cf.getDuibaActivityId()));
private String f303001; // MyStringUtil2.Long2String(cf.getDuibaActivityType()));
private String f501001; // cf.getUa());
private String f502001; // MyStringUtil2.Integer2String(hour));
private String f502002; // MyStringUtil2.Integer2String(weekDay));
private String f503001; // MyStringUtil2.Long2String(cf.getCityId()));
// rank 转level
private String f601001; // MyStringUtil2.Long2String(getDayRankLevel(cf.getDayOrderRank())));
private String f602001; // MyStringUtil2.Long2String(getRankLevel(cf.getOrderRank())));
private String f603001; // MyStringUtil2.Long2String(getDayRankLevel(cf.getDayActivityOrderRank())));
private String f604001; // MyStringUtil2.Long2String(getRankLevel(cf.getActivityOrderRank())));
private String f605001; // MyStringUtil2.Long2String(orderGmtIntervelLevel));
private String f606001; // MyStringUtil2.Long2String(activityOrderGmtIntervelLevel));
private String f607001; // MyStringUtil2.Long2String(activityLastChargeStatus));
private String f608001; // MyStringUtil2.Long2String(lastChargeStatus));
private String f609001; // MyStringUtil2.Long2String(activityChangeStatus));
// 交叉
private String cf101201; // app_id+advert_id
// 交叉
private String cf101301; // duiba_activity_id+advert_id
public String getF101001(){return f101001;}
public void setF101001(String f101001){this.f101001 = f101001;}
public String getF106001(){return f106001;}
public void setF106001(String f106001){this.f106001 = f106001;}
public String getF108001(){return f108001;}
public void setF108001(String f108001){this.f108001 = f108001;}
public String getF109001(){return f109001;}
public void setF109001(String f109001){this.f109001 = f109001;}
public String getF201001(){return f201001;}
public void setF201001(String f201001){this.f201001 = f201001;}
public String getF202001(){return f202001;}
public void setF202001(String f202001){this.f202001 = f202001;}
public String getF301001(){return f301001;}
public void setF301001(String f301001){this.f301001 = f301001;}
public String getF302001(){return f302001;}
public void setF302001(String f302001){this.f302001 = f302001;}
public String getF303001(){return f303001;}
public void setF303001(String f303001){this.f303001 = f303001;}
public String getF501001(){return f501001;}
public void setF501001(String f501001){this.f501001 = f501001;}
public String getF502001(){return f502001;}
public void setF502001(String f502001){this.f502001 = f502001;}
public String getF502002(){return f502002;}
public void setF502002(String f502002){this.f502002 = f502002;}
public String getF503001(){return f503001;}
public void setF503001(String f503001){this.f503001 = f503001;}
public String getF601001(){return f601001;}
public void setF601001(String f601001){this.f601001 = f601001;}
public String getF602001(){return f602001;}
public void setF602001(String f602001){this.f602001 = f602001;}
public String getF603001(){return f603001;}
public void setF603001(String f603001){this.f603001 = f603001;}
public String getF604001(){return f604001;}
public void setF604001(String f604001){this.f604001 = f604001;}
public String getF605001(){return f605001;}
public void setF605001(String f605001){this.f605001 = f605001;}
public String getF606001(){return f606001;}
public void setF606001(String f606001){this.f606001 = f606001;}
public String getF607001(){return f607001;}
public void setF607001(String f607001){this.f607001 = f607001;}
public String getF608001(){return f608001;}
public void setF608001(String f608001){this.f608001 = f608001;}
public String getF609001(){return f609001;}
public void setF609001(String f609001){this.f609001 = f609001;}
// 交叉
public String getCf101201(){return cf101201;}
public void setCf101201(String cf101201){this.cf101201 = cf101201;}
// 交叉
public String getCf101301(){return cf101301;}
public void setCf101301(String cf101301){this.cf101301 = cf101301;}
}
package cn.com.duiba.nezha.compute.api.dto;
import java.io.Serializable;
/**
* Created by pc on 2016/11/16.
*/
public class ModelPredStatDto implements Serializable {
private static final long serialVersionUID = -316102112618444133L;
private String algType;
private Long cpcCnt;
private Long ocpcCnt;
private Double preCtrs;
private Double preCvrs;
private Double avgPreCtr;
private Double avgPreCvr;
private String time;
public String getAlgType() {
return algType;
}
public void setAlgType(String algType) {
this.algType = algType;
}
public Long getCpcCnt() {
return cpcCnt;
}
public void setCpcCnt(Long cpcCnt) {
this.cpcCnt = cpcCnt;
}
public Long getOcpcCnt() {
return ocpcCnt;
}
public void setOcpcCnt(Long ocpcCnt) {
this.ocpcCnt = ocpcCnt;
}
public Double getPreCtrs() {
return preCtrs;
}
public void setPreCtrs(Double preCtrs) {
this.preCtrs = preCtrs;
}
public Double getPreCvrs() {
return preCvrs;
}
public void setPreCvrs(Double preCvrs) {
this.preCvrs = preCvrs;
}
public Double getAvgPreCtr() {
return avgPreCtr;
}
public void setAvgPreCtr(Double avgPreCtr) {
this.avgPreCtr = avgPreCtr;
}
public Double getAvgPreCvr() {
return avgPreCvr;
}
public void setAvgPreCvr(Double avgPreCvr) {
this.avgPreCvr = avgPreCvr;
}
public String getTime() {
return time;
}
public void setTime(String time) {
this.time = time;
}
}
package cn.com.duiba.nezha.compute.api.dto;
import java.io.Serializable;
/**
* Created by pc on 2016/11/16.
*/
public class NezhaStatDto implements Serializable {
private static final long serialVersionUID = -316102112618444133L;
private String id;
private Long algType;
private Long advertId;
private Long appId;
private Long ctrLaunchCnt;
private Long cvrLaunchCnt;
private Double preCtrAcc;
private Double preCvrAcc;
private Double preCtrAvg;
private Double preCvrAvg;
private Double statCtrAcc;
private Double statCvrAcc;
private Double statCtrAvg;
private Double statCvrAvg;
private String time;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public Long getAlgType() {
return algType;
}
public void setAlgType(Long algType) {
this.algType = algType;
}
public Long getAdvertId() {
return advertId;
}
public void setAdvertId(Long advertId) {
this.advertId = advertId;
}
public Long getAppId() {
return appId;
}
public void setAppId(Long appId) {
this.appId = appId;
}
public Long getCtrLaunchCnt() {
return ctrLaunchCnt;
}
public void setCtrLaunchCnt(Long ctrLaunchCnt) {
this.ctrLaunchCnt = ctrLaunchCnt;
}
public Long getCvrLaunchCnt() {
return cvrLaunchCnt;
}
public void setCvrLaunchCnt(Long cvrLaunchCnt) {
this.cvrLaunchCnt = cvrLaunchCnt;
}
public Double getPreCtrAcc() {
return preCtrAcc;
}
public void setPreCtrAcc(Double preCtrAcc) {
this.preCtrAcc = preCtrAcc;
}
public Double getPreCvrAcc() {
return preCvrAcc;
}
public void setPreCvrAcc(Double preCvrAcc) {
this.preCvrAcc = preCvrAcc;
}
public Double getPreCtrAvg() {
return preCtrAvg;
}
public void setPreCtrAvg(Double preCtrAvg) {
this.preCtrAvg = preCtrAvg;
}
public Double getPreCvrAvg() {
return preCvrAvg;
}
public void setPreCvrAvg(Double preCvrAvg) {
this.preCvrAvg = preCvrAvg;
}
public Double getStatCtrAcc() {
return statCtrAcc;
}
public void setStatCtrAcc(Double statCtrAcc) {
this.statCtrAcc = statCtrAcc;
}
public Double getStatCvrAcc() {
return statCvrAcc;
}
public void setStatCvrAcc(Double statCvrAcc) {
this.statCvrAcc = statCvrAcc;
}
public Double getStatCtrAvg() {
return statCtrAvg;
}
public void setStatCtrAvg(Double statCtrAvg) {
this.statCtrAvg = statCtrAvg;
}
public Double getStatCvrAvg() {
return statCvrAvg;
}
public void setStatCvrAvg(Double statCvrAvg) {
this.statCvrAvg = statCvrAvg;
}
}
package cn.com.duiba.nezha.compute.api.dto;
import cn.com.duiba.nezha.compute.api.enums.StatIntervalTypeEnum;
import java.io.Serializable;
/**
* Created by pc on 2016/11/16.
*/
public class NezhaStatMergeDto implements Serializable {
private static final long serialVersionUID = -316102112618444133L;
private String key;
private Long algType;
private Long appId;
private Long advertId;
private Double mergePreCtr;
private Double mergePreCvr;
private Double mergeStatCtr;
private Double mergeStatCvr;
private NezhaStatDto chNezhaStatDto;
private NezhaStatDto r1hNezhaStatDto;
private NezhaStatDto cdNezhaStatDto;
private NezhaStatDto r1dNezhaStatDto;
private NezhaStatDto r2dNezhaStatDto;
public String getKey() {return key;}
public void setKey(String key) {this.key = key;}
public Long getAlgType() {
return algType;
}
public void setAlgType(Long algType) {
this.algType = algType;
}
public Long getAdvertId() {
return advertId;
}
public void setAdvertId(Long advertId) {
this.advertId = advertId;
}
public Long getAppId() {
return appId;
}
public void setAppId(Long appId) {
this.appId = appId;
}
public NezhaStatDto getChNezhaStatDto() {
return chNezhaStatDto;
}
public void setChNezhaStatDto(NezhaStatDto chNezhaStatDto) {
this.chNezhaStatDto = chNezhaStatDto;
}
public NezhaStatDto getR1hNezhaStatDto() {
return r1hNezhaStatDto;
}
public void setR1hNezhaStatDto(NezhaStatDto r1hNezhaStatDto) {
this.r1hNezhaStatDto = r1hNezhaStatDto;
}
public NezhaStatDto getR1dNezhaStatDto() {
return r1dNezhaStatDto;
}
public void setR1dNezhaStatDto(NezhaStatDto r1dNezhaStatDto) {
this.r1dNezhaStatDto = r1dNezhaStatDto;
}
public NezhaStatDto getCdNezhaStatDto() {
return cdNezhaStatDto;
}
public void setCdNezhaStatDto(NezhaStatDto cdNezhaStatDto) {
this.cdNezhaStatDto = cdNezhaStatDto;
}
public NezhaStatDto getR2dNezhaStatDto() {
return r2dNezhaStatDto;
}
public void setR2dNezhaStatDto(NezhaStatDto r2dNezhaStatDto) {
this.r2dNezhaStatDto = r2dNezhaStatDto;
}
public Double getMergePreCtr() {
return mergePreCtr;
}
public void setMergePreCtr(Double mergePreCtr) {
this.mergePreCtr = mergePreCtr;
}
public Double getMergePreCvr() {
return mergePreCvr;
}
public void setMergePreCvr(Double mergePreCvr) {
this.mergePreCvr = mergePreCvr;
}
public Double getMergeStatCtr() {
return mergeStatCtr;
}
public void setMergeStatCtr(Double mergeStatCtr) {
this.mergeStatCtr = mergeStatCtr;
}
public Double getMergeStatCvr() {
return mergeStatCvr;
}
public void setMergeStatCvr(Double mergeStatCvr) {
this.mergeStatCvr = mergeStatCvr;
}
}
package cn.com.duiba.nezha.compute.api.enums;
/**
* Created by xuezhaoming on 16/8/2.
*/
public enum AdvertStatDimTypeEnum {
GLOBAL(1, "1"),//"全局"
APP(2, "2"), //"媒体"
ACTIVITY(3, "3"), //"活动"
;
private int index;
private String desc;
AdvertStatDimTypeEnum(int index, String desc) {
this.index = index;
this.desc = desc;
}
public int getIndex() {
return index;
}
public String getDesc() {
return desc;
}
}
package cn.com.duiba.nezha.compute.api.enums;
/**
* Created by xuezhaoming on 16/8/2.
*/
public enum FeatureIdxEnum {
FEATURE_IDX_001("001", "opt"),// 参数优化
FEATURE_IDX_MAP_001("001", "opt"),// 参数优化
;
private String index;
private String desc;
FeatureIdxEnum(String index, String desc) {
this.index = index;
this.desc = desc;
}
public String getIndex() {
return index;
}
public String getDesc() {
return desc;
}
}
package cn.com.duiba.nezha.compute.api.enums;
/**
* Created by xuezhaoming on 16/8/2.
*/
public enum PredRectifierEnum {
COR(0, "Correction"),
REC(1, "Reconstruction"),
;
private int index;
private String desc;
PredRectifierEnum(int index, String desc) {
this.index = index;
this.desc = desc;
}
public int getIndex() {
return index;
}
public String getDesc() {
return desc;
}
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment