Browse Source

Check for segment length in all models (#127)

pull/1/head
rozetko 6 years ago committed by GitHub
parent
commit
8bd52b64f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      analytics/models/drop_model.py
  2. 4
      analytics/models/jump_model.py
  3. 2
      analytics/models/peak_model.py
  4. 2
      analytics/models/reverse_peak_model.py

4
analytics/models/drop_model.py

@ -39,7 +39,9 @@ class DropModel(Model):
segment_from_index = utils.timestamp_to_index(dataframe, pd.to_datetime(segment['from']))
segment_to_index = utils.timestamp_to_index(dataframe, pd.to_datetime(segment['to']))
segment_data = data[segment_from_index : segment_to_index + 1].reset_index(drop=True)
segment_data = data[segment_from_index: segment_to_index + 1]
if len(segment_data) == 0:
continue
segment_min = min(segment_data)
segment_max = max(segment_data)
confidences.append(0.20 * (segment_max - segment_min))

4
analytics/models/jump_model.py

@ -42,7 +42,9 @@ class JumpModel(Model):
segment_from_index = utils.timestamp_to_index(dataframe, pd.to_datetime(segment['from']))
segment_to_index = utils.timestamp_to_index(dataframe, pd.to_datetime(segment['to']))
segment_data = data.loc[segment_from_index : segment_to_index + 1].reset_index(drop=True)
segment_data = data[segment_from_index: segment_to_index + 1]
if len(segment_data) == 0:
continue
segment_min = min(segment_data)
segment_max = max(segment_data)
confidences.append(0.20 * (segment_max - segment_min))

2
analytics/models/peak_model.py

@ -38,6 +38,8 @@ class PeakModel(Model):
segment_to_index = utils.timestamp_to_index(dataframe, pd.to_datetime(segment['to']))
segment_data = data[segment_from_index: segment_to_index + 1]
if len(segment_data) == 0:
continue
segment_min = min(segment_data)
segment_max = max(segment_data)
confidences.append(0.2 * (segment_max - segment_min))

2
analytics/models/reverse_peak_model.py

@ -37,6 +37,8 @@ class ReversePeakModel(Model):
segment_to_index = utils.timestamp_to_index(dataframe, pd.to_datetime(segment['to']))
segment_data = data[segment_from_index: segment_to_index + 1]
if len(segment_data) == 0:
continue
segment_min = min(segment_data)
segment_max = max(segment_data)
confidences.append(0.2 * (segment_max - segment_min))

Loading…
Cancel
Save