-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add feature generator strategy creator function in example util…
…s, refactor examples
- Loading branch information
Showing
7 changed files
with
78 additions
and
277 deletions.
There are no files selected for viewing
61 changes: 15 additions & 46 deletions
61
examples/automl_example/custom_strategy/big_data/random_sampling_example.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,65 +1,34 @@ | ||
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 | ||
from fedot_ind.core.repository.config_repository import DEFAULT_COMPUTE_CONFIG, \ | ||
DEFAULT_AUTOML_LEARNING_CONFIG | ||
|
||
cur_params = {'rank': None} | ||
sampling_algorithm = {'CUR': cur_params} | ||
|
||
|
||
def eval_fedot_on_fold(dataset_name, fold): | ||
return create_big_dataset(dataset_name, fold) | ||
from fedot_ind.core.repository.config_repository import DEFAULT_COMPUTE_CONFIG, DEFAULT_AUTOML_LEARNING_CONFIG, \ | ||
DEFAULT_CLF_AUTOML_CONFIG | ||
|
||
DATASET_NAME = 'airlines' | ||
METRIC_NAMES = ('f1', 'accuracy', 'precision', 'roc_auc') | ||
|
||
INDUSTRIAL_PARAMS = {'data_type': 'tensor', | ||
'learning_strategy': 'big_dataset', | ||
'sampling_strategy': sampling_algorithm | ||
} | ||
'sampling_strategy': {'CUR': {'rank': None}}} | ||
|
||
AUTOML_LEARNING_STRATEGY = DEFAULT_AUTOML_LEARNING_CONFIG | ||
COMPUTE_CONFIG = DEFAULT_COMPUTE_CONFIG | ||
AUTOML_CONFIG = {'task': 'classification', | ||
'use_automl': True, | ||
'optimisation_strategy': {'optimisation_strategy': {'mutation_agent': 'bandit', | ||
'mutation_strategy': 'growth_mutation_strategy'}, | ||
'optimisation_agent': 'Industrial'}} | ||
LEARNING_CONFIG = {'learning_strategy': 'from_scratch', | ||
'learning_strategy_params': AUTOML_LEARNING_STRATEGY, | ||
'learning_strategy_params': DEFAULT_AUTOML_LEARNING_CONFIG, | ||
'optimisation_loss': {'quality_loss': 'f1'}} | ||
|
||
INDUSTRIAL_CONFIG = {'problem': 'classification', | ||
'strategy': 'tabular', | ||
'strategy_params': INDUSTRIAL_PARAMS | ||
} | ||
'strategy_params': INDUSTRIAL_PARAMS} | ||
|
||
API_CONFIG = {'industrial_config': INDUSTRIAL_CONFIG, | ||
'automl_config': AUTOML_CONFIG, | ||
'automl_config': DEFAULT_CLF_AUTOML_CONFIG, | ||
'learning_config': LEARNING_CONFIG, | ||
'compute_config': COMPUTE_CONFIG} | ||
'compute_config': DEFAULT_COMPUTE_CONFIG} | ||
|
||
if __name__ == "__main__": | ||
metric_by_fold = {} | ||
finetune = False | ||
metric_names = ('f1', 'accuracy') | ||
dataset_name = 'airlines' | ||
api_config = dict(problem='classification', | ||
metric='f1', | ||
timeout=20, | ||
pop_size=3, | ||
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) | ||
for fold in range(10): | ||
dataset_dict = eval_fedot_on_fold(dataset_name, fold) | ||
dataset_dict = create_big_dataset(DATASET_NAME, fold) | ||
result_dict = ApiTemplate(api_config=API_CONFIG, | ||
metric_list=metric_names).eval(dataset=dataset_dict, | ||
finetune=finetune) | ||
metric_list=METRIC_NAMES).eval(dataset=dataset_dict, | ||
finetune=False) | ||
metric_by_fold.update({fold: result_dict}) | ||
_ = 1 | ||
print(metric_by_fold) |
76 changes: 10 additions & 66 deletions
76
examples/automl_example/custom_strategy/explainability/optimisation_history_visualisation.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.