Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
kasyanovse committed Sep 5, 2023
1 parent f206221 commit c70b39f
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 3 deletions.
4 changes: 2 additions & 2 deletions cases/metocean_forecasting_problem.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from fedot.core.utils import fedot_project_root


def prepare_input_data(train_file_path, test_file_path, history_size: int = 1000):
def prepare_input_data(train_file_path, test_file_path, history_size: int = 10000):
""" Function for preparing InputData for train and test algorithm
:param train_file_path: path to the csv file for training
Expand Down Expand Up @@ -69,5 +69,5 @@ def run_metocean_forecasting_problem(train_file_path, test_file_path,
file_path_test = 'cases/data/metocean/metocean_data_test.csv'

run_metocean_forecasting_problem(file_path_train, file_path_test,
forecast_length=6, timeout=5,
forecast_length=20, timeout=5,
visualization=True)
2 changes: 1 addition & 1 deletion cases/multi_ts_level_forecasting.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def run_multi_ts_forecast(forecast_length, is_multi_ts):

# use model to obtain forecast
forecast = model.predict(test_data)
target = np.ravel(test_data.target)
target = np.ravel(test_data.target[:, 0])

# visualize results
model.plot_prediction()
Expand Down
23 changes: 23 additions & 0 deletions fedot/core/composer/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ def get_value(cls, pipeline: 'Pipeline', reference_data: InputData,
metric = cls.metric(reference_data, results)
else:
# Perform time series in-sample validation
<<<<<<< Updated upstream
if isinstance(reference_data, MultiModalData):
is_multi_ts = reference_data[list(reference_data.keys())[0]].is_multi_ts
else:
Expand All @@ -89,6 +90,28 @@ def get_value(cls, pipeline: 'Pipeline', reference_data: InputData,
else:
reference_data_out, results = cls._in_sample_prediction(pipeline, reference_data, validation_blocks)
metric = cls.metric(reference_data, results)
=======
<<<<<<< Updated upstream
reference_data, results = cls._in_sample_prediction(pipeline, reference_data, validation_blocks)
metric = cls.metric(reference_data, results)
=======
is_multimodal = isinstance(reference_data, MultiModalData)
if ((is_multimodal and reference_data[list(reference_data)[0]].is_multi_ts) or
((not is_multimodal) and reference_data.is_multi_ts)):
# multi_ts
metrics = []
for i in range(reference_data.features.shape[1]):
data = reference_data.subset_features([i], True, True)
data.data_type = DataTypesEnum.ts
reference_data_out, results = cls._in_sample_prediction(pipeline, data, validation_blocks)
metrics.append(cls.metric(reference_data_out, results))
metric = np.mean(metrics)
else:
# ts
reference_data_out, results = cls._in_sample_prediction(pipeline, reference_data, validation_blocks)
metric = cls.metric(reference_data, results)
>>>>>>> Stashed changes
>>>>>>> Stashed changes

if is_analytic_mode():
from fedot.core.data.visualisation import plot_forecast
Expand Down

0 comments on commit c70b39f

Please sign in to comment.