Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
F
ffm-baseline
Project
Project
Details
Activity
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ML
ffm-baseline
Commits
c75aab33
Commit
c75aab33
authored
Aug 07, 2018
by
张彦钊
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改auc计算参数
parent
83b62060
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
20 deletions
+17
-20
aucCaculate.py
aucCaculate.py
+4
-2
testCases.py
local/testCases.py
+9
-18
processData.py
processData.py
+4
-0
No files found.
aucCaculate.py
View file @
c75aab33
...
@@ -3,7 +3,9 @@ import pandas as pd
...
@@ -3,7 +3,9 @@ import pandas as pd
from
config
import
*
from
config
import
*
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
test
=
pd
.
read_csv
(
DIRECTORY_PATH
+
"test
.csv"
,
header
=
None
)
test
=
pd
.
read_csv
(
DIRECTORY_PATH
+
"test
{0}.csv"
.
format
(
TEST_DATE
)
,
header
=
None
)
test_label
=
test
[
0
]
.
apply
(
lambda
x
:
x
[
0
])
.
values
test_label
=
test
[
0
]
.
apply
(
lambda
x
:
x
[
0
])
.
values
predict
=
pd
.
read_csv
(
DIRECTORY_PATH
+
"output.txt"
,
header
=
None
)[
0
]
.
values
predict
=
pd
.
read_csv
(
DIRECTORY_PATH
+
"testset{0}_output_model_{1}-{2}_lr{3}_lambda{4}.txt"
.
format
(
TEST_DATE
,
DATA_START_DATE
,
DATA_END_DATE
,
"0.03"
,
"0.002"
),
header
=
None
)[
0
]
.
values
get_roc_curve
(
test_label
,
predict
,
"1"
)
get_roc_curve
(
test_label
,
predict
,
"1"
)
local/testCases.py
View file @
c75aab33
...
@@ -3,28 +3,19 @@ import datetime
...
@@ -3,28 +3,19 @@ import datetime
import
pickle
import
pickle
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
data
=
pd
.
read_csv
(
"../data/test-data/raw-exposure.csv"
)[[
"cid"
,
"device_id"
]]
data
=
pd
.
read_csv
(
"../data/test-data/raw-exposure.csv"
)[[
"cid"
,
"device_id"
]]
data
[
"y"
]
=
1
data
[
"y"
]
=
1
test_data
=
data
.
tail
(
5
)
test_data
=
data
.
tail
(
5
)
ffm
=
FFMFormatPandas
()
ffm
=
FFMFormatPandas
()
data
=
ffm
.
fit_transform
(
data
,
y
=
'y'
)
data
=
ffm
.
fit_transform
(
data
,
y
=
'y'
)
data
.
to_csv
(
"ffm_data.csv"
,
index
=
False
)
data
.
to_csv
(
"ffm_data.csv"
,
index
=
False
)
with
open
(
"ffm.object"
,
"wb"
)
as
f
:
pickle
.
dump
(
ffm
,
f
)
with
open
(
"ffm.object"
,
"wb"
)
as
f
:
with
open
(
"ffm.object"
,
"rb"
)
as
f
:
pickle
.
dump
(
ffm
,
f
)
with
open
(
"ffm.object"
,
"rb"
)
as
f
:
ffm
=
pickle
.
load
(
f
)
ffm
=
pickle
.
load
(
f
)
result
=
ffm
.
transform
(
test_data
)
result
=
ffm
.
transform
(
test_data
)
print
(
result
)
print
(
result
)
data_1
=
pd
.
read_csv
(
"ffm_data.csv"
,
header
=
None
)
.
tail
(
5
)
data_1
=
pd
.
read_csv
(
"ffm_data.csv"
,
header
=
None
)
.
tail
(
5
)
print
(
data_1
)
print
(
data_1
)
processData.py
View file @
c75aab33
...
@@ -3,6 +3,7 @@ from prepareData import fetch_data
...
@@ -3,6 +3,7 @@ from prepareData import fetch_data
from
utils
import
FFMFormatPandas
from
utils
import
FFMFormatPandas
import
pandas
as
pd
import
pandas
as
pd
from
config
import
*
from
config
import
*
import
pickle
exposure
,
click
,
click_device_id
=
fetch_data
(
exposure
,
click
,
click_device_id
=
fetch_data
(
start_date
=
DATA_START_DATE
,
end_date
=
DATA_END_DATE
)
start_date
=
DATA_START_DATE
,
end_date
=
DATA_END_DATE
)
...
@@ -53,6 +54,9 @@ print("Start ffm transform")
...
@@ -53,6 +54,9 @@ print("Start ffm transform")
start
=
time
.
time
()
start
=
time
.
time
()
ffm_train
=
FFMFormatPandas
()
ffm_train
=
FFMFormatPandas
()
data
=
ffm_train
.
fit_transform
(
data
,
y
=
'y'
)
data
=
ffm_train
.
fit_transform
(
data
,
y
=
'y'
)
with
open
(
DIRECTORY_PATH
+
"ffm_{0}_{1}.pkl"
.
format
(
DATA_START_DATE
,
DATA_END_DATE
),
"wb"
)
as
f
:
pickle
.
dump
(
ffm_train
,
f
)
print
(
"done transform ffm"
)
print
(
"done transform ffm"
)
end
=
time
.
time
()
end
=
time
.
time
()
print
(
"ffm转化数据耗时:"
)
print
(
"ffm转化数据耗时:"
)
...
...
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