aimclub / FEDOT

Automated modeling and machine learning framework FEDOT
https://fedot.readthedocs.io
BSD 3-Clause "New" or "Revised" License
627 stars 86 forks source link

Error when forecasting a dumb time series #1095

Closed gabrielefantini closed 11 months ago

gabrielefantini commented 1 year ago

Hi, I'm trying the auto forecasting feature. I've already tried it on complex datasets and it works great! Now I'm struggling using a dumb dataset.

Here is my code:

task= Task(TaskTypesEnum.ts_forecasting, TsForecastingParams(forecast_length=2))

fedot_model = Fedot(problem='ts_forecasting', task_params=task.task_params)

input_data = InputData(idx=np.arange(0, 10),
                       features=np.array([0,0,0,0,0,0,0,0,1,1]),
                       target=np.array([0,0,0,0,0,0,0,0,1,1]),
                       task=task,
                       data_type=DataTypesEnum.ts)

train_input, validation_input = train_test_data_setup(input_data)

pipeline = fedot_model.fit(train_input)

Why it gives me the following error? " statsmodels.tools.sm_exceptions.PerfectSeparationError: Perfect separation detected, results not available"

Thanks you in advance, Gabriele.

valer1435 commented 1 year ago

Hello. Thanks for your attention to the framework. It's actually problem with statsmodels and we can't easily solve it.

I can to propose this solution. It looks more complicated but actually I removed glm operation from list of models and choose assumption without glm node

operations = OperationTypesRepository(operation_type='all').suitable_operation(TaskTypesEnum.ts_forecasting).remove(
    'glm')

task = Task(TaskTypesEnum.ts_forecasting, TsForecastingParams(forecast_length=2))

fedot_model = Fedot(problem='ts_forecasting', task_params=task.task_params, timeout=1,
                    available_operations=operations,
                    initial_assumption=PipelineBuilder().add_node('lagged').add_node('ridge').build())

input_data = InputData(idx=np.arange(0, 10),
                       features=np.array([1, 2, 3, 4, 5, 6, 7, 8, 8, 10]),
                       target=np.array([1, 2, 3, 4, 5, 6, 7, 8, 8, 10]),
                       task=task,
                       data_type=DataTypesEnum.ts)

train_input, validation_input = train_test_data_setup(input_data)

pipeline = fedot_model.fit(train_input)
gabrielefantini commented 1 year ago

Thanks a lot!

kasyanovse commented 11 months ago

Partly solved (https://github.com/aimclub/FEDOT/pull/1153), partly depends on thrid-party libs.