通行证
- 积分
- 604
- 大米
- 颗
- 鳄梨
- 个
- 水井
- 尺
- 蓝莓
- 颗
- 萝卜
- 根
- 小米
- 粒
- 学分
- 个
- 注册时间
- 2013-10-14
- 最后登录
- 1970-1-1
|
这周看完了Stanford 课程,上网刷了些常见题目,mL就先到这里了。下周开始投简历,做kaggle,为take home练手写模板。.1point3acres
ML剩余部分总结:
lasso path: 逐渐加大regularize parameter,训练模型,看什么时候feature开始起作用 ..
Binary classification有两类model:1. 直接output分类(KNN, decision tree),2. Output score(margin-SVM, probability-logistic regression, neural network).需要确定分类标准.
rank view, 对error analysis有用,从最高的negative 或最低的positive sample开始。prevalance = ,决定class imbalance. 如果太多sample,就用class-wise histogram-baidu 1point3acres
Confusion matrix. False Positive = Type 1 error, True Negative = Type 2 error. Accuracy = 多少比例预测正确。Precision(Positive Prediction Value, PPV) = quality of Positive prediction. Recall(sensitivity) = what fraction of positive is picked out. Negative Recall (Specificity) = what fraction of negatives is picked out? F1 score = Harmonic mean of Precision and Recall. G score = Geometric mean of Precision and Recall. Precision和specificity有一点正相关,sensitivity和specificity负相关,precision和recall负相关。ROC curve是y=specificity和x=sensitivity的曲线,AUC(area under curve)= C-statistics(concordance score)表明rank score的好坏。对角线为随机猜。Precision recall curve. Area under PRC = Average Precision, the expected precision by randomly picking threshold.
. 1point 3 acres
Log-loss = p(x)*y + (1-p(x))*(1-y), rewards confident correct predictions and heavily penalizes confident wrong predictions.
If prevalence <5%, high imbalanced. 选择metrics的好坏Accuracy << AUROC << AUPRC。对search engine results, grammar correction等问题,重视FP,要保持高precision同事optimize recall。对medical test,重视FN,要保持高recall,optimize precision。
Multi-class. Confusion matrix is NxN,除了accurcy,大多数metrics都是 1 vs many。Imbalance很常见
high variance fix: 获得更多数据,加feature,
high bias fix: 减feature, email header feature。
optimization algo有问题: GD多跑几遍iteration,用不同方法,SGD,GD,Newton。。。optimization objective fix: hyper-parameter,用不同的regularizer, 用不同的model
如果test error太大, 如果train error= test error ,需要加feature;如果train error < test error, overfitting. 需要Regularize, 用simple model。如果trainer error来回摇摆巨大, you optimization algorithm需要改进.1point3acres
k-means 保证会converge,但可能会到local optima。可以用不同的initial values跑k-means很多次,选最终结果k-mean最小的。
k-means初始值 uniformly chosen, 没效率,K-means++ 改进了初始值选取, O(log k). check 1point3acres for more.
1a. Take one centerc1, chosen uniformly at random from X.
1b. Take a new center ci, choosing x∈X with probability D(x)2Px∈XD(x)
2.1c. Repeat Step 1b. until we have taken k centers altogether.
2-4. Proceed as with the standard k-means algorithm.. 1point 3 acres
Mixture of Gaussians用来做clustering. 假设z为某一cluster的中心,z~Multinomial(φ) (φj是z为第j个cluster的中心的概率),对每一个sample x(i), 都在某个cluster里,都有对应的z(i), 假设(x(i)|z(i)=j)~ N(μj,Σj).这里z是假设的unobeserved变量。可以用EM/ Estimation-Maximization求, E-step soft guess z,M-step根据猜的z求parameter的最优解。和K-means很像,也保证converge,也可能陷入local optima,需要多试几个初始值,但EM不做hard cluster assignment,而用soft guess wj,只求分到某个cluster的概率 .--
repeat until converge
Principal Component Analysis, 要先标准化,然后投影到某vector,u上而使variation基本不变/尽可能大,因为已经过标准化,就是要x在u上投影离远点尽量远,距离为xTu.就是要maximize ,就是covariance matrix。所以选取Σ的top k eigenvalue为u1,u2…uk即可,就是principal component.PCA有助于数据可视化;在train model前做PCA可以降低计算量,并且减少overfitting;还可以减少noise
. check 1point3acres for more.
Esemble model的好处:Averaging out biases. Reducing the variance. Avoiding overfitting.
. Waral dи,
Reinforcement learning 不给正确与否,而是给reward function,好的就reward,bad就punish。应用:autonomous helicopter flight, robot legged locomotion, cell-phone networkrouting, marketing strategy selection, factory control, and efficient web-page indexing.. check 1point3acres for more.
Markov decision processes (MDP)
Entropy描述混乱程度,在decision tree中测量分类impurity的程度。Information gain = Entropy(x) — ([weighted average] * entropy(children for feature)), 每次分类按能使information gain 最大的feature 来分类。Gini impurity 是指stop division when we have x number of fewer number of elements left
Decision tree parameter tuning: minimum sample split(某一组数据量小于这个值则不再继续分类);criterion(分类标准是gini还是entropy)
KNN 有三种方法计算距离,1.直接算O[DN2],2. K-D Tree,如果A离B很远,B离C很近,那么不计算也知道A离C很远 O[D N *log(N)],3. Ball Tree, 假设data在高维空间并建立nested hyper sphere. O[Dlog(N)]. 数据量小dimention小,直接算。对小dimention高分散型数据,KD tree比ball tree好。大dimention大数据量用ball tree。
KNN parameters:n_neighbors, algorithm({‘auto’, ‘ball_tree’, ‘kd_tree’, ‘brute’})
Random Forest 取majority vote,也可以根据每个树的error rate加权求majority vote,error小的权大。
RF parameters:n_estimators(tree的数量),criterion(decision tree的algorithm),min_sample_split (每组数据量达到多小时不再继续分类)
Adaboost 每次取不同的training dataset来训练,根据每个model的accuracy加权求最终结果。选Training dataset不是random,上一个model中misclassified data points会获得更大的权重,更可能被选上。如果accuracy为50%,Model的权重是0,如果小于50%,权重为负。. 1point 3acres
|
|