机器学习面试高频问题算法原理/调参/项目经验1. 算法原理高频问题 ├── 偏差和方差的区别 │ └── 偏差模型预测与真实值的偏离方差模型对数据变化的敏感度 ├── L1 和 L2 正则化区别 │ ├── L1Lasso产生稀疏解特征选择 │ └── L2Ridge权重衰减防止过拟合 ├── 梯度下降 vs 随机梯度下降 │ ├── GD全量数据稳定但慢 │ ├── SGD单样本快但波动 │ └── Mini-batch SGD折中方案 ├── SVM 核函数作用 │ └── 将低维不可分数据映射到高维可分空间 └── 随机森林 vs XGBoost ├── RFBagging并行降低方差 └── XGBoostBoosting串行降低偏差2. 调参经验调参问题 ├── 如何处理过拟合 │ ├── 增加数据 │ ├── 正则化L1/L2/Dropout │ ├── 减少模型复杂度 │ ├── 早停法 │ └── 数据增强 ├── 如何处理欠拟合 │ ├── 增加模型复杂度 │ ├── 增加特征 │ ├── 减少正则化 │ └── 训练更久 └── 交叉验证注意什么 ├── 分层采样分类任务 ├── 时间序列用 TimeSeriesSplit └── 有分组用 GroupKFold3. 项目经验模板项目经验回答模板STAR 法则 ├── Situation业务背景和问题 ├── Task具体任务和目标 ├── Action采取的方法和步骤 └── Result最终效果和指标4. 代码手写题# 手写 K-Meansdefkmeans(X,k,max_iters100):centroidsX[np.random.choice(len(X),k,replaceFalse)]for_inrange(max_iters):distancesnp.linalg.norm(X[:,np.newaxis]-centroids,axis2)labelsnp.argmin(distances,axis1)new_centroidsnp.array([X[labelsi].mean(axis0)foriinrange(k)])ifnp.allclose(centroids,new_centroids):breakcentroidsnew_centroidsreturnlabels,centroids# 手写逻辑回归classLogisticRegression:def__init__(self,lr0.01,n_iters1000):self.lrlr self.n_itersn_itersdeffit(self,X,y):n_samples,n_featuresX.shape self.weightsnp.zeros(n_features)self.bias0for_inrange(self.n_iters):linearX self.weightsself.bias y_pred1/(1np.exp(-linear))dw(1/n_samples)*X.T (y_pred-y)db(1/n_samples)*np.sum(y_pred-y)self.weights-self.lr*dw self.bias-self.lr*dbdefpredict(self,X):linearX self.weightsself.bias y_pred1/(1np.exp(-linear))return(y_pred0.5).astype(int)总结类别高频问题原理偏差方差、正则化、梯度下降调参过拟合、欠拟合、学习率项目STAR 法则、量化指标手写K-Means、逻辑回归、决策树