Subscribe to DSC Newsletter

ValueError: Unknown label type: 'continuous-multioutput'

Hi all,

I'm receiving continous-multioutput error after "knn.fit(T_pca_train_transformed, T_prep_train_transformed)"

codes executed are below:

data_train, data_test, = train_test_split(X,test_size=0.33, random_state=1)
scaled_train = preprocessing.Normalizer().fit(data_train)
T_prep_train_transformed=scaled_train.transform(data_train)
pca_train = PCA(n_components=2, svd_solver='full')
pca_train.fit(data_train)
PCA(copy=True, n_components=2, whiten=False)
T_pca_train_transformed = pca_train.transform(data_train)
knn = KNeighborsClassifier(n_neighbors=9)
knn.fit(T_pca_train_transformed, T_prep_train_transformed)

then receiving error message below:

ValueError Traceback (most recent call last)
<ipython-input-134-3f7daa6c3d6e> in <module>()
----> 1 knn.fit(T_pca_train_transformed, T_prep_train_transformed)

C:\Users\merta\Anaconda2\lib\site-packages\sklearn\neighbors\base.pyc in fit(self, X, y)
773 self.outputs_2d_ = True
774
--> 775 check_classification_targets(y)
776 self.classes_ = []
777 self._y = np.empty(y.shape, dtype=np.int)

C:\Users\merta\Anaconda2\lib\site-packages\sklearn\utils\multiclass.pyc in check_classification_targets(y)
170 if y_type not in ['binary', 'multiclass', 'multiclass-multioutput',
171 'multilabel-indicator', 'multilabel-sequences']:
--> 172 raise ValueError("Unknown label type: %r" % y_type)
173
174

ValueError: Unknown label type: 'continuous-multioutput'

transformed datasets are below:


T_prep_train_transformed
Out[135]:
array([[ 0.99044302, 0.08415397, 0.09068954, ..., 0.01999078,
0.02978741, 0.03370201],
[ 0.9433737 , 0.22907049, 0.19943888, ..., 0.04401201,
0.06124672, 0.07694543],
[ 0.97403879, 0.15942601, 0.13694819, ..., 0.03176032,
0.02567466, 0.05149085],
...,
[ 0.94273631, 0.22599484, 0.2059617 , ..., 0.04705825,
0.05943167, 0.07582481],
[ 0.98843204, 0.09227719, 0.09827839, ..., 0.02113833,
0.03744745, 0.03808993],
[ 0.83057322, 0.38341056, 0.34524908, ..., 0.08267571,
0.06635607, 0.12310442]])

T_pca_train_transformed
Out[136]:
array([[ -4.22715312e+01, -2.02913970e+00, 2.62153356e-01, ...,
-2.41164325e-03, -1.66045779e-03, -1.90054774e-03],
[ 2.68354661e+01, 4.12313589e+00, 1.68619981e+00, ...,
-1.48520987e-02, 2.23607749e-02, 8.20687488e-04],
[ -1.21254421e+01, 4.90534470e+00, -8.45953873e-01, ...,
-6.12080616e-02, -1.92848014e-02, 4.72184376e-03],
...,
[ 3.28060454e+01, 2.05119427e+00, 1.26662150e+00, ...,
4.75754922e-02, -2.37633446e-02, -7.18895971e-04],
[ -3.52713772e+01, -1.34464260e+00, 1.23118568e+00, ...,
9.84397803e-02, -1.83434716e-02, -3.63971982e-03],
[ 6.78122035e+01, 1.03145164e+00, 1.58908160e-01, ...,
-1.47794148e-01, -4.31462036e-02, 1.86507993e-03]])

Will be appreciated for any help.

Regards,

Views: 115

Reply to This

Follow Us

Videos

  • Add Videos
  • View All

Resources

© 2017   Data Science Central   Powered by

Badges  |  Report an Issue  |  Privacy Policy  |  Terms of Service