传统的机器学习模型的选择往往是凭借经验和习惯,部分人一般情况会用TPOT今天最佳模型调参,但是也许要对比其他模型在哪些模型衡量指标下的优劣势,这里提供一个简单的效果对比工具:
- import matplotlib.pyplot as plt
-
- model_comparison = pd.DataFrame({'model': ['Linear Regression', 'Support Vector Machine',
- 'Random Forest', 'Gradient Boosted',
- 'K-Nearest Neighbors','ExtraTreesRegressor','LGBM'],
- 'mae': [lr_mae, svm_mae, random_forest_mae,
- gradient_boosted_mae, knn_mae,knn_mae,LGBM_mae]})
-
-
- model_comparison.sort_values('mae', ascending = False).plot(x = 'model', y = 'mae', kind = 'barh',
- color = 'red', edgecolor = 'black')
-
- plt.ylabel('')
- plt.yticks(size = 14)
- plt.xlabel('Mean Absolute Error')
- plt.xticks(size = 14)
- plt.title('Model Comparison on Test MAE', size = 20)
- plt.figure(figsize=(4,6))