Skip to content

Commit

Permalink
Hotfix for integration tests (#1242)
Browse files Browse the repository at this point in the history
* set `sparse_lagged` window to autotune

* disable `test_models_does_not_fall_on_constant_data` for `cgru` (#1240)

* split `test_api_example` to some tests

* pep8

* increase data length for test
  • Loading branch information
kasyanovse authored Jan 5, 2024
1 parent db6e3be commit 92f92d6
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 10 deletions.
3 changes: 2 additions & 1 deletion examples/simple/time_series_forecasting/api_forecasting.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ def get_ts_data(dataset='australia', horizon: int = 30, validation_blocks=None):
else:
# non datetime indexes
idx = time_series['idx'].values
time_series = time_series['value'].values
col = {'test_sea': 'Level'}.get(dataset, 'value')
time_series = time_series[col].values
train_input = InputData(idx=idx,
features=time_series,
target=time_series,
Expand Down
2 changes: 1 addition & 1 deletion fedot/core/repository/data/default_operation_params.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"cut_part": 0.5
},
"sparse_lagged": {
"window_size": 10,
"window_size": 0,
"n_components": 0.5,
"sparse_transform": true,
"use_svd": false
Expand Down
4 changes: 3 additions & 1 deletion test/integration/models/test_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ def test_locf_forecast_correctly():
def test_models_does_not_fall_on_constant_data():
""" Run models on constant data """
# models that raise exception
to_skip = ['custom', 'arima', 'catboost', 'catboostreg',
to_skip = ['custom', 'arima', 'catboost', 'catboostreg', 'cgru',
'lda', 'fast_ica', 'decompose', 'class_decompose']

for operation in OperationTypesRepository('all')._repo:
Expand All @@ -484,6 +484,8 @@ def test_models_does_not_fall_on_constant_data():
assert pipeline.predict(data) is not None
except NotImplementedError:
pass
except Exception:
raise RuntimeError(f"{operation.id} falls on constant data")


def test_operations_are_serializable():
Expand Down
18 changes: 11 additions & 7 deletions test/integration/real_applications/test_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,19 +78,23 @@ def test_multistep_example():
run_multistep('test_sea', pipeline, step_forecast=20, future_steps=5)


def test_api_example():
with_tuning = False

prediction = run_classification_example(timeout=1, with_tuning=with_tuning)
def test_api_classification_example():
prediction = run_classification_example(timeout=1, with_tuning=False)
assert prediction is not None

forecast = run_ts_forecasting_example(dataset='australia', timeout=2, with_tuning=with_tuning)

def test_api_ts_forecasting_example():
forecast = run_ts_forecasting_example(dataset='test_sea', timeout=2, with_tuning=False)
assert forecast is not None

pareto = run_classification_multiobj_example(timeout=1, with_tuning=with_tuning)

def test_api_classification_multiobj_example():
pareto = run_classification_multiobj_example(timeout=1, with_tuning=False)
assert pareto is not None

explainer = run_api_explain_example(timeout=1, with_tuning=with_tuning)

def test_api_explain_example():
explainer = run_api_explain_example(timeout=1, with_tuning=False)
assert explainer is not None


Expand Down

0 comments on commit 92f92d6

Please sign in to comment.