scikit-learn-contrib/lightning

2d errors when passing pandas DataFrame/Series

simpsus opened this issue · 0 comments

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