Skip to content
This repository was archived by the owner on Dec 6, 2023. It is now read-only.

2d errors when passing pandas DataFrame/Series #149

@simpsus

Description

@simpsus

training is a pd.DataFrame
features is a list of column names

model = AdaGradRegressor()
model.fit(training[features], training['target'])
throws
~\Anaconda3\envs\numerai\lib\site-packages\lightning\impl\adagrad.py in fit(self, X, y)
130 def fit(self, X, y):
131 self.outputs_2d_ = len(y.shape) > 1
--> 132 Y = y.reshape(-1, 1) if not self.outputs_2d_ else y
133 Y = Y.astype(np.float64)
134 return self._fit(X, Y)

~\Anaconda3\envs\numerai\lib\site-packages\pandas\core\generic.py in getattr(self, name)
5137 if self._info_axis._can_hold_identifiers_and_holds_name(name):
5138 return self[name]
-> 5139 return object.getattribute(self, name)
5140
5141 def setattr(self, name: str, value) -> None:

AttributeError: 'Series' object has no attribute 'reshape'

when I pass training['target'].values it works.
My normal scikit-learn workflow is to pass the pandas objects and that never is an issue.

model.predict(training[features]) has the same issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions