While using AutoML from EvalML getting error AttributeError: 'DataTable' object has no attribute 'to_series'

Viewed 368

I am running eval.automl on a data, made a class column as below:

df.loc[(df.quality<6), 'flag_class'] = 1
df.loc[(df.quality==6), 'flag_class'] = 2
df.loc[(df.quality>6), 'flag_class'] = 3

then splitting it as below:

X = df[['several columns inside']].copy() y = df[['flag_class']].copy()

but when running below code getting error:

X_train, X_holdout, y_train, y_holdout = evalml.preprocessing.split_data(X, y, problem_type = 'multiclass')

error:


AttributeError                            Traceback (most recent call last)
<ipython-input-37-dffcb1214932> in <module>
----> 1 X_train, X_holdout, y_train, y_holdout = evalml.preprocessing.split_data(X, y, problem_type = 'multiclass')

~\AppData\Roaming\Python\Python38\site-packages\evalml\preprocessing\utils.py in split_data(X, y, 
problem_type, problem_configuration, test_size, random_seed)
     75         data_splitter = StratifiedShuffleSplit(n_splits=1, test_size=test_size, random_state=random_seed)
     76 
---> 77     train, test = next(data_splitter.split(X.to_dataframe(), y.to_series()))
     78 
     79     X_train = X.iloc[train]

AttributeError: 'DataTable' object has no attribute 'to_series'

Any support will be highly appreciated, Thanks in advance

2 Answers

DataTable is a class from the woodwork framework. The framework is build on top of pandas Dataframe.

enter image description heredumie =y type(dumie) y_train=dumie.squeeze() type(y_train)

Explanation: For dependent feature(y) should be series format DataTable can't convert it so First convert Y in to series by using squeeze X should be in DataFrame format and Y should be series format

Related