Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nezha-compute-mengxiangxuan
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mengxiangxuan
nezha-compute-mengxiangxuan
Commits
6246cd5f
Commit
6246cd5f
authored
Jul 25, 2018
by
mxx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
,,,
parent
12aa1d92
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
388 additions
and
15 deletions
+388
-15
BlackInfo.java
...om/duiba/nezha/compute/common/model/pacing/BlackInfo.java
+30
-0
OrientInfo.java
...m/duiba/nezha/compute/common/model/pacing/OrientInfo.java
+100
-0
OrientResultInfo.java
...a/nezha/compute/common/model/pacing/OrientResultInfo.java
+30
-0
SlotRecommender.java
...ba/nezha/compute/common/model/pacing/SlotRecommender.java
+77
-0
SlotFeedBack.java
...gnosis/src/main/java/blackwhitenamelist/SlotFeedBack.java
+39
-0
SlotFeedBackInfo.java
...is/src/main/java/blackwhitenamelist/SlotFeedBackInfo.java
+80
-0
Test.java
...auto-diagnosis/src/main/java/blackwhitenamelist/Test.java
+32
-15
No files found.
nezha-compute-common/src/main/java/cn/com/duiba/nezha/compute/common/model/pacing/BlackInfo.java
0 → 100644
View file @
6246cd5f
package
cn
.
com
.
duiba
.
nezha
.
compute
.
common
.
model
.
pacing
;
public
class
BlackInfo
{
Long
advertId
;
Long
orientId
;
public
BlackInfo
()
{
}
public
BlackInfo
(
Long
advertId
,
Long
orientId
)
{
this
.
advertId
=
advertId
;
this
.
orientId
=
orientId
;
}
public
Long
getAdvertId
()
{
return
advertId
;
}
public
void
setAdvertId
(
Long
advertId
)
{
this
.
advertId
=
advertId
;
}
public
Long
getOrientId
()
{
return
orientId
;
}
public
void
setOrientId
(
Long
orientId
)
{
this
.
orientId
=
orientId
;
}
}
nezha-compute-common/src/main/java/cn/com/duiba/nezha/compute/common/model/pacing/OrientInfo.java
0 → 100644
View file @
6246cd5f
package
cn
.
com
.
duiba
.
nezha
.
compute
.
common
.
model
.
pacing
;
public
class
OrientInfo
{
Long
advertId
;
Long
orientId
;
boolean
isManagered
;
//是否为托管配置
Integer
chargeType
;
//计费方式
Long
target
;
//目标成本
Long
fee
;
//出价
Double
cvr
;
Double
confidence
;
//置信度
Double
bias
;
//偏差
public
OrientInfo
()
{
}
public
OrientInfo
(
Long
advertId
,
Long
orientId
,
boolean
isManagered
,
Integer
chargeType
,
Long
target
,
Long
fee
,
Double
cvr
,
Double
confidence
,
Double
bias
)
{
this
.
advertId
=
advertId
;
this
.
orientId
=
orientId
;
this
.
isManagered
=
isManagered
;
this
.
chargeType
=
chargeType
;
this
.
target
=
target
;
this
.
fee
=
fee
;
this
.
cvr
=
cvr
;
this
.
confidence
=
confidence
;
this
.
bias
=
bias
;
}
public
Long
getAdvertId
()
{
return
advertId
;
}
public
void
setAdvertId
(
Long
advertId
)
{
this
.
advertId
=
advertId
;
}
public
Long
getOrientId
()
{
return
orientId
;
}
public
void
setOrientId
(
Long
orientId
)
{
this
.
orientId
=
orientId
;
}
public
boolean
isManagered
()
{
return
isManagered
;
}
public
void
setManagered
(
boolean
managered
)
{
isManagered
=
managered
;
}
public
Integer
getChargeType
()
{
return
chargeType
;
}
public
void
setChargeType
(
Integer
chargeType
)
{
this
.
chargeType
=
chargeType
;
}
public
Long
getTarget
()
{
return
target
;
}
public
void
setTarget
(
Long
target
)
{
this
.
target
=
target
;
}
public
Long
getFee
()
{
return
fee
;
}
public
void
setFee
(
Long
fee
)
{
this
.
fee
=
fee
;
}
public
Double
getCvr
()
{
return
cvr
;
}
public
void
setCvr
(
Double
cvr
)
{
this
.
cvr
=
cvr
;
}
public
Double
getConfidence
()
{
return
confidence
;
}
public
void
setConfidence
(
Double
confidence
)
{
this
.
confidence
=
confidence
;
}
public
Double
getBias
()
{
return
bias
;
}
public
void
setBias
(
Double
bias
)
{
this
.
bias
=
bias
;
}
}
nezha-compute-common/src/main/java/cn/com/duiba/nezha/compute/common/model/pacing/OrientResultInfo.java
0 → 100644
View file @
6246cd5f
package
cn
.
com
.
duiba
.
nezha
.
compute
.
common
.
model
.
pacing
;
public
class
OrientResultInfo
{
Long
advertId
;
Long
orientId
;
public
OrientResultInfo
()
{
}
public
OrientResultInfo
(
Long
advertId
,
Long
orientId
)
{
this
.
advertId
=
advertId
;
this
.
orientId
=
orientId
;
}
public
Long
getAdvertId
()
{
return
advertId
;
}
public
void
setAdvertId
(
Long
advertId
)
{
this
.
advertId
=
advertId
;
}
public
Long
getOrientId
()
{
return
orientId
;
}
public
void
setOrientId
(
Long
orientId
)
{
this
.
orientId
=
orientId
;
}
}
nezha-compute-common/src/main/java/cn/com/duiba/nezha/compute/common/model/pacing/SlotRecommender.java
0 → 100644
View file @
6246cd5f
package
cn
.
com
.
duiba
.
nezha
.
compute
.
common
.
model
.
pacing
;
import
java.util.*
;
public
class
SlotRecommender
{
public
static
List
<
OrientResultInfo
>
recommend
(
List
<
OrientInfo
>
orientlist
,
List
<
BlackInfo
>
blacklist
)
{
Set
<
List
<
Long
>>
OrientSet
=
new
HashSet
<
List
<
Long
>>();
for
(
OrientInfo
orient:
orientlist
)
{
boolean
isManagered
=
orient
.
isManagered
;
//是否为托管配置
Integer
chargeType
=
orient
.
chargeType
;
//计费方式
Long
target
=
orient
.
target
;
//目标成本
Long
fee
=
orient
.
fee
;
//出价
Double
cvr
=
orient
.
cvr
;
Double
confidence
=
orient
.
confidence
;
//置信度
Double
bias
=
orient
.
bias
;
Random
r
=
new
Random
();
Double
x
=
r
.
nextDouble
();
Double
p_convert_cost
=
fee
/
cvr
;
List
<
Long
>
OrientInfoList
=
new
ArrayList
<
Long
>();
OrientInfoList
.
add
(
orient
.
advertId
);
OrientInfoList
.
add
(
orient
.
orientId
);
//////////ocpc
if
(
isManagered
&&
chargeType
==
1
)
{
//剔除有发券的预估偏差较高定向
if
(
bias
<
3
&&
confidence
>
0
)
{
OrientSet
.
add
(
OrientInfoList
);
// 无发券,使用行业-广告位或广告维度偏差<2,定向几率0.8 (这里的偏差=0,代表空值)
}
else
if
(
bias
<
2
&&
bias
!=
0
&&
confidence
==
0
&&
x
>
0.2
)
{
OrientSet
.
add
(
OrientInfoList
);
//无发券,使用行业-广告位或广告维度偏差>2,定向几率0.2
}
else
if
(
bias
>=
2
&&
bias
!=
0
&&
confidence
==
0
&&
x
>
0.8
)
{
OrientSet
.
add
(
OrientInfoList
);
//无发券,偏差为空,定向几率0.5
}
else
{
if
(
x
>
0.5
)
{
OrientSet
.
add
(
OrientInfoList
);}
}
}
////////cpc
else
if
(
isManagered
&&
chargeType
==
0
)
{
if
(
confidence
>
0
&&
p_convert_cost
<
2
*
target
)
{
OrientSet
.
add
(
OrientInfoList
);}
if
(
confidence
==
0
&&
bias
!=
0
&&
p_convert_cost
<
0.8
*
target
)
{
OrientSet
.
add
(
OrientInfoList
);}
if
(
confidence
==
0
&&
bias
==
0
&&
p_convert_cost
<
0.7
*
target
)
{
OrientSet
.
add
(
OrientInfoList
);}
}
}
Set
<
List
<
Long
>>
BlackSet
=
new
HashSet
<
List
<
Long
>>();
for
(
BlackInfo
black:
blacklist
){
List
<
Long
>
BlackInfoList
=
new
ArrayList
<
Long
>();
BlackInfoList
.
add
(
black
.
advertId
);
BlackInfoList
.
add
(
black
.
orientId
);
BlackSet
.
add
(
BlackInfoList
);
}
//剔除黑名单
OrientSet
.
removeAll
(
BlackSet
);
List
<
OrientResultInfo
>
orientResultList
=
new
ArrayList
<
OrientResultInfo
>();
for
(
List
<
Long
>
resultList:
OrientSet
){
OrientResultInfo
orientResultInfo
=
new
OrientResultInfo
(
resultList
.
get
(
0
),
resultList
.
get
(
1
));
orientResultList
.
add
(
orientResultInfo
);
}
return
orientResultList
;
}
}
tuia-auto-diagnosis/src/main/java/blackwhitenamelist/SlotFeedBack.java
0 → 100644
View file @
6246cd5f
package
blackwhitenamelist
;
import
java.util.*
;
public
class
SlotFeedBack
{
public
static
Map
<
String
,
String
>
slotFeedBack
(
List
<
SlotFeedBackInfo
>
infoList
)
{
Map
<
String
,
String
>
blackMap
=
new
HashMap
<
String
,
String
>();
for
(
int
i
=
0
;
i
<
infoList
.
size
();
i
++)
{
//System.out.println(infoList.get(i));
SlotFeedBackInfo
SlotFeedBackInfo
=
infoList
.
get
(
i
);
String
slotId
=
SlotFeedBackInfo
.
slotId
;
String
advertId
=
SlotFeedBackInfo
.
advertId
;
String
orientationId
=
SlotFeedBackInfo
.
orientationId
;
String
type
=
SlotFeedBackInfo
.
type
;
;
//type=hour:表示小时数据, day :表示1天粒度的指标数据
Long
cost
=
SlotFeedBackInfo
.
cost
;
//托管配置消耗
Long
convert
=
SlotFeedBackInfo
.
convert
;
//托管配置转化量
Float
targetCostConvert
=
SlotFeedBackInfo
.
targetCostConvert
;
//目标成本
Float
CostConvert
=
(
float
)
cost
/
convert
;
//实时成本
String
blackKey
=
"NZ_K77_"
+
SlotFeedBackInfo
.
slotId
+
"_"
+
SlotFeedBackInfo
.
advertId
+
"_"
+
SlotFeedBackInfo
.
orientationId
+
"_"
+
SlotFeedBackInfo
.
targetCostConvert
;
String
value
=
"True"
;
//NZ_K77_slotId_advertId_orientationId_targetCostConvert
if
(
type
.
equals
(
"day"
)
&&
convert
>
10
&&
CostConvert
>
2
*
targetCostConvert
)
{
blackMap
.
put
(
blackKey
,
value
);
}
else
if
(
type
.
equals
(
"day"
)
&&
convert
==
0
&&
cost
>
10000L
)
{
blackMap
.
put
(
blackKey
,
value
);
}
else
if
(
type
.
equals
(
"hour"
)
&&
convert
>
5
&&
CostConvert
>
2.5
*
targetCostConvert
)
{
blackMap
.
put
(
blackKey
,
value
);
}
else
if
(
type
.
equals
(
"hour"
)
&&
convert
==
0
&&
cost
>
5000L
)
{
blackMap
.
put
(
blackKey
,
value
);
}
}
return
blackMap
;
}
}
tuia-auto-diagnosis/src/main/java/blackwhitenamelist/SlotFeedBackInfo.java
0 → 100644
View file @
6246cd5f
package
blackwhitenamelist
;
public
class
SlotFeedBackInfo
{
String
slotId
;
String
advertId
;
String
orientationId
;
String
type
;
//type=hour:表示小时数据, day :表示1天粒度的指标数据
Long
cost
;
//托管配置消耗
Long
convert
;
//托管配置转化量
Float
targetCostConvert
;
//每个广告人工配置目标成本
public
SlotFeedBackInfo
()
{
}
public
SlotFeedBackInfo
(
String
slotId
,
String
advertId
,
String
orientationId
,
String
type
,
Long
cost
,
Long
convert
,
Float
targetCostConvert
)
{
this
.
slotId
=
slotId
;
this
.
advertId
=
advertId
;
this
.
orientationId
=
orientationId
;
this
.
type
=
type
;
this
.
cost
=
cost
;
this
.
convert
=
convert
;
this
.
targetCostConvert
=
targetCostConvert
;
}
public
String
getSlotId
()
{
return
slotId
;
}
public
void
setSlotId
(
String
slotId
)
{
this
.
slotId
=
slotId
;
}
public
String
getAdvertId
()
{
return
advertId
;
}
public
void
setAdvertId
(
String
advertId
)
{
this
.
advertId
=
advertId
;
}
public
String
getOrientationId
()
{
return
orientationId
;
}
public
void
setOrientationId
(
String
orientationId
)
{
this
.
orientationId
=
orientationId
;
}
public
String
getType
()
{
return
type
;
}
public
void
setType
(
String
type
)
{
this
.
type
=
type
;
}
public
Long
getCost
()
{
return
cost
;
}
public
void
setCost
(
Long
cost
)
{
this
.
cost
=
cost
;
}
public
Long
getConvert
()
{
return
convert
;
}
public
void
setConvert
(
Long
convert
)
{
this
.
convert
=
convert
;
}
public
Float
getTargetCostConvert
()
{
return
targetCostConvert
;
}
public
void
setTargetCostConvert
(
Float
targetCostConvert
)
{
this
.
targetCostConvert
=
targetCostConvert
;
}
}
tuia-auto-diagnosis/src/main/java/blackwhitenamelist/Test.java
View file @
6246cd5f
...
...
@@ -4,33 +4,50 @@ import java.util.ArrayList;
import
java.util.List
;
import
java.util.Map
;
public
class
Test
{
public
static
void
main
(
String
[]
args
)
{
CostConvertInfo
costConvertInfo1
=
new
CostConvertInfo
(
"44474"
,
"8675"
,
"7403"
,
"0"
,
"31320"
,
"hour"
,
"2"
,
0
,
1020L
,
0L
,
37L
,
69.37984
F
// CostConvertInfo costConvertInfo1= new CostConvertInfo(
// "44474", "8675", "7403", "0", "31320",
// "hour", "2",0, 1020L, 0L,
// 37L,69.37984F
// );
//
// CostConvertInfo costConvertInfo2= new CostConvertInfo(
// "11111", "22222", "5255", "27192", "30886",
// "day", "2",1, 2680L, 0L,
// 88888L,1677.3059F
// );
//
//
// List infoList = new ArrayList();
// infoList.add(costConvertInfo1);
// infoList.add(costConvertInfo2);
SlotFeedBackInfo
SlotFeedBackInfo1
=
new
SlotFeedBackInfo
(
"111"
,
"222"
,
"333"
,
"day"
,
34678L
,
12L
,
30
F
);
CostConvertInfo
costConvertInfo2
=
new
CostConvertInfo
(
"11111"
,
"22222"
,
"5255"
,
"27192"
,
"30886"
,
"day"
,
"2"
,
1
,
2680L
,
0L
,
88888L
,
1677.3059
F
SlotFeedBackInfo
SlotFeedBackInfo2
=
new
SlotFeedBackInfo
(
"666"
,
"888"
,
"999"
,
"day"
,
34678L
,
100L
,
200
F
);
SlotFeedBackInfo
SlotFeedBackInfo3
=
new
SlotFeedBackInfo
(
"11"
,
"22"
,
"33"
,
"hour"
,
99999L
,
0L
,
200
F
);
List
infoList
=
new
ArrayList
();
infoList
.
add
(
costConvertInfo1
);
infoList
.
add
(
costConvertInfo2
);
// infoList.add(costConvertInfo3);
// infoList.add(costConvertInfo4);
// infoList.add(costConvertInfo5);
List
infoList
=
new
ArrayList
();
infoList
.
add
(
SlotFeedBackInfo1
);
infoList
.
add
(
SlotFeedBackInfo2
);
infoList
.
add
(
SlotFeedBackInfo3
);
Map
<
String
,
String
>
label
=
BlackWhiteNameListRule
.
whiteBlackNameListRule
(
infoList
);
Map
<
String
,
String
>
label
=
SlotFeedBack
.
slotFeedBack
(
infoList
);
System
.
out
.
println
(
label
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment