Skip to content

Commit

Permalink
made working example
Browse files Browse the repository at this point in the history
  • Loading branch information
valer1435 committed Aug 8, 2023
1 parent ea5b8af commit 7bb8ba0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
6 changes: 3 additions & 3 deletions examples/anomaly_detection/detection_classification.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ def generate_time_series(to_plot: bool = True,
label=cls) for cls in anomaly_intervals.keys()]

for anomaly_class, intervals in anomaly_intervals.items():
for interval in intervals.split(', '):
start_idx, end_idx = map(int, interval.split(':'))
for interval in intervals:
start_idx, end_idx = map(int, interval)
ax.axvspan(start_idx, end_idx, alpha=0.3, color=color_dict[anomaly_class])

plt.legend(handles=set(legend_patches))
Expand All @@ -69,7 +69,7 @@ def generate_colors(num_colors):


if __name__ == "__main__":
time_series, anomaly_intervals = generate_time_series(to_plot=False,
time_series, anomaly_intervals = generate_time_series(to_plot=True,
ts_length=1000,
num_anomaly_classes=4,
num_of_anomalies=50)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
from fedot.core.repository.quality_metrics_repository import ClassificationMetricsEnum
from fedot.core.repository.tasks import Task, TaskTypesEnum
from golem.core.tuning.simultaneous import SimultaneousTuner
from golem.core.tuning.sequential import SequentialTuner

from fedot_ind.api.utils.saver_collections import ResultSaver
from fedot_ind.core.architecture.postprocessing.Analyzer import PerformanceAnalyzer
Expand Down Expand Up @@ -210,8 +209,8 @@ def fit(self, features,
'mlp',
'knn',
'lgbm',
'pca']
, **self.model_params)
'pca'],
**self.model_params)

self.predictor.fit(train_data_preprocessed)

Expand Down Expand Up @@ -247,8 +246,8 @@ def predict(self, features: pd.DataFrame, target: np.array) -> dict:
data_type=test_data_preprocessed.data_type,
task=test_data_preprocessed.task)

self.prediction_label_baseline = self.baseline_model.predict(self.test_data_preprocessed).predict
self.prediction_label = self.predictor.predict(self.test_data_preprocessed)
self.prediction_label_baseline = self.baseline_model.predict(self.test_data_preprocessed).predict

return self.prediction_label

Expand Down
2 changes: 1 addition & 1 deletion fedot_ind/core/models/statistical/StatsExtractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def _transform(self, input_data: InputData) -> np.array:
# predict = self.drop_features(predict=predict,
# columns=stat_features,
# n_components=n_components)
if predict.shape[1] == 29:
if predict.shape[1] == 36:
print('a')
return predict

Expand Down

0 comments on commit 7bb8ba0

Please sign in to comment.