使用逻辑回归识别手写数字

人工智能研讨会—第二部分 (AI Workshop — Part II)

In the second part of the workshop, we learnt about Classification, also called Logistic Regression that also comes under Supervised Machine Learning. The first part of the workshop focussed on Linear Regression.

在研讨会的第二部分中,我们了解了分类(也称为逻辑回归),该分类也属于监督机器学习。 研讨会的第一部分集中于线性回归

Both regression and classification predict the output. Regression predicts the output in a continuous numerical range. Classification predicts the output in a discrete range. For example, predicting the temperature at a place based on weather report data is a regression problem. Whereas, predicting if the day’s weather comes under ‘Sunny’, ‘Cold’, ‘Windy’ or ‘Rainy’ categories is a Classification problem.

回归和分类都可以预测输出。 回归可预测连续数值范围内的输出。 分类可预测离散范围内的输出。 例如,基于天气报告数据预测某个地方的温度是一个回归问题。 然而,预测一天的天气是否属于“晴天”,“寒冷”,“有风”或“多雨”类别属于分类问题。

Here, we learnt to imply logistic regression to recognise a hand-written numerical character (of pixel size 28X28)and classify them to the corresponding number (1, 2, 3, 4).

在这里,我们学习了逻辑回归以识别手写数字字符(像素大小为28X28)并将其分类为相应的数字(1、2、3、4)。

1. Reading the data

1.读取数据

m number of data samples were used for the prediction model where each data sample is an image of pixel size 28X28 and each image is a hand-written number of white colour (pixel value = 255) on a black background (pixel value = 0). Here, m=3599. The array for each image comprises of the number (that has been written on the image) followed by pixel values of the image, i.e, it had 784+1 elements (1st element is the number written on the image, followed by the 28X28=784 pixel values of the image). The raw data is a matrix (3599 rows, 785 columns) read from a CSV file that comprised of pixel values for each image.

m个数据样本用于预测模型,其中每个数据样本是像素大小为28X28的图像,每个图像是黑色背景(像素值= 0)上的手写数量的白色(像素值= 255) 。 在这里, m = 3599。 每个图像的数组由数字(已写在图像上)后跟该图像的像素值组成,即它具有784 + 1个元素(第一个元素是写在图像上的数字,后跟28X28 =图片的784个像素值)。 原始数据是一个从CSV文件读取的矩阵(3599行,785列),该矩阵包含每个图像的像素值。

2. Separating input (X) and output (Y)

2.分离输入(X)和输出(Y)

The first column was extracted as the expected output (Y) and the rest of the array elements (corresponding pixel values) were extracted as the input (X) used

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值