这里会显示出您选择的修订版和当前版本之间的差别。
| 后一修订版 | 前一修订版 | ||
|
model:basic [2020/01/10 16:00] jinlong 创建 |
model:basic [2020/07/12 12:07] (当前版本) |
||
|---|---|---|---|
| 行 1: | 行 1: | ||
| ====== 建模基础示例代码 ====== | ====== 建模基础示例代码 ====== | ||
| + | |||
| + | 进行数据建模一般需要包括以下及各环节: | ||
| + | |||
| + | - 建模样本数据加载 | ||
| + | - 数据预处理 | ||
| + | - 特征选择 | ||
| + | - 模型训练 | ||
| + | - 模型验证 | ||
| + | - 建模结果输出 | ||
| + | |||
| + | 示例代码如下: | ||
| <code python> | <code python> | ||
| 行 49: | 行 60: | ||
| ,ReplaceTransformer(pattern='^(?!Huawei|Apple).*', replacement='others') | ,ReplaceTransformer(pattern='^(?!Huawei|Apple).*', replacement='others') | ||
| ,sklearn.preprocessing.LabelBinarizer() | ,sklearn.preprocessing.LabelBinarizer() | ||
| - | ]), | + | ]), # 品牌字段分组 |
| (['phone_price'], [ | (['phone_price'], [ | ||
| sklearn.impute.SimpleImputer(strategy='constant', fill_value=0) | sklearn.impute.SimpleImputer(strategy='constant', fill_value=0) | ||
| 行 55: | 行 66: | ||
| labels=['1', '2']) | labels=['1', '2']) | ||
| ,sklearn.preprocessing.LabelBinarizer() | ,sklearn.preprocessing.LabelBinarizer() | ||
| - | ]) | + | ]) # 价格字段分段处理 |
| ]) | ]) | ||