Skip to content

Commit c237987

Browse files
committed
Allow for prediction of subset of a dataset by specifying TS names
1 parent 1391810 commit c237987

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

cesium_app/handlers/prediction.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ def post(self):
6767

6868
dataset_id = data['datasetID']
6969
model_id = data['modelID']
70+
ts_names = data.get('ts_names')
7071

7172
dataset = Dataset.get(Dataset.id == data["datasetID"])
7273
model = Model.get(Model.id == data["modelID"])
@@ -88,7 +89,12 @@ def post(self):
8889

8990
executor = yield self._get_executor()
9091

91-
all_time_series = executor.map(time_series.load, dataset.uris)
92+
if ts_names:
93+
ts_uris = [f.uri for f in dataset.files if f.name in ts_names]
94+
else:
95+
ts_uris = dataset.uris
96+
97+
all_time_series = executor.map(time_series.load, ts_uris)
9298
all_labels = executor.map(lambda ts: ts.label, all_time_series)
9399
all_features = executor.map(featurize.featurize_single_ts,
94100
all_time_series,

0 commit comments

Comments
 (0)