AttributeError: type object 'MinimalFeatureExtractionSettings' has no attribute 'n_processes'

481 Views Asked by At

I'm trying to extract features using tsfresh package and extract_features() function.

tsfresh Version: 0.4.0.post0.dev1+ng19fa136

However, I get the following error:

AttributeError: type object 'MinimalFeatureExtractionSettings' has no attribute 'n_processes'

Code:

import numpy as np
import pandas as pd

column_names = ['time_series1', 'time_series2','time_series3']
ts = np.random.rand(6,3)


df_to_extract = pd.DataFrame(data=ts, columns = column_names)

df_to_extract['id'] = 1
df_to_extract['time'] = np.arange(1,7)

#print(df_to_extract)

import tsfresh
from tsfresh import extract_features
from tsfresh import select_features
from tsfresh.utilities.dataframe_functions import impute
from tsfresh import extract_relevant_features
from tsfresh.feature_extraction import extract_features, MinimalFeatureExtractionSettings
from tsfresh.feature_extraction.settings import *
from tsfresh.feature_extraction.settings import FeatureExtractionSettings
import tsfresh.feature_extraction.settings
from tsfresh import utilities
from tsfresh import feature_extraction


extracted_features = extract_features(df_to_extract, 
                                      column_id="id", 
                                      column_sort="time", 
                                      parallelization= 'per_kind', 
                                      feature_extraction_settings= MinimalFeatureExtractionSettings)

Package source code: https://github.com/blue-yonder/tsfresh/blob/master/tsfresh/feature_extraction/extraction.py

I'm using Python 3.5 (Anaconda) on Win10.

I suppose it could be some kind of import error. How to solve that issue?


Problem solved

To make it work add:

settings= MinimalFeatureExtractionSettings()

extracted_features = extract_features(df_to_extract, 
                                      column_id="id", 
                                      column_sort="time", 
                                      parallelization= 'per_kind', 
                                      feature_extraction_settings= settings)
1

There are 1 best solutions below

0
On

There is no MinimalFeatureExtractionSettings object anymore. It is called MinimalFCParameters now. Thus, you would have to write the following code:

from tsfresh.feature_extraction import extract_features, MinimalFCParameters
...
minimalFCParametersForTsFresh = MinimalFCParameters()
extracted_features = extract_features(df_to_extract,column_id="id",default_fc_parameters = minimalFCParametersForTsFresh)