Skip to content

Commit 3403c00

Browse files
committed
tiny fixes
1 parent a74f536 commit 3403c00

File tree

3 files changed

+31
-6
lines changed

3 files changed

+31
-6
lines changed

demo/traffic_prediction/dataprovider.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ def initHook(settings, file_list, **kwargs):
3434
settings.pool_size = sys.maxint
3535
#Use a time seires of the past as feature.
3636
#Dense_vector's expression form is [float,float,...,float]
37-
settings.slots = [dense_vector(TERM_NUM)]
37+
settings.input_types = [dense_vector(TERM_NUM)]
3838
#There are next FORECASTING_NUM fragments you need predict.
3939
#Every predicted condition at time point has four states.
4040
for i in range(FORECASTING_NUM):
41-
settings.slots.append(integer_value(LABEL_VALUE_NUM))
41+
settings.input_types.append(integer_value(LABEL_VALUE_NUM))
4242

4343

4444
@provider(
@@ -57,7 +57,7 @@ def process(settings, file_name):
5757
pre_spd = map(float, speeds[i - TERM_NUM:i])
5858

5959
# Integer value need predicting, values start from 0, so every one minus 1.
60-
fol_spd = [i - 1 for i in speeds[i:i + FORECASTING_NUM]]
60+
fol_spd = [j - 1 for j in speeds[i:i + FORECASTING_NUM]]
6161

6262
# Predicting label is missing, abandon the sample.
6363
if -1 in fol_spd:
@@ -67,7 +67,7 @@ def process(settings, file_name):
6767

6868
def predict_initHook(settings, file_list, **kwargs):
6969
settings.pool_size = sys.maxint
70-
settings.slots = [dense_vector(TERM_NUM)]
70+
settings.input_types = [dense_vector(TERM_NUM)]
7171

7272

7373
@provider(init_hook=predict_initHook, should_shuffle=False)

demo/traffic_prediction/gen_result.py

+14
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
# Copyright (c) 2016 Baidu, Inc. All Rights Reserved
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
115
res = []
216
with open('./rank-00000') as f:
317
for line in f:

demo/traffic_prediction/trainer_config.py

+13-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
1-
#!/usr/bin/env/python
2-
#-*python-*-
1+
# Copyright (c) 2016 Baidu, Inc. All Rights Reserved
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
314
from paddle.trainer_config_helpers import *
415

516
################################### DATA Configuration #############################################

0 commit comments

Comments
 (0)