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
ec0e0f7f
Commit
ec0e0f7f
authored
6 years ago
by
张彦钊
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change float to int
parent
38beeac6
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
24 deletions
+24
-24
test.py
tensnsorflow/test.py
+12
-12
train.py
tensnsorflow/train.py
+12
-12
No files found.
tensnsorflow/test.py
View file @
ec0e0f7f
...
@@ -29,18 +29,18 @@ def gen_tfrecords(in_file):
...
@@ -29,18 +29,18 @@ def gen_tfrecords(in_file):
for
i
in
range
(
df
.
shape
[
0
]):
for
i
in
range
(
df
.
shape
[
0
]):
features
=
tf
.
train
.
Features
(
feature
=
{
features
=
tf
.
train
.
Features
(
feature
=
{
"y"
:
tf
.
train
.
Feature
(
float_list
=
tf
.
train
.
Float
List
(
value
=
[
df
[
"y"
][
i
]])),
"y"
:
tf
.
train
.
Feature
(
int64_list
=
tf
.
train
.
Int64
List
(
value
=
[
df
[
"y"
][
i
]])),
"z"
:
tf
.
train
.
Feature
(
float_list
=
tf
.
train
.
Float
List
(
value
=
[
df
[
"z"
][
i
]])),
"z"
:
tf
.
train
.
Feature
(
int64_list
=
tf
.
train
.
Int64
List
(
value
=
[
df
[
"z"
][
i
]])),
"top"
:
tf
.
train
.
Feature
(
float_list
=
tf
.
train
.
Float
List
(
value
=
[
df
[
"top"
][
i
]])),
"top"
:
tf
.
train
.
Feature
(
int64_list
=
tf
.
train
.
Int64
List
(
value
=
[
df
[
"top"
][
i
]])),
"channel"
:
tf
.
train
.
Feature
(
float_list
=
tf
.
train
.
Float
List
(
value
=
[
df
[
"channel"
][
i
]])),
"channel"
:
tf
.
train
.
Feature
(
int64_list
=
tf
.
train
.
Int64
List
(
value
=
[
df
[
"channel"
][
i
]])),
"ucity_id"
:
tf
.
train
.
Feature
(
float_list
=
tf
.
train
.
Float
List
(
value
=
[
df
[
"ucity_id"
][
i
]])),
"ucity_id"
:
tf
.
train
.
Feature
(
int64_list
=
tf
.
train
.
Int64
List
(
value
=
[
df
[
"ucity_id"
][
i
]])),
"clevel1_id"
:
tf
.
train
.
Feature
(
float_list
=
tf
.
train
.
Float
List
(
value
=
[
df
[
"clevel1_id"
][
i
]])),
"clevel1_id"
:
tf
.
train
.
Feature
(
int64_list
=
tf
.
train
.
Int64
List
(
value
=
[
df
[
"clevel1_id"
][
i
]])),
"ccity_name"
:
tf
.
train
.
Feature
(
float_list
=
tf
.
train
.
Float
List
(
value
=
[
df
[
"ccity_name"
][
i
]])),
"ccity_name"
:
tf
.
train
.
Feature
(
int64_list
=
tf
.
train
.
Int64
List
(
value
=
[
df
[
"ccity_name"
][
i
]])),
"device_type"
:
tf
.
train
.
Feature
(
float_list
=
tf
.
train
.
Float
List
(
value
=
[
df
[
"device_type"
][
i
]])),
"device_type"
:
tf
.
train
.
Feature
(
int64_list
=
tf
.
train
.
Int64
List
(
value
=
[
df
[
"device_type"
][
i
]])),
"manufacturer"
:
tf
.
train
.
Feature
(
float_list
=
tf
.
train
.
Float
List
(
value
=
[
df
[
"manufacturer"
][
i
]])),
"manufacturer"
:
tf
.
train
.
Feature
(
int64_list
=
tf
.
train
.
Int64
List
(
value
=
[
df
[
"manufacturer"
][
i
]])),
"level2_ids"
:
tf
.
train
.
Feature
(
float_list
=
tf
.
train
.
Float
List
(
value
=
[
df
[
"level2_ids"
][
i
]])),
"level2_ids"
:
tf
.
train
.
Feature
(
int64_list
=
tf
.
train
.
Int64
List
(
value
=
[
df
[
"level2_ids"
][
i
]])),
"time"
:
tf
.
train
.
Feature
(
float_list
=
tf
.
train
.
Float
List
(
value
=
[
df
[
"time"
][
i
]])),
"time"
:
tf
.
train
.
Feature
(
int64_list
=
tf
.
train
.
Int64
List
(
value
=
[
df
[
"time"
][
i
]])),
"stat_date"
:
tf
.
train
.
Feature
(
float_list
=
tf
.
train
.
Float
List
(
value
=
[
df
[
"stat_date"
][
i
]]))
"stat_date"
:
tf
.
train
.
Feature
(
int64_list
=
tf
.
train
.
Int64
List
(
value
=
[
df
[
"stat_date"
][
i
]]))
})
})
example
=
tf
.
train
.
Example
(
features
=
features
)
example
=
tf
.
train
.
Example
(
features
=
features
)
...
...
This diff is collapsed.
Click to expand it.
tensnsorflow/train.py
View file @
ec0e0f7f
...
@@ -51,18 +51,18 @@ def input_fn(filenames, batch_size=32, num_epochs=1, perform_shuffle=False):
...
@@ -51,18 +51,18 @@ def input_fn(filenames, batch_size=32, num_epochs=1, perform_shuffle=False):
print
(
'Parsing'
,
filenames
)
print
(
'Parsing'
,
filenames
)
def
_parse_fn
(
record
):
def
_parse_fn
(
record
):
features
=
{
features
=
{
"y"
:
tf
.
FixedLenFeature
([],
tf
.
float32
),
"y"
:
tf
.
FixedLenFeature
([],
tf
.
int64
),
"z"
:
tf
.
FixedLenFeature
([],
tf
.
float32
),
"z"
:
tf
.
FixedLenFeature
([],
tf
.
int64
),
"top"
:
tf
.
FixedLenFeature
([],
tf
.
float32
),
"top"
:
tf
.
FixedLenFeature
([],
tf
.
int64
),
"channel"
:
tf
.
FixedLenFeature
([],
tf
.
float32
),
"channel"
:
tf
.
FixedLenFeature
([],
tf
.
int64
),
"ucity_id"
:
tf
.
FixedLenFeature
([],
tf
.
float32
),
"ucity_id"
:
tf
.
FixedLenFeature
([],
tf
.
int64
),
"clevel1_id"
:
tf
.
FixedLenFeature
([],
tf
.
float32
),
"clevel1_id"
:
tf
.
FixedLenFeature
([],
tf
.
int64
),
"ccity_name"
:
tf
.
FixedLenFeature
([],
tf
.
float32
),
"ccity_name"
:
tf
.
FixedLenFeature
([],
tf
.
int64
),
"device_type"
:
tf
.
FixedLenFeature
([],
tf
.
float32
),
"device_type"
:
tf
.
FixedLenFeature
([],
tf
.
int64
),
"manufacturer"
:
tf
.
FixedLenFeature
([],
tf
.
float32
),
"manufacturer"
:
tf
.
FixedLenFeature
([],
tf
.
int64
),
"level2_ids"
:
tf
.
FixedLenFeature
([],
tf
.
float32
),
"level2_ids"
:
tf
.
FixedLenFeature
([],
tf
.
int64
),
"time"
:
tf
.
FixedLenFeature
([],
tf
.
float32
),
"time"
:
tf
.
FixedLenFeature
([],
tf
.
int64
),
"stat_date"
:
tf
.
FixedLenFeature
([],
tf
.
float32
)
"stat_date"
:
tf
.
FixedLenFeature
([],
tf
.
int64
)
}
}
parsed
=
tf
.
parse_single_example
(
record
,
features
)
parsed
=
tf
.
parse_single_example
(
record
,
features
)
...
...
This diff is collapsed.
Click to expand it.
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