- Deep Learning By Example
- Ahmed Menshawy
- 86字
- 2021-06-24 18:52:46
Binning
This kind of quantitative transformation is used to create quantiles. In this case, the quantitative feature values will be the transformed ordered variable. This approach is not a good choice for linear regression, but it might work well for learning algorithms that respond effectively when using ordered/categorical variables.
The following code applies this kind of transformation to the Fare feature:
# Binarizing the features by binning them into quantiles
df_titanic_data['Fare_bin'] = pd.qcut(df_titanic_data['Fare'], 4)
if keep_binary:
df_titanic_data = pd.concat(
[df_titanic_data, pd.get_dummies(df_titanic_data['Fare_bin']).rename(columns=lambda x: 'Fare_' + str(x))],
axis=1)
推薦閱讀
- Instant Raspberry Pi Gaming
- Oracle SOA Governance 11g Implementation
- Deep Learning Quick Reference
- Visual C# 2008開發(fā)技術(shù)詳解
- Google App Inventor
- 機器人編程實戰(zhàn)
- Enterprise PowerShell Scripting Bootcamp
- 電氣控制與PLC技術(shù)應(yīng)用
- 云原生架構(gòu)進階實戰(zhàn)
- Dreamweaver CS6精彩網(wǎng)頁制作與網(wǎng)站建設(shè)
- 手機游戲程序開發(fā)
- 機器人人工智能
- Flink原理與實踐
- MATLAB-Simulink系統(tǒng)仿真超級學習手冊
- Data Analysis with R(Second Edition)