Nodes with DataModellingStrategy do not be serialized correctly
Created by: J3FALL
How to reproduce bug:
import os
from fedot.core.composer.chain import Chain
from fedot.core.composer.node import PrimaryNode
from fedot.core.models.data import InputData
from fedot.core.repository.model_types_repository import ModelTypesRepository
from fedot.core.repository.tasks import Task, TaskTypesEnum
from fedot.core.utils import project_root
def chain_with_model(model_type):
chain = Chain()
node = PrimaryNode(model_type=model_type)
chain.add_node(node)
return chain
task = Task(TaskTypesEnum.classification)
available_model_types, _ = ModelTypesRepository().suitable_model(task_type=task.task_type)
file_path_train = 'cases/data/scoring/scoring_train.csv'
full_path_train = os.path.join(str(project_root()), file_path_train)
dataset_to_compose = InputData.from_csv(full_path_train, task=task)
print(available_model_types)
if not os.path.exists('test_dir'):
os.mkdir('test_dir')
for model_type in available_model_types:
print(f'Model: {model_type}')
chain = chain_with_model(model_type=model_type)
chain.fit(dataset_to_compose)
chain.save_chain(f'test_dir/test_{model_type}.json')
For model_type = direct_data_model chain cannot be saved without exceptions: