手写字符识别神经网络项目总结

1.数据集

手写字符数据集 DIGITS,该数据集的全称为 Pen-Based Recognition of Handwritten Digits Data Set,来源于 UCI 开放数据集网站。

2.加载数据集

import numpy as np

from sklearn import datasets

digits = datasets.load_digits()

3.分割数据集

from sklearn.model_selection import train_test_split

X, y = digits.data, digits.target

X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=30)

  1. 搭建人工神经网络

from sklearn.neural_network import MLPClassifier

from sklearn.metrics import accuracy_score

def mpl():

model = MLPClassifier(hidden_layer_sizes=(100, 50), activation='relu', solver='sgd', learning_rate_init=0.02, max_iter=100, random_state=1)

model.fit(X_train, y_train)

y_pred = model.predict(X_test)

score = accuracy_score(y_test, y_pred)

return model, score

5.绘制损失变化曲线

model = mpl()[0]

plt.plot(model.loss_curve_)

相关推荐
CypressTel12 小时前
AI的“阿喀琉斯之踵”:当技术依赖成为双刃剑——赛柏特安全观察
网络·人工智能·ai
Duran.L12 小时前
从限购到畅通:GLM-5.1 Coding Plan接入攻略
人工智能·ai·软件工程·个人开发·ai编程
云烟成雨TD13 小时前
Spring AI Alibaba 1.x 系列【11】Spring AI Models 扩展:DashScope
java·人工智能·spring
技术小黑13 小时前
TensorFlow学习系列10 | 数据增强
python·深度学习·tensorflow2
港股研究社13 小时前
投在预期差:市场还没定价百融的Agent未来
人工智能
AC赳赳老秦13 小时前
OpenClaw image-processing技能实操:批量抠图、图片尺寸调整,适配办公需求
开发语言·前端·人工智能·python·深度学习·机器学习·openclaw
Agent产品评测局13 小时前
企业生产报工自动化落地,数据采集全流程实现方案 —— 2026制造业数字化转型深度选型指南
运维·人工智能·ai·chatgpt·自动化
帮我吧智能服务平台13 小时前
工业4.0下,装备制造全生命周期服务数字化落地方案(附实操案例)
网络·人工智能·制造
hqyjzsb13 小时前
深度洞察人性需求!拆解传统心理咨询升级AI智慧辅导师数智工作流
人工智能·深度学习·学习·数据挖掘·aigc·学习方法·业界资讯
Project_Observer13 小时前
为您的项目选择最合适的Zoho Projects自动化巧能
大数据·运维·人工智能·深度学习·机器学习·自动化·编辑器