python 多层感知器 sklearn.neural_network MLPClassifier.predict()函数

官方doc:

Signature: mlp.predict(X) Docstring: Predict using the multi-layer
perceptron classifier

Parameters
---------- X : {array-like, sparse matrix}, shape (n_samples, n_features)
The input data.

Returns
------- y : array-like, shape (n_samples,) or (n_samples, n_classes)
The predicted classes. File: c:\users\huawei\appdata\local\programs\python\python36\lib\site-packages\sklearn\neural_network\multilayer_perceptron.py
Type: method

如:

Z=mlp.predict(np.c_[xx.ravel(),yy.ravel()])

其中, np.c_[xx.ravel(),yy.ravel()] 的列数要跟X.train的列数一致, 否则无法predict.

你可能感兴趣的:(深入浅出,python机器学习)