Machine Learning by Andrew Ng --- Logistic Regression of Multi-class Classification

本文介绍了一种使用逻辑回归算法进行手写数字1到10识别的方法。通过加载并绘制数据集,实现向量化正则化的逻辑回归,并预测数据集中的数字。文章详细解释了如何通过最大概率确定最终预测结果。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

We will use Logistic Regression to recognize the number 1-10.


Loading data,Plotting data.as the picture below:




Vectorizing regularized logistic regression




Then learn the theta:


Predicting:



It is important to understand the final max function ,if you make your data which you want to predict by rows, then you should remember ,like the max function in the picture above ,when finished sigmoid function inside of max function,the result matrix owns ten columns ,which means that every column shows the probability of your data witch you want to predict might be .i.e.the second column show the probability of your data might be 1(note: the first column represent 10). 


After get the result Matrix,the max function return the biggest number of each row ,also say the biggest probabilities.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值