def run_metocean_forecasting_problem(train_file_path, test_file_path, forecast_length=1, is_visualise=False, timeout=5): # Prepare data for train and test ssh_history, ws_history, ssh_obs = prepare_input_data( train_file_path, test_file_path) historical_data = { 'ws': ws_history, # additional variable 'ssh': ssh_history, # target variable } fedot = Fedot( problem='ts_forecasting', task_params=TsForecastingParams(forecast_length=forecast_length), timeout=timeout, verbose_level=4) pipeline = fedot.fit(features=historical_data, target=ssh_history) fedot.forecast(historical_data, forecast_length=forecast_length) metric = fedot.get_metrics(target=ssh_obs) if is_visualise: pipeline.show() fedot.plot_prediction() return metric
def test_multivariate_ts(): forecast_length = 1 file_path_train = 'cases/data/metocean/metocean_data_train.csv' full_path_train = os.path.join(str(fedot_project_root()), file_path_train) # a dataset for a final validation of the composed model file_path_test = 'cases/data/metocean/metocean_data_test.csv' full_path_test = os.path.join(str(fedot_project_root()), file_path_test) target_history, add_history, obs = prepare_input_data( full_path_train, full_path_test) historical_data = { 'ws': add_history, # additional variable 'ssh': target_history, # target variable } fedot = Fedot( problem='ts_forecasting', composer_params=composer_params, task_params=TsForecastingParams(forecast_length=forecast_length)) fedot.fit(features=historical_data, target=target_history) forecast = fedot.forecast(historical_data, forecast_length=forecast_length) assert forecast is not None