'AttributeError: 'numpy.ndarray' object has no attribute 'target
I get the error an "AttributeError: 'numpy.ndarray' object has no attribute 'target'" when executing the grid.fit() command. I am not sure what this means and how to fix it. Can anybody advise?
#Grid Search Parameter Tuning
import numpy as np
from sklearn import datasets
from sklearn.linear_model import Ridge
from sklearn.model_selection import GridSearchCV
# datasets
dataset = np.random.rand(1000,2)
#Ridge regression
alphas = np.array([1,0.1,0.01,0.001,0.0001,0])
model = Ridge()
grid = GridSearchCV(estimator=model, param_grid=dict(alpha=alphas))
grid.fit(dataset.data, dataset.target)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
