Logistic Regression And Regularization

这篇具有很好参考价值的文章主要介绍了Logistic Regression And Regularization。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

Prior to it , we learn a classic regression algorithm.Now I will show you a case of another important superviser learning:Logistic regression.

Please heeding! 'Logistic regression' is not a regression though its name contains 'regression'. It is a specifical algorithm to transform the expression of binary linear regression. you can get a estimation percentage instead of unlogical regression result.Because, It belongs to classification algorithms.

Maybe this santences is also unintelligible,now let‘s to describe it step by step.

Why we don't use the linear Regression to solve Binary Regression Problems?

let’s see this situation:you are a tumor specialized doctor。In your medical living,you have token p part in operation many times and go through mang size data。From experiment,you can easily judge whether the tumor is benign or maglignant by its size。

Well,you get a binary target value graph when you put the data to a graph

(About axis: “yes or no” denotes as Y ,the size of tumor denotes as X)

Logistic Regression And Regularization,机器学习,机器学习,逻辑回归,人工智能

 In this graph,yep,we can use linear model to regress and that is no problem.

In general,we should set a threshold(communly 0.5 in this binary question).If the prediction value exceeds threshold,declares malignant。If the prediction value is less then threshold,declares benign。

So,get a linear model

Logistic Regression And Regularization,机器学习,机器学习,逻辑回归,人工智能

 When I get a newly data and perdict a result “0.7”,I can annource that this tumor is malignant......

But in fact,this tumor is benign.

This is a unlogical error ! We can say "a malignant tumor with 70% probability",but not "0.7 tumor".We want to get a more scientifical and reasonable result,not just a calm num。

Based on this,logistic regression can transform the pure number result to a estimation result。“It has 70% probability to assert this tumor is malignant。” This sentance is logical,in my view。

How to start logistic regression?

Before starting,I must tell you Logistic regression is not regression but classification algorithm.It can be regard as a specialized method what is used to logically solve binary linear regression.

In this method , we induce a specialized function called ‘sigmoid’

Logistic Regression And Regularization,机器学习,机器学习,逻辑回归,人工智能

In this situcation,z=wx+b

so,we can get   Logistic Regression And Regularization,机器学习,机器学习,逻辑回归,人工智能 and a new graph.

Logistic Regression And Regularization,机器学习,机器学习,逻辑回归,人工智能

 sigmoid function is a very useful function,the curve line is naturally divdied into two parts by the point 0 and threshold 0.5.And the output is limited in 0 to 1.

The output of this model means the probability of "yes"(denote as f(x)=p(1),you must (记住) it!)

For example, If f(x)=0.99,we can say "It has 99% probability to judge a malignant tumor".Even if the yi(real situation) ,we still consider this prediction estimation reasonably.

Loss function:

In regression , we evaluate fitting dregees in one point by error function (yi'-yi)

For logistic regression ,error function is not a suitable function to count error or loss.There is a lot of local minima that you may get stuck.

So we induce a new notion : loss Function,to evaluate the sacle of loss in one point

(Notice: In the behind, f(x) is equals to g(z))

 why we define this odd function? The answer is more reasonable

I set a example: when the real situation is "yes",but the f(x)->0

That means "We judge that it is absolutly a benign tumor,however, it is no",and Loss will pursue 1 according to  this function, signfiting this fit operation is uncorrect.If you are interested in other situations,you can draw a graph or try in open lab.

If the prediction value settles near to real result, the loss will bacome small and reasonable.

Cost Function:

In linear regression ,we use error function to accumlate a cost value.Now we change it into loss function.

As the fact, The definition of loss cost function is equals to error function

so ,we can unfold it:

Logistic Regression And Regularization,机器学习,机器学习,逻辑回归,人工智能

conventent to count? Maybe......

Gradient descend:

only need "simultaneous update"

 the scale of fit

so,there are there situation

1.Underfit: don't fit the training set wall

2.no name,no error

3.overfit:extremely well.....we don't think it is a good fitting

Logistic Regression And Regularization,机器学习,机器学习,逻辑回归,人工智能

 we focus on the 3-rd situation:

overtraining make a well but high varience。

we have three method to fix the overfit:

(1)collect more data to train a reasonable model

(2)only select main features(substract some feature)

(3)reduce the size of parameter

(3) is a usual method consist of some operation such as regularization, and penlize

 regularization, and penlize

To make a model low variance, we must reduce some parameter.

The operation of reducing is "penlize", The entire process is regularization.

 In fact,the method we used is called "L2 regularization".Its target is reducing the size of some parameter. "Penlize" is a technolegical term meaning a reduce paramter.

For example,If Iwant to reduce parameter w1,we can do this in iterating process.At the end of loss or error function,we add a item ""

Logistic Regression And Regularization,机器学习,机器学习,逻辑回归,人工智能

so in iterating function:, this make a effensive cut in w1.

But in usual,we don't know what para should be penlized,so we decide to pandize all parameters.

At the end of loss or error function,we add a item

 to maintain a proportional scale for each parameter."文章来源地址https://www.toymoban.com/news/detail-629922.html

到了这里,关于Logistic Regression And Regularization的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • 【机器学习】Classification using Logistic Regression

    导入所需的库 分类问题的例子包括:将电子邮件识别为垃圾邮件或非垃圾邮件,或者确定肿瘤是恶性还是良性。这些都是二分类的例子,其中有两种可能的结果。结果可以用 ‘positive’/‘negative’ 成对描述,如’yes’/\\\'no, ‘true’/‘false’ 或者 ‘1’/‘0’. 分类数据集的绘图

    2024年02月14日
    浏览(37)
  • 【机器学习】Cost Function for Logistic Regression

    导入所需的库 在前面的线性回归中,我们使用的是 squared error cost function,带有一个变量的squared error cost 为: J ( w , b ) = 1 2 m ∑ i = 0 m − 1 ( f w , b ( x ( i ) ) − y ( i ) ) 2 (1) J(w,b) = frac{1}{2m} sumlimits_{i = 0}^{m-1} (f_{w,b}(x^{(i)}) - y^{(i)})^2 tag{1} J ( w , b ) = 2 m 1 ​ i = 0 ∑ m − 1 ​ (

    2024年02月14日
    浏览(37)
  • 机器学习:基于逻辑回归(Logistic Regression)对股票客户流失预测分析

    作者:i阿极 作者简介:Python领域新星作者、多项比赛获奖者:博主个人首页 😊😊😊如果觉得文章不错或能帮助到你学习,可以点赞👍收藏📁评论📒+关注哦!👍👍👍 📜📜📜如果有小伙伴需要数据集和学习交流,文章下方有交流学习区!一起学习进步!💪 专栏案例:

    2023年04月26日
    浏览(52)
  • 吴恩达老师《机器学习》课后习题2之逻辑回归(logistic_regression)

    用于解决输出标签y为0或1的二元分类问题 判断邮件是否属于垃圾邮件? 银行卡交易是否属于诈骗? 肿瘤是否为良性? 等等。 案例:根据学生的两门学生成绩,建立一个逻辑回归模型,预测该学生是否会被大学录取 数据集:ex2data1.txt python实现逻辑回归, 目标:建立分类器(求

    2024年02月09日
    浏览(47)
  • 【机器学习】Feature Engineering and Polynomial Regression

    首先,导入所需的库: 线性回归模型表示为: f w , b = w 0 x 0 + w 1 x 1 + . . . + w n − 1 x n − 1 + b (1) f_{mathbf{w},b} = w_0x_0 + w_1x_1+ ... + w_{n-1}x_{n-1} + b tag{1} f w , b ​ = w 0 ​ x 0 ​ + w 1 ​ x 1 ​ + ... + w n − 1 ​ x n − 1 ​ + b ( 1 ) 思考一下,如果特征是非线性的或者是特征的结合,线

    2024年02月14日
    浏览(42)
  • 逻辑回归(Logistic Regression)

    入门小菜鸟,希望像做笔记记录自己学的东西,也希望能帮助到同样入门的人,更希望大佬们帮忙纠错啦~侵权立删。   目录 一、逻辑回归简介与用途 二、逻辑回归的理论推导 1、问题描述和转化 2、初步思路:找一个线性模型来由X预测Y 3、Sigmoid函数(逻辑函数) 4、刚刚的

    2023年04月18日
    浏览(37)
  • 逻辑回归(Logistic Regression)

    在分类问题中,你要预测的变量 y是离散的值,我们将学习一种叫做逻辑回归 (Logistic Regression) 的算法,这是目前最流行使用最广泛的一种学习算法。 在分类问题中,我们尝试预测的是结果是否属于某一个类(例如正确或错误)。分类问题的例子有:判断一封电子邮件是否是

    2024年02月09日
    浏览(36)
  • 二元逻辑回归(logistic regression)

    目录 一,原理 二,python代码 2.1 数据集的格式 2.2 代码 三,适用条件 回归 :          假设存在一些数据点,用一条直线或者曲线或折现去拟合这些点就叫做回归。也就是找出平面点上两个轴变量之间的函数关系,或者其他坐标系下的变量间关系。一句话就是:回归就是

    2024年02月06日
    浏览(51)
  • sklearn实现逻辑回归(Logistic Regression)

    💥 项目专栏:sklearn实现经典机器学习算法(附代码+原理介绍) 🌟 哈喽,亲爱的小伙伴们,你们知道吗?最近我们的粉丝群里有好多小可爱私信问我一些关于决策树、逻辑回归等机器学习的超级有趣的问题呢!🌈 为了让大家更轻松地理解,我决定开一个超可爱的专栏,叫做

    2024年02月21日
    浏览(51)
  • Python实现逻辑回归(Logistic Regression)

    💥 项目专栏:【Python实现经典机器学习算法】附代码+原理介绍 👑 最近粉丝群中很多朋友私信咨询一些决策树、逻辑回归等机器学习相关的编程问题,为了能更清晰的说明,所以建立了本专栏 专门记录基于原生Python实现一些入门必学的机器学习算法 ,帮助广大零基础用户

    2024年02月01日
    浏览(36)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包