mnist手写数字识别(SVM)
import numpy as np
from sklearn.neural_network import MLPClassifier
from sklearn.linear_model import LogisticRegression
from sklearn.tree import DecisionTreeClassifier
from sklearn.model_selection import KFold
from sklearn.metrics import roc_auc_score
from sklearn.svm import LinearSVC path = 'mnist.npz'
f = np.load(path) X_train , y_train = f['x_train'], f['y_train']
X_test , y_test = f['x_test'], f['y_test'] X_train = X_train.astype('float32')
X_test = X_test.astype('float32') X_train /= 255.
X_test /= 255. X_train = X_train.reshape(60000,784)
X_test = X_test.reshape(10000,784) lsvc = LinearSVC()
lsvc.fit(X_train,y_train)
y_pred = lsvc.predict(X_test) sum=0.0
for i in range(10000):
if(y_pred[i] == y_test[i]):
sum = sum+1 print('Test set score: %f' % (sum/10000.)) # Test set score: 0.917900
mnist手写数字识别(SVM)的更多相关文章
- Android+TensorFlow+CNN+MNIST 手写数字识别实现
Android+TensorFlow+CNN+MNIST 手写数字识别实现 SkySeraph 2018 Email:skyseraph00#163.com 更多精彩请直接访问SkySeraph个人站 ...
- 深度学习之 mnist 手写数字识别
深度学习之 mnist 手写数字识别 开始学习深度学习,先来一个手写数字的程序 import numpy as np import os import codecs import torch from ...
- 基于tensorflow的MNIST手写数字识别(二)--入门篇
http://www.jianshu.com/p/4195577585e6 基于tensorflow的MNIST手写字识别(一)--白话卷积神经网络模型 基于tensorflow的MNIST手写数字识 ...
- 第三节,CNN案例-mnist手写数字识别
卷积:神经网络不再是对每个像素做处理,而是对一小块区域的处理,这种做法加强了图像信息的连续性,使得神经网络看到的是一个图像,而非一个点,同时也加深了神经网络对图像的理解,卷积神经网络有一个批量过滤器, ...
- mnist 手写数字识别
mnist 手写数字识别三大步骤 1.定义分类模型2.训练模型3.评价模型 import tensorflow as tfimport input_datamnist = input_data.rea ...
- 持久化的基于L2正则化和平均滑动模型的MNIST手写数字识别模型
持久化的基于L2正则化和平均滑动模型的MNIST手写数字识别模型 觉得有用的话,欢迎一起讨论相互学习~Follow Me 参考文献Tensorflow实战Google深度学习框架 实验平台: Tens ...
- 用MXnet实战深度学习之一:安装GPU版mxnet并跑一个MNIST手写数字识别
用MXnet实战深度学习之一:安装GPU版mxnet并跑一个MNIST手写数字识别 http://phunter.farbox.com/post/mxnet-tutorial1 用MXnet实战深度学 ...
- Tensorflow之MNIST手写数字识别:分类问题(1)
一.MNIST数据集读取 one hot 独热编码独热编码是一种稀疏向量,其中:一个向量设为1,其他元素均设为0.独热编码常用于表示拥有有限个可能值的字符串或标识符优点: 1.将离散特征的取值扩展 ...
- TensorFlow——MNIST手写数字识别
MNIST手写数字识别 MNIST数据集介绍和下载:http://yann.lecun.com/exdb/mnist/ 一.数据集介绍: MNIST是一个入门级的计算机视觉数据集 下载下来的数据集 ...
随机推荐
- Hello World ! 第一篇随笔
Hello World ! 第一篇随笔 /* * Language: C++ * Code Name: Hello World ! * @author Metak */ #include <io ...
- 用windows自带的fsutil修改稀疏文件大小成功,但文件内容似乎丢失
fsutil sparse setflag. fsutil sparse setrange 10M对应字节,1G对应字节.. 看文件属性,实际尺寸是小了,但内容似乎也丢了..因为自己把该文件做成虚拟盘 ...
- 51nod 1444 破坏道路(bfs+枚举)
1444 破坏道路 题目来源: CodeForces 基准时间限制:1.5 秒 空间限制:131072 KB 分值: 80 难度:5级算法题 收藏 关注 在某一个国家,那儿有n个城市,他们通过m条双向 ...
- easyui 对form扩展
功能描述 easyui 中 combobox 多选赋值方法如下: $('#cbx').combobox('setValues', ['01','02']) 然而,业务中是以 “01,02” 的形式 ...
- mongodb的学习-2-简介
http://www.runoob.com/mongodb/mongodb-intro.html 什么是MongoDB ? MongoDB 是由C++语言编写的,是一个基于分布式文件存储的开源数据库系 ...
- Python:基础知识(一)
输入 input():接收命令行下输入 1)在py2下:如果你输的是一串文字,要用引号''或者""引起来,如果是数字则不用. 2)在py3下:相当于py2的raw_input(), ...
- sudo 其他用户执行命令
sudo -E -u clouder /home/clouder/vs/program/chatserver/bin/startup.sh -E 加载用户环境变量
- 文本处理三剑客之 awk
GAWK:报告生成器,格式化文本输出 awk [options] ‘program’ var=value file… awk [options] -f programfile var=value fi ...
- python3爬虫-通过selenium登陆拉钩,爬取职位信息
from selenium import webdriver from selenium.common.exceptions import NoSuchElementException from se ...
- python 3.x 实现简单用户登录
import os import sys import getpass login_username = 'admin' login_password = ' u = 0 while u < 3 ...