Skip to content

Commit

Permalink
Int test fix (#1354)
Browse files Browse the repository at this point in the history
* test fix: IOptTuner excluded due to data leak

---------

Co-authored-by: Вадим Ахмеров <vadimspring@mail.ru>
  • Loading branch information
nicl-nno and VadimsAhmers authored Dec 29, 2024
1 parent 926990e commit 2c23695
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 12 deletions.
3 changes: 1 addition & 2 deletions test/integration/composer/test_composer.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
from fedot.core.repository.metrics_repository import ClassificationMetricsEnum, ComplexityMetricsEnum
from fedot.core.repository.operation_types_repository import OperationTypesRepository, get_operations_for_task
from fedot.core.repository.tasks import Task, TaskTypesEnum
from fedot.core.utils import fedot_project_root, set_random_seed
from fedot.core.utils import fedot_project_root
from test.unit.pipelines.test_pipeline_comparison import pipeline_first, pipeline_second


Expand Down Expand Up @@ -164,7 +164,6 @@ def test_parameter_free_composer_build_pipeline_correct(data_fixture, request):

@pytest.mark.parametrize('data_fixture', ['file_data_setup'])
def test_multi_objective_composer(data_fixture, request):
set_random_seed(42)

data = request.getfixturevalue(data_fixture)
dataset_to_compose = data
Expand Down
15 changes: 7 additions & 8 deletions test/integration/pipelines/tuning/test_pipeline_tuning.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
from time import time

import pytest

from fedot.core.pipelines.pipeline_builder import PipelineBuilder
from fedot.core.repository.dataset_types import DataTypesEnum
from golem.core.tuning.hyperopt_tuner import get_node_parameters_for_hyperopt
from golem.core.tuning.iopt_tuner import IOptTuner
from golem.core.tuning.optuna_tuner import OptunaTuner
Expand All @@ -15,15 +12,17 @@
from hyperopt.pyll.stochastic import sample as hp_sample

from examples.simple.time_series_forecasting.ts_pipelines import ts_complex_ridge_smoothing_pipeline, \
ts_polyfit_ridge_pipeline
ts_polyfit_ridge_pipeline
from fedot.core.data.data import InputData
from fedot.core.data.data_split import train_test_data_setup
from fedot.core.operations.evaluation.operation_implementations.models.ts_implementations.statsmodels import \
GLMImplementation
from fedot.core.pipelines.node import PipelineNode
from fedot.core.pipelines.pipeline import Pipeline
from fedot.core.pipelines.pipeline_builder import PipelineBuilder
from fedot.core.pipelines.tuning.search_space import PipelineSearchSpace
from fedot.core.pipelines.tuning.tuner_builder import TunerBuilder
from fedot.core.repository.dataset_types import DataTypesEnum
from fedot.core.repository.metrics_repository import RegressionMetricsEnum, ClassificationMetricsEnum
from fedot.core.repository.tasks import Task, TaskTypesEnum
from fedot.core.utils import fedot_project_root, NESTED_PARAMS_LABEL
Expand Down Expand Up @@ -291,7 +290,7 @@ def test_custom_params_setter(data_fixture, request):
('multi_classification_dataset', get_class_pipelines(), get_class_losses()),
('ts_forecasting_dataset', get_ts_forecasting_pipelines(), get_regr_losses()),
('multimodal_dataset', get_multimodal_pipelines(), get_class_losses())])
@pytest.mark.parametrize('tuner', [SimultaneousTuner, SequentialTuner, IOptTuner, OptunaTuner])
@pytest.mark.parametrize('tuner', [SimultaneousTuner, SequentialTuner, OptunaTuner])
def test_pipeline_tuner_correct(data_fixture, pipelines, loss_functions, request, tuner):
""" Test all tuners for pipeline """
data = request.getfixturevalue(data_fixture)
Expand Down Expand Up @@ -325,7 +324,7 @@ def test_pipeline_tuner_with_no_parameters_to_tune(classification_dataset, tuner
assert not tuned_pipeline.is_fitted


@pytest.mark.parametrize('tuner', [SimultaneousTuner, SequentialTuner, IOptTuner, OptunaTuner])
@pytest.mark.parametrize('tuner', [SimultaneousTuner, SequentialTuner, OptunaTuner])
def test_pipeline_tuner_with_initial_params(classification_dataset, tuner):
""" Test all tuners for pipeline with initial parameters """
# a model
Expand All @@ -349,7 +348,7 @@ def test_pipeline_tuner_with_initial_params(classification_dataset, tuner):
('multi_classification_dataset', get_class_pipelines(), get_class_losses()),
('ts_forecasting_dataset', get_ts_forecasting_pipelines(), get_regr_losses()),
('multimodal_dataset', get_multimodal_pipelines(), get_class_losses())])
@pytest.mark.parametrize('tuner', [SimultaneousTuner, SequentialTuner, IOptTuner, OptunaTuner])
@pytest.mark.parametrize('tuner', [SimultaneousTuner, SequentialTuner, OptunaTuner])
def test_pipeline_tuner_with_custom_search_space(data_fixture, pipelines, loss_functions, request, tuner):
""" Test tuners with different search spaces """
data = request.getfixturevalue(data_fixture)
Expand Down Expand Up @@ -547,7 +546,7 @@ def test_complex_search_space_tuning_correct(tuner):
('multi_classification_dataset', get_class_pipelines(), get_class_losses()),
('ts_forecasting_dataset', get_ts_forecasting_pipelines(), get_regr_losses()),
('multimodal_dataset', get_multimodal_pipelines(), get_class_losses())])
@pytest.mark.parametrize('tuner', [OptunaTuner, IOptTuner])
@pytest.mark.parametrize('tuner', [OptunaTuner])
def test_multiobj_tuning(data_fixture, pipelines, loss_functions, request, tuner):
""" Test multi objective tuning is correct """
data = request.getfixturevalue(data_fixture)
Expand Down
1 change: 0 additions & 1 deletion test/integration/pipelines/tuning/test_tuner_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ def test_tuner_builder_with_default_params():
assert isinstance(tuner.search_space, PipelineSearchSpace)
assert tuner.iterations == DEFAULT_TUNING_ITERATIONS_NUMBER
assert tuner.algo == tpe.suggest
assert tuner.max_seconds == 300


@pytest.mark.parametrize('tuner_class', [SimultaneousTuner, SequentialTuner, IOptTuner])
Expand Down
2 changes: 1 addition & 1 deletion test/integration/real_applications/test_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def test_api_classification_example():


def test_api_ts_forecasting_example():
for _ in range(100):
for _ in range(10):
forecast = run_ts_forecasting_example(dataset='salaries', timeout=2, with_tuning=False)
assert forecast is not None

Expand Down

0 comments on commit 2c23695

Please sign in to comment.