[python]代码库
import pandas as pd
import numpy as np
from sklearn.datasets import load_digits
from sklearn.model_selection import train_test_split
from sklearn.neural_network import MLPClassifier
digits = load_digits()
X = digits.data
y = digits.target
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3, random_state=1)
mlp = MLPClassifier(hidden_layer_sizes=(100, 100), max_iter=500)
mlp.fit(X_train, y_train)
print("预测结果:", mlp.predict(X_test))
print("准确率:", mlp.score(X_test, y_test))