查看: 3116| 回复: 3
跳转到指定楼层
上一主题 下一主题
收起左侧

[统计--就业] 求大米--ML学习总结(大多是Andrew Ng课的内容)

全局:

注册一亩三分地论坛,查看更多干货!

您需要 登录 才可以下载或查看附件。没有帐号?注册账号

x
Machine Learning:Computer learns from experience E task T and performance P; If P improves with E in task T
I.        Linear Regression
1.        Cost Function. .и
Sum of square error
Optimization method: gradient descent, repeat until it converges.. 1point3acres.com
It’s a convex function, local min value is global min value
Choose learning rate: too small, converge too slow; too large, it may not converge
Feature scaling can help converge faster. check 1point3acres for more.
2.        L1 norm: absolute error – unstable solution, may have multiple solutions, built-in feature selection
L2 norm: square error – stable solution; has analytical solution
3.        Assumption
1)        Linearity; Check: scatter /residual plot; solution: Exponential/log transform
2)        Constant variance for error; Check: residual plot; solution: log transform
3)        No autocorrelation; Check: residual plot against time; solution: time series . 1point 3 acres
4)        No multicollinearity; Check: correlation matrix(heatmap);solution: combine/PCA . Χ
II.        Logistic regression
1.        Function
H(x) = g(ΘX)
g(z) = 1/(1+e^(-z))                 
g(z) Graph:  
2.        Decision boundary. .и
Define y=1 if H(x)>0.5/z>0 and y=0 if H(x)<0.5/z<0
Decision boundary is 0.5
3.        Cost function
Can’t use same cost function as linear regression; it’s not convex for logistic regression, it has multiple local minimums; hard to find the global minimum
-y*log(h(x)) – (1-y)*log(1-h(x))
Use maximum likelihood estimate to optimize the cost function
MLE:
Find the parameter by maximizing the likelihood to make the observations.
4.        Confusion matrix
Table to measure results from logistic regression.
1)        Accuracy
(TP + TN)/Total #
Not good for imbalance data-baidu 1point3acres
2)        Type I error: FP; P-value is probability of type I error: probability of rejecting the null hypothesis while the null is actually true
Type II error: FN
3)        Precision: TP/(FP + TP); Positive relation with threshold. .и
Recall: TP/(TP+FN); Negative relation with threshold. 1point3acres.com
We care about precision or recall for different test;
Eg: for cancer detection, we care more about recall rate, we don’t want to tell the patient that he doesn’t have cancer but actually he has cancer.
F score: 2*Precision*Recall/(Precision+Recall)
4)        TP rate (Power/1-TypeII error): TP/(TP+FN)
FP rate(TypeI error): FP/(FP+TN).google  и
ROC AUC: . ----
plotting TPR against the FPR at various threshold settings, find the curve maximize the AUC (area under curve). ----
III.        Bias(underfit) & variance(overfit)
1.        Fix variance
1)        Try fewer parameters
Introduce regularization parameter in cost function.google  и
Ridge: sum of square of parameters;  Reduce the magnitude of parameters
Lasso: sum of absolute of parameters; can remove parameters. check 1point3acres for more.
2)        Increase λ in regularization . 1point 3 acres
3)        Increase training examples
4)        Early stop for tree based model. Waral dи,
2.        Fix bias.1point3acres
1)        Increase model complexity: add more parameter, try polynomial features
2)        Decrease λ in regularization
IV.        SVM (support vector machine)
1.        Find a hyperplane/gap that separates the classes by maximizing the margin
2.        Use kernel for non-linear: transfer data into another dimension that has a clear margin between classes
3.        SVM V.S. Logistic regression
SVM maximize the margin, LR maximize the likelihood function
SVM predict 0/1, LR predict a probability
V.        Unsupervised learning
1.        Clustering (K-means)
The process to find K clusters
1)        Randomly pick K cluster centroids-baidu 1point3acres
2)        Index each data to the closest cluster centroids
3)        Reassign cluster centroids as the average of each cluster
4)        Repeat 2) and 3) until the clusters centroids don’t change. From 1point 3acres bbs
May reach local optimal if the initial K cluster centroids chosen not good. Waral dи,
Use “Elbow method” to pick the best number of clusters
2.        PCA (Principal component analysis)
Reduce the parameter dimension; project n-dimension to k-dimension; will lose information during the process
3.        Anomaly detection
Assume all features following normal distribution
Anomaly detection V.S. surprised learning
Anomaly detection if unlabeled data, future anomaly data look nothing like current anomaly data;
Surprised learning if large # of data; enough historical anomaly data and covers most cases
VI.        Other Algorithm
1.        Naïve Bayes-baidu 1point3acres
Assumption: X are independent of each other for the given Y
2.        Tree-based Method
1)        Construct tree: top-down/greedy approach; at each step, minimize the RSS error rate; stop until criteria meet(eg: # of observation, node)
2)        It will grow a big tree, possible overfit issue; Solution: select subset tree using cross-validation
3)        Easy to explain BUT non-robust, overfitting issue: small data change leads to model change
3.        Random Forest. .и
Fix the overfitting issue with basic tree method. 1point 3acres
Randomly with replacement pick data, instead of using all features, randomly use square root features at each step; Average results of all trees
4.        Boosting
Each tree is fit on a modified version of the previous tree;
STEPS:. Χ
Randomly with replacement pick data, build a model, validate on the data and calculate the RSS error rate; for the next tree, put higher weight for the data with higher error in previous model.
To avoid overfitting: don’t construct too many trees, use small learning rate, use small node(less complex tree) ..

评分

参与人数 5大米 +7 收起 理由
pixie1994 + 1 赞一个
amebapu + 1 赞一个
qianmeilala + 1 给你点个赞!
Irisayhi + 3 给你点个赞!
zhangEpiphany + 1 赞一个

查看全部评分


上一篇:科罗拉多州立大学
下一篇:C3 笔试挂经
🔗
漾yang 2019-5-20 11:45:52 | 只看该作者
本楼:
全局:
多谢
回复

使用道具 举报

🔗
statwang 2019-9-20 23:56:47 | 只看该作者
全局:
好棒的总结
回复

使用道具 举报

🔗
梦想家510 2020-3-12 12:47:35 | 只看该作者
全局:
谢谢总结,很棒!
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册账号
隐私提醒:
  • ☑ 禁止发布广告,拉群,贴个人联系方式:找人请去🔗同学同事飞友,拉群请去🔗拉群结伴,广告请去🔗跳蚤市场,和 🔗租房广告|找室友
  • ☑ 论坛内容在发帖 30 分钟内可以编辑,过后则不能删帖。为防止被骚扰甚至人肉,不要公开留微信等联系方式,如有需求请以论坛私信方式发送。
  • ☑ 干货版块可免费使用 🔗超级匿名:面经(美国面经、中国面经、数科面经、PM面经),抖包袱(美国、中国)和录取汇报、定位选校版
  • ☑ 查阅全站 🔗各种匿名方法

本版积分规则

>
快速回复 返回顶部 返回列表