Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dependafix #170

Closed
wants to merge 94 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
94 commits
Select commit Hold shift + click to select a range
df16eef
minor upgrades in wavelets
Oct 21, 2024
ec69b4d
notebook updates
Oct 21, 2024
c85d28d
rework search space for wavelet_basis, rework dask multithread, add b…
Oct 22, 2024
c5304cc
Automated autopep8 fixes
Oct 22, 2024
53a1092
fix test
Oct 22, 2024
b98d828
fix test 0.1
Oct 22, 2024
fbbe4f6
fix test 0.2
Oct 22, 2024
dad8f92
update poetry
Oct 22, 2024
5bef95f
fix test 0.3
Oct 24, 2024
7922709
add dask as backend for models, refactoring in constant and model repo
Oct 24, 2024
db600b8
Automated autopep8 fixes
Oct 24, 2024
e44d340
fix imports
Oct 24, 2024
16dccdc
Merge remote-tracking branch 'origin/tutorial_and_fixes' into tutoria…
Oct 24, 2024
e573d5b
add dask optuna integration
Oct 24, 2024
e1aabfc
Automated autopep8 fixes
Oct 24, 2024
4705b83
add optuna integration to poetry
Oct 24, 2024
96e0324
Merge remote-tracking branch 'origin/tutorial_and_fixes' into tutoria…
Oct 24, 2024
32f0ccb
fix test 0.4
Oct 24, 2024
fd58b9f
Automated autopep8 fixes
Oct 24, 2024
25893bd
refined requirements
technocreep Nov 6, 2024
da1031e
refined requirements
technocreep Nov 6, 2024
ac44971
refined requirements
technocreep Nov 6, 2024
7dc26db
refined requirements
technocreep Nov 6, 2024
656e79a
Merge remote-tracking branch 'origin/dask_experiments' into dask_expe…
technocreep Nov 6, 2024
91b11c6
exclude lock
technocreep Nov 6, 2024
56258a8
update requirements
technocreep Nov 6, 2024
90aa77d
test modification
technocreep Nov 7, 2024
8af5b30
Automated autopep8 fixes
Nov 7, 2024
8c6133b
update DaskOptunaTuner storage initialization and add optuna-integrat…
technocreep Nov 7, 2024
946fc1d
Merge remote-tracking branch 'origin/dask_experiments' into dask_expe…
technocreep Nov 7, 2024
c725204
Add context management for switching between industrial and fedot models
technocreep Nov 7, 2024
1175397
Automated autopep8 fixes
Nov 7, 2024
3583b92
Update unit test workflow to include Python 3.11 and refactor ApiMana…
technocreep Nov 8, 2024
4bec9e5
Automated autopep8 fixes
Nov 8, 2024
f63dc39
Refactor imports and clean up ApiManager methods for improved readabi…
technocreep Nov 8, 2024
5695c98
Automated autopep8 fixes
Nov 8, 2024
6bd4e51
Update giotto-tda version constraint to use caret notation
technocreep Nov 8, 2024
243e018
Bump version to 0.4.3, update Python version matrix, and refactor Api…
technocreep Nov 12, 2024
23b0fe7
Automated autopep8 fixes
Nov 12, 2024
7a49979
Add pdl aglo for clf and reg
Nov 12, 2024
7e950f9
Automated autopep8 fixes
Nov 12, 2024
5f41293
restructured benchmark examples folder
Nov 12, 2024
0dad2a3
Merge remote-tracking branch 'origin/tutorial_and_fixes' into tutoria…
Nov 12, 2024
3c7bb3c
Automated autopep8 fixes
Nov 12, 2024
34c4b06
update model repo
Nov 12, 2024
3cec557
Merge remote-tracking branch 'origin/tutorial_and_fixes' into tutoria…
Nov 12, 2024
15a5005
minor refactoring
Nov 12, 2024
d3c13b4
Automated autopep8 fixes
Nov 12, 2024
e685eab
moving extractors to new module
Nov 28, 2024
5855e4a
Merge remote-tracking branch 'origin/tutorial_and_fixes' into tutoria…
Nov 28, 2024
7d6490a
add PDL model, benchmark comparasion and example from parma
Nov 28, 2024
ea6b746
Automated autopep8 fixes
Nov 28, 2024
46f5e3d
data transformation operation minor refactoring
Nov 28, 2024
63b8fa4
Merge remote-tracking branch 'origin/tutorial_and_fixes' into tutoria…
Nov 28, 2024
6388e0e
add park transformation
Nov 28, 2024
5a91d69
Refactoring with Dask parallelism. Changes in classification_tabular …
Nov 28, 2024
061f8ac
Automated autopep8 fixes
Nov 28, 2024
c64823e
Remove resample mutation from default fedot context
Nov 28, 2024
07d5795
Merge remote-tracking branch 'origin/tutorial_and_fixes' into tutoria…
Nov 28, 2024
faea4d3
Automated autopep8 fixes
Nov 28, 2024
cd6518d
minor fixes in fourier and wavelet heurisitc feature vector
Nov 28, 2024
377fed1
Automated autopep8 fixes
Nov 28, 2024
8c44f84
Refactor metric handling and add Dask-based regression models
technocreep Nov 29, 2024
5453a6b
Automated autopep8 fixes
Nov 29, 2024
28207c0
Add DaskPCA class
technocreep Nov 29, 2024
455204b
Fix RMSE calculation
technocreep Nov 29, 2024
c36a769
add FedotEvoOptimizer,add optimisation params to Api methods
Nov 29, 2024
39d18b0
Automated autopep8 fixes
Nov 29, 2024
c270eca
Merge remote-tracking branch 'origin/dask_experiments' into tutorial_…
Nov 29, 2024
6da4d4f
fixes after merge
Nov 29, 2024
31cfbf1
Automated autopep8 fixes
Nov 29, 2024
ca2f0aa
test fixes
Dec 2, 2024
604c0fe
remove open3d
Dec 2, 2024
0fbbbe3
refactor: update initial assumption strategy in ApiManager
technocreep Dec 2, 2024
8f33bdc
fix DataCheck
Dec 2, 2024
2fd54e2
Merge remote-tracking branch 'origin/industrial_release_0.5' into ind…
Dec 2, 2024
c33e2d2
fix examples and test
Dec 2, 2024
a73ddeb
Automated autopep8 fixes
Dec 2, 2024
caa8f1b
fix extract features
Dec 2, 2024
f74bf15
Merge remote-tracking branch 'origin/industrial_release_0.5' into ind…
Dec 2, 2024
6873cce
restructure example folder
Dec 3, 2024
8613598
fix api init and strategy cls
Dec 3, 2024
2c0187e
fix api manager
Dec 3, 2024
68bee24
Automated autopep8 fixes
Dec 3, 2024
5e9a98e
Just added or updated docstrings
technocreep Dec 3, 2024
bae5347
Automated autopep8 fixes
Dec 3, 2024
64c0628
bump version to 0.5.0
technocreep Dec 4, 2024
79dc9b8
bump version to 0.5.0 - poetry
technocreep Dec 4, 2024
f4fa259
set version to 0.5.0 in __init__.py
technocreep Dec 4, 2024
a76b75c
Automated autopep8 fixes
Dec 4, 2024
ac46dec
Update dependencies in pyproject.toml for compatibility and version u…
technocreep Dec 5, 2024
f557007
Add Python 3.11 to the CI workflow matrix
technocreep Dec 5, 2024
489e56e
Update giotto-tda dependency to allow any version
technocreep Dec 5, 2024
f2f8643
update deps in requirements.txt and setup.py for backward compatibility
technocreep Dec 5, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 0 additions & 22 deletions .github/ISSUE_TEMPLATE/sweep-template.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/poetry_unit_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
timeout-minutes: 60
strategy:
matrix:
python-version: [3.9, '3.10']
python-version: [3.9, '3.10', '3.11']

steps:
- uses: actions/checkout@v2
Expand Down
70 changes: 43 additions & 27 deletions benchmark/benchmark_TSC.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

from benchmark.abstract_bench import AbstractBenchmark
from fedot_ind.api.utils.path_lib import PROJECT_PATH
from fedot_ind.core.architecture.pipelines.abstract_pipeline import ApiTemplate
from fedot_ind.core.architecture.postprocessing.results_picker import ResultsPicker
from fedot_ind.core.architecture.settings.computational import backend_methods as np
from fedot_ind.core.metrics.metrics_implementation import Accuracy
Expand All @@ -27,6 +28,7 @@ def __init__(self,
self.logger = logging.getLogger(self.__class__.__name__)

self.experiment_setup = experiment_setup
self.init_assumption = deepcopy(self.experiment_setup['initial_assumption'])
self.multi_TSC = MULTI_CLF_BENCH
self.uni_TSC = UNI_CLF_BENCH
if custom_datasets is None:
Expand All @@ -38,35 +40,50 @@ def __init__(self,
self.custom_datasets = custom_datasets

if use_small_datasets:
self.path_to_result = '/benchmark/results/time_series_uni_clf_comparasion.csv'
self.path_to_save = '/benchmark/results/ts_uni_classification'
self.path_to_result = 'time_series_uni_clf_comparasion.csv'
self.path_to_save = 'ts_uni_classification'
else:
self.path_to_result = '/benchmark/results/time_series_multi_clf_comparasion.csv'
self.path_to_save = '/benchmark/results/ts_multi_classification'
self.results_picker = ResultsPicker(
path=os.path.abspath(self.output_dir))
self.path_to_result = 'time_series_multi_clf_comparasion.csv'
self.path_to_save = 'ts_multi_classification'
self.output_dir = os.path.join(self.experiment_setup['output_folder'], self.path_to_save)
self.results_picker = ResultsPicker(path=os.path.abspath(self.output_dir))

def _run_model_versus_model(self, dataset_name, comparasion_dict):
approach_dict = {}
for approach in comparasion_dict.keys():
result_dict = ApiTemplate(api_config=self.experiment_setup,
metric_list=self.experiment_setup['metric_names']). \
eval(dataset=dataset_name,
initial_assumption=comparasion_dict[approach],
finetune=self.experiment_setup['finetune'])
metric = result_dict['metrics'][self.experiment_setup['metric']][0]
approach_dict.update({approach: metric})
return approach_dict

def _run_industrial_versus_sota(self, dataset_name):
experiment_setup = deepcopy(self.experiment_setup)
prediction, target = self.evaluate_loop(dataset_name, experiment_setup)
return Accuracy(target, prediction).metric()

def run(self):
self.logger.info('Benchmark test started')
basic_results = self.load_local_basic_results()
metric_dict = {}
for dataset_name in self.custom_datasets:
experiment_setup = deepcopy(self.experiment_setup)
prediction, target = self.evaluate_loop(
dataset_name, experiment_setup)
metric = Accuracy(target, prediction).metric()
metric_dict.update({dataset_name: metric})
basic_results.loc[dataset_name, 'Fedot_Industrial'] = metric
dataset_path = os.path.join(
self.experiment_setup['output_folder'],
f'{dataset_name}',
'metrics_report.csv')
basic_results.to_csv(dataset_path)
gc.collect()
basic_path = os.path.join(
self.experiment_setup['output_folder'],
'comprasion_metrics_report.csv')
basic_results.to_csv(basic_path)
try:
if isinstance(self.init_assumption, dict):
model_name = list(self.init_assumption.keys())
metric = self._run_model_versus_model(dataset_name, self.init_assumption)
else:
metric = self._run_industrial_versus_sota()
model_name = 'Fedot_Industrial'
metric_dict.update({dataset_name: metric})
basic_results.loc[dataset_name, model_name] = metric
if not os.path.exists(self.output_dir):
os.makedirs(self.output_dir)
basic_results.to_csv(os.path.join(self.output_dir, self.path_to_result))
except Exception:
self.logger.info(f"{dataset_name} problem with eval")
self.logger.info("Benchmark test finished")

def finetune(self):
Expand Down Expand Up @@ -128,15 +145,14 @@ def finetune(self):

def load_local_basic_results(self, path: str = None):
if path is None:
path = PROJECT_PATH + self.path_to_result
path = os.path.join(self.output_dir, self.path_to_result)
try:
results = pd.read_csv(path, sep=',', index_col=0)
results = results.dropna(axis=1, how='all')
results = results.dropna(axis=0, how='all')
# results = results.fillna()
# results = results.dropna(axis=1, how='all')
# results = results.dropna(axis=0, how='all')
except Exception:
results = self.load_web_results()
self.experiment_setup['output_folder'] = PROJECT_PATH + \
self.path_to_save
return results
else:
return self.results_picker.run(get_metrics_df=True, add_info=True)
Expand Down
67 changes: 43 additions & 24 deletions benchmark/benchmark_TSER.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
from fedot_ind.core.repository.constanst_repository import MULTI_REG_BENCH
from fedot_ind.core.architecture.postprocessing.results_picker import ResultsPicker
from benchmark.abstract_bench import AbstractBenchmark
from fedot_ind.core.metrics.metrics_implementation import RMSE
from fedot_ind.api.utils.path_lib import PROJECT_PATH
from fedot_ind.api.main import FedotIndustrial
from fedot.core.pipelines.pipeline import Pipeline
from fedot.core.pipelines.node import PipelineNode
import pandas as pd
import logging
import os
from abc import ABC
from copy import deepcopy

import matplotlib
import pandas as pd
from fedot.core.pipelines.node import PipelineNode
from fedot.core.pipelines.pipeline import Pipeline

from benchmark.abstract_bench import AbstractBenchmark
from fedot_ind.api.main import FedotIndustrial
from fedot_ind.api.utils.path_lib import PROJECT_PATH
from fedot_ind.core.architecture.pipelines.abstract_pipeline import ApiTemplate
from fedot_ind.core.architecture.postprocessing.results_picker import ResultsPicker
from fedot_ind.core.metrics.metrics_implementation import RMSE
from fedot_ind.core.repository.constanst_repository import MULTI_REG_BENCH
from fedot_ind.tools.loader import DataLoader

matplotlib.use('TkAgg')
Expand All @@ -31,6 +32,7 @@ def __init__(self,
self.logger = logging.getLogger(self.__class__.__name__)

self.experiment_setup = experiment_setup
self.init_assumption = deepcopy(self.experiment_setup['initial_assumption'])
self.monash_regression = MULTI_REG_BENCH
if custom_datasets is None:
self.custom_datasets = self.monash_regression
Expand All @@ -40,26 +42,43 @@ def __init__(self,
self.results_picker = ResultsPicker(
path=os.path.abspath(self.output_dir))

def _run_model_versus_model(self, dataset_name, comparasion_dict):
approach_dict = {}
for approach in comparasion_dict.keys():
result_dict = ApiTemplate(api_config=self.experiment_setup,
metric_list=self.experiment_setup['metric_names']). \
eval(dataset=dataset_name,
initial_assumption=comparasion_dict[approach],
finetune=self.experiment_setup['finetune'])
metric = result_dict['metrics'][self.experiment_setup['metric']][0]
approach_dict.update({approach: metric})
return approach_dict

def _run_industrial_versus_sota(self, dataset_name):
experiment_setup = deepcopy(self.experiment_setup)
prediction, target = self.evaluate_loop(dataset_name, experiment_setup)
return RMSE(target, prediction).metric()

def run(self):
self.logger.info('Benchmark test started')
basic_results = self.load_local_basic_results()
metric_dict = {}
for dataset_name in self.custom_datasets:
experiment_setup = deepcopy(self.experiment_setup)
prediction, target = self.evaluate_loop(
dataset_name, experiment_setup)
metric = RMSE(target, prediction).metric()
metric_dict.update({dataset_name: metric})
basic_results.loc[dataset_name, 'Fedot_Industrial'] = metric
dataset_path = os.path.join(
self.experiment_setup['output_folder'],
f'{dataset_name}',
'metrics_report.csv')
basic_results.to_csv(dataset_path)
basic_path = os.path.join(
self.experiment_setup['output_folder'],
'comprasion_metrics_report.csv')
basic_results.to_csv(basic_path)
try:
if isinstance(self.init_assumption, dict):
model_name = list(self.init_assumption.keys())
metric = self._run_model_versus_model(dataset_name, self.init_assumption)
else:
metric = self._run_industrial_versus_sota(dataset_name)
model_name = 'Fedot_Industrial'
metric_dict.update({dataset_name: metric})
basic_results.loc[dataset_name, model_name] = metric
basic_path = os.path.join(self.experiment_setup['output_folder'])
if not os.path.exists(basic_path):
os.makedirs(basic_path)
basic_results.to_csv(os.path.join(basic_path, 'comprasion_metrics_report.csv'))
except Exception:
self.logger.info(f"{dataset_name} problem with eval")
self.logger.info("Benchmark test finished")

def load_local_basic_results(self, path: str = None):
Expand Down
File renamed without changes.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import random

import matplotlib.pyplot as plt
from torchvision.transforms import ToTensor, Resize, Compose

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
from fedot_ind.core.models.nn.network_modules.layers.lora import linear_layer_parameterization

import torch
import torch.nn as nn
import torch.nn.utils.parametrize as parametrize

import torchvision.datasets as datasets
import torchvision.transforms as transforms

from tqdm import tqdm

from fedot_ind.core.models.nn.network_modules.layers.lora import linear_layer_parameterization

# Make torch deterministic
_ = torch.manual_seed(228)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import os
import random

import yaml
from fedot_ind.core.architecture.datasets.visualization import draw_sample_with_bboxes

from fedot_ind.api.main import FedotIndustrial
from fedot_ind.core.architecture.datasets.visualization import draw_sample_with_bboxes

DATASETS_PATH = os.path.abspath('Warp-D')
TEST_IMAGE_FOLDER = 'Land-Use_Scene_Classification/images_train_test_val/test'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import numpy as np


def create_big_dataset():
train_X, test_X = np.load(
'big_dataset/train_airlinescodrnaadult_fold0.npy'), np.load(
'big_dataset/test_airlinescodrnaadult_fold0.npy')
train_y, test_y = np.load(
'big_dataset/trainy_airlinescodrnaadult_fold0.npy'), np.load(
'big_dataset/testy_airlinescodrnaadult_fold0.npy')
dataset_dict = dict(train_data=(train_X, train_y),
test_data=(test_X, test_y))
return dataset_dict
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
from examples.automl_example.custom_strategy.big_data.big_dataset_utils import create_big_dataset
from fedot_ind.core.architecture.pipelines.abstract_pipeline import ApiTemplate

cur_params = {'rank': None}
sampling_algorithm = {'CUR': cur_params}

if __name__ == "__main__":
dataset_dict = create_big_dataset()
finetune = False
metric_names = ('f1', 'accuracy')
api_config = dict(problem='classification',
metric='f1',
timeout=40,
pop_size=10,
early_stopping_iterations=10,
early_stopping_timeout=30,
optimizer_params={'mutation_agent': 'bandit',
'mutation_strategy': 'growth_mutation_strategy'},
with_tunig=False,
preset='classification_tabular',
industrial_strategy_params={'data_type': 'tensor',
'learning_strategy': 'big_dataset',
'sampling_strategy': sampling_algorithm
},
n_jobs=-1,
logging_level=20)

result_dict = ApiTemplate(api_config=api_config,
metric_list=metric_names).eval(dataset=dataset_dict,
finetune=finetune)
metrics = result_dict['metrics']
metrics.to_csv('./metrics.csv')
hist = result_dict['industrial_model'].save_optimization_history(return_history=True)
result_dict['industrial_model'].vis_optimisation_history(hist)
result_dict['industrial_model'].save_best_model()
_ = 1
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from fedot_ind.api.main import FedotIndustrial
import torchvision.datasets as datasets
import torchvision.transforms as transforms

from fedot_ind.api.main import FedotIndustrial

transform = transforms.Compose([
transforms.ToTensor(),
transforms.Normalize((0.1307,), (0.3081,))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from fedot_ind.api.utils.checkers_collections import DataCheck
from fedot_ind.api.utils.path_lib import PROJECT_PATH
from fedot_ind.core.architecture.pipelines.abstract_pipeline import ApiTemplate
from fedot_ind.core.models.quantile.quantile_extractor import QuantileExtractor
from fedot_ind.core.operation.transformation.representation.statistical.quantile_extractor import QuantileExtractor
from fedot_ind.core.repository.constanst_repository import FEDOT_TASK
from fedot_ind.core.repository.initializer_industrial_models import IndustrialModels

Expand Down
Loading
Loading