# 想了解机器学习？这 3 种算法你必须要知道

2017-11-08 20:44:24 发布
 您的评价: 0
1收藏
 文件夹 请选择... ------------- 新增文件夹... 新增文件夹 标签 (多个标签用逗号分隔)

## 有监督的学习 vs. 无监督的学习

### 示例二

1 表示可能加深近视，而 0 表示不太可能。预测一个人是否会加深近视也是一个有监督学习问题，更确切地说，是分类问题。

### 线性回归

Y = a * X1 + b*X2 +c

SepalLength = a * PetalWidth + b* PetalLength +c

```# Load required packages
library(ggplot2)
data(iris)
# Have a look at the first 10 observations of the dataset
# Fit the regression line
fitted_model <- lm(Sepal.Length ~ Petal.Width + Petal.Length, data = iris)
# Get details about the parameters of the selected model
summary(fitted_model)
# Plot the data points along with the regression line
ggplot(iris, aes(x = Petal.Width, y = Petal.Length, color = Species)) +
geom_point(alpha = 6/10) +
stat_smooth(method = "lm", fill="blue", colour="grey50", size=0.5, alpha = 0.1)```

### 逻辑回归

Y=g(a*X1+b*X2)

g() 是一个对数函数。

am = g(a * mpg + b* vs +c):

```# Load required packages
library(ggplot2)
data(mtcars)
# Keep a subset of the data features that includes on the measurement we are interested in
cars <- subset(mtcars, select=c(mpg, am, vs))
# Fit the logistic regression line
fitted_model <- glm(am ~ mpg+vs, data=cars, family=binomial(link="logit"))
# Plot the results
ggplot(cars, aes(x=mpg, y=vs, colour = am)) + geom_point(alpha = 6/10) +
stat_smooth(method="glm",fill="blue", colour="grey50", size=0.5, alpha = 0.1, method.args=list(family="binomial"))```

## 扩展阅读

8个经过证实的方法：提高机器学习模型的准确率

SVM-支持向量机算法概述

## 更多

### 阅读目录

 相关文档 　—　更多 相关经验 　—　更多 相关讨论 　—　更多