考试时间:5/30 09:00 | 总分100分 | 6个模块随机抽题
right=False 左闭右开().mean() .agg(['count','mean']) .apply(lambda)data['Age'].between(18, 70)pd.cut(['BMI'], ...) 应为 pd.cut(data['BMI'], ...);
data.['col'] 应为 data['col'];
value_counts 漏写括号;
data.isnull.sum() 应为 data.isnull().sum()
model = ModelClass(参数)model.fit(X_train, y_train)y_pred = model.predict(X_test)train_score = model.score(X_train, y_train)test_score = model.score(X_test, y_test)with open('model.pkl', 'wb') as f: pickle.dump(model, f)
SMOTE 处理不平衡数据,需额外安装 imblearn;2.2.2 的 Pipeline 写法是 Pipeline([('scaler', StandardScaler()), ('lr', LinearRegression())]),注意 LinearRegression() 要加括号
import onnxruntime as ortsession = ort.InferenceSession('model.onnx')input_name = session.get_inputs()[0].nameoutput = session.run(None, {input_name: input_data})pred = np.argmax(output[0])
(img/255.0 - [0.485,0.456,0.406]) / [0.229,0.224,0.225](img - np.array([127,127,127])) / 128
expend_dims→expand_dims、ort_seesion→ort_session、get_input→get_inputs)expend_dims→expand_dims;
ort_seesion→ort_session;
get_input→get_inputs;
ort.session→ort_session;
InferenceSession缺少('model.onnx')
Q1 - 1.5*IQR ~ Q3 + 1.5*IQRisnull.sum→isnull().sum、dropma→dropna)drop_dumplicates→drop_duplicates、data.filled→data_filled)
| 时段 | 模块 | 时长 | 任务 |
|---|---|---|---|
| 第1-3h | 1.1 数据处理 | 3h | 逐个运行5个notebook变体。重点练:pd.cut、groupby、between、value_counts。每道题独立写完再对答案。 |
| 第3-5.5h | 2.2 模型训练 | 2.5h | 背万能模板,练习5个变体。重点:模型创建+训练+预测+保存。掌握 LogisticRegression、LinearRegression、RandomForest、DecisionTree 的写法。 |
| 第5.5-7.5h | 3.2 图片识别 | 2h | 背ONNX推理模板,练习5个变体。重点:InferenceSession、session.run、np.expand_dims、图像预处理流程。特别注意拼写错误陷阱。 |
| 第7.5-9h | 2.1 特征工程 | 1.5h | 大部分知识已在1.1和2.2中覆盖。额外练:StandardScaler、MinMaxScaler、LabelEncoder、IQR异常值检测。 |
| 第9-10.5h | 3.1 Excel | 1.5h | 打开5个Excel题目的docx文件,按要求练习 VLOOKUP 和数据透视表操作。 |
| 第10.5-11h | 4.x 培训指导 | 0.5h | 看2-3道4.x的docx题目,理解答题格式,记住模板结构。 |
| 第11-14h | 模拟考试 | 3h | 从每个模块随机挑1个变体,限时完成全部6个模块。模拟真实考试节奏,记录每个模块耗时。 |
| 第14-16h | 查漏补缺 | 2h | 根据模拟考暴露的薄弱点针对性练习。重点复习容易出错的拼写Bug和容易忘的参数(如 index=False、random_state=42)。 |
pd.read_csv('file.csv')pd.read_excel('file.xlsx')data.isnull().sum() 缺失值统计data.duplicated().sum() 重复值统计data.dropna() 删缺失行data.drop_duplicates() 删重复行data['col'].fillna(method='ffill') 前向填充data['col'].astype(int) 类型转换pd.to_numeric(data['col'], errors='coerce')pd.cut(data['col'], bins=[...], labels=[...], right=False)data['col'].value_counts()data.groupby('col')['val'].mean()data['col'].between(low, high)np.where(condition, val_true, val_false)StandardScaler().fit_transform(data[cols])MinMaxScaler().fit_transform(data[cols])LabelEncoder().fit_transform(data['col'])X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)model.fit(X_train, y_train)y_pred = model.predict(X_test)model.score(X_test, y_test)with open('model.pkl','wb') as f: pickle.dump(model, f)session = ort.InferenceSession('model.onnx')input_name = session.get_inputs()[0].nameoutput = session.run(None, {input_name: data})np.argmax(output[0])data.to_csv('file.csv', index=False)pd.DataFrame(y_pred, columns=['预测结果']).to_csv('results.txt', index=False)