Browse Source

Fix error with second learning

pull/1/head
rozetko 7 years ago
parent
commit
3a7d234619
  1. 11
      analytics/data_provider.py

11
analytics/data_provider.py

@ -52,17 +52,20 @@ class DataProvider:
return result return result
dataframe = self.get_dataframe(None) dataframe = self.get_dataframe(None)
for anomaly in anomalies: for anomaly in anomalies:
start_time = pd.to_datetime(anomaly['start']-1, unit='ms') start_time = pd.to_datetime(anomaly['start'] + 1, unit='ms')
finish_time = pd.to_datetime(anomaly['finish']+1, unit='ms') finish_time = pd.to_datetime(anomaly['finish'] - 1, unit='ms')
current_index = (dataframe['timestamp'] >= start_time) & (dataframe['timestamp'] <= finish_time) current_index = (dataframe['timestamp'] >= start_time) & (
dataframe['timestamp'] <= finish_time)
anomaly_frame = dataframe[current_index] anomaly_frame = dataframe[current_index]
if anomaly_frame.empty:
continue
cur_anomaly = { cur_anomaly = {
'start': anomaly_frame.index[0], 'start': anomaly_frame.index[0],
'finish': anomaly_frame.index[len(anomaly_frame) - 1], 'finish': anomaly_frame.index[len(anomaly_frame) - 1],
'labeled': anomaly['labeled'] 'labeled': anomaly['labeled']
} }
result.append(cur_anomaly) result.append(cur_anomaly)
return result return result
def inverse_transform_indexes(self, indexes): def inverse_transform_indexes(self, indexes):

Loading…
Cancel
Save