机器学习(Machine Learning)心得体会(2)逻辑回归Exercise 2:Logistic Regression

    本文是观看斯坦福大学吴恩达老师的机器学习视频后的一些心得体会和总结,以及作业题中的关键代码,大家可以共同讨论进步。

    之前的线形回归是对结果为连续量的数据集做出一个拟合,比如拟合出一条直线,而逻辑回归是要对结果为离散量的数据集能够产生一个预测机制,比如输出为0或者1,这就是一个离散量的输出,不管输入何值,输出必然是0或者是1,所以,逻辑回归要做的事情就是预测结果是0还是1,进一步说,就是做一个分类器。

    作业中,我们有这样一个数据集,输入为X1,X2,而输出则是0或是1,我们可以运用如下代码,画出更为直观的图像。

% Find Indices of Positive and Negative Examples
pos = find(y==1); neg = find(y == 0);
% Plot Examples
plot(X(pos, 1), X(pos, 2), 'k+','LineWidth', 2, ...
'MarkerSize', 7);
plot(X(neg, 1), X(neg, 2), 'ko', 'MarkerFaceColor', 'y', ...
'MarkerSize', 7);
plotData.m中我们要写的代码

我们得到的图像

    线性回归中,h=X*theta',但是对于我们逻辑回归,由于输出是离散的,所以继续套用这个公式,很明显得到的输出值不是我们想要的,于是我们引入了一个函数sigmoid(z)=1/(1+exp(-z)),我们令z=X*theta‘,则h=sigmoid(X*theta')。由于sigmoid函数大于0小于1,以(0,0.5)中心对称,当h大于0.5时࿰

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Key Features, Put machine learning principles into practice to solve real-world problemsGet to grips with Python's impressive range of Machine Learning libraries and frameworksFrom retrieving data from APIs to cleaning and visualization, become more confident at tackling every stage of the data pipeline, Book Description, Machine Learning is transforming the way we understand and interact with the world around us. But how much do you really understand it? How confident are you interacting with the tools and models that drive it?, Python Machine Learning Blueprints puts your skills and knowledge to the test, guiding you through the development of some awesome machine learning applications and algorithms with real-world examples that demonstrate how to put concepts into practice., You’ll learn how to use cluster techniques to discover bargain air fares, and apply linear regression to find yourself a cheap apartment – and much more. Everything you learn is backed by a real-world example, whether its data manipulation or statistical modelling., That way you’re never left floundering in theory – you’ll be simply collecting and analyzing data in a way that makes a real impact., What you will learn, Explore and use Python's impressive machine learning ecosystemSuccessfully evaluate and apply the most effective models to problemsLearn the fundamentals of NLP - and put them into practiceVisualize data for maximum impact and clarityDeploy machine learning models using third party APIsGet to grips with feature engineering, About the Author, Alexander T. Combs is an experienced data scientist, strategist, and developer with a background in financial data extraction, natural language processing and generation, and quantitative and statistical modeling. He is currently a full-time lead instructor for a data science immersive program in New York City., Table of Contents, The Python Machine Learning EcosystemBuild an App to Find Underpriced ApartmentsBuild an App to Find Cheap AirfaresForecast the IPO Market using Logistic RegressionCreate a Custom NewsfeedPredict whether Your Content Will Go ViralForecast the Stock Market with Machine LearningBuild an Image Similarity EngineBuild a ChatbotBuild a Recommendation Engine

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值