多个机器学习模型对在线购物意向数据集的分类
多个机器学习模型对 Online Shoppers Purchasing Intention Dataset Data Set数据集的分类
注:数据源网址https://archive.ics.uci.edu/ml/datasets/Online+Shoppers+Purchasing+Intention+Dataset
注:源码地址https://github.com/HY1506698498/-/tree/main/%E8%B4%AD%E7%89%A9%E6%84%8F%E5%90%91
1.KNN
import pandas as pd
df = pd.read_csv('./online_shoppers_intention.csv') df.head() df.shape df.describe() df.columns X = df[['Administrative', 'Administrative_Duration', 'Informational', 'Informational_Duration', 'ProductRelated', 'ProductRelated_Duration', 'BounceRates', 'ExitRates', 'PageValues', 'SpecialDay', 'OperatingSystems', 'Browser', 'Region', 'TrafficType', 'Weekend',]] y = df['Revenue'] from sklearn.ensemble import RandomForestClassifier from sklearn.model_selection import cross_val_score rfc = RandomForestClassifier(random_state=90) base_score = cross_val_score(rfc, X, y, cv=10).mean() base_score from sklearn.model_selection import GridSearchCV import numpy as np rfc = RandomForestClassifier(random_state=90, n_jobs=-1) param_gird = ({ 'n_estimators': np.arange(1, 201, 10) }) clf = GridSearchCV(rfc,param_grid=param_gird, cv=10) clf.fit(X, y) clf.best_score_, clf.best_params_ from sklearn.model_selection import GridSearchCV import numpy as np rfc = RandomForestClassifier(random_state=90, n_jobs=-1) param_gird = ({ 'n_estimators': np.arange(170, 211, 1) }) clf = GridSearchCV(rfc,param_grid=param_gird, cv=10) clf.fit(X, y) clf.best_score_, clf.best_params_ score1 = [] for i in range(1, 20, 1): rfc = RandomForestClassifier( n_estimators=195, n_jobs=-1, random_state=90, max_depth= i ) score = cross_val_score(rfc, X, y, cv = 10).mean() score1.append(score) print(max(score1)
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061相关知识
机器学习鸢尾花数据集
机器学习之路:经典的鸢尾花数据集
探索机器学习的起点:鸢尾花数据集
【机器学习】基于KNN算法实现鸢尾花数据集的分类
基于机器学习的鸢尾花数据集的三分类算法的实现 C++
机器学习算法其一:鸢尾花数据集逻辑回归分类预测学习总结
花分类数据集(玫瑰花等)
玫瑰花图片数据集助力深度学习模型训练
机器学习案例——鸢尾花数据集分析
向日葵图像识别深度学习数据集
原文链接: 多个机器学习模型对在线购物意向数据集的分类 https://www.huajiangbk.com/newsview924899.html
| 上一篇: “情人节”搜索量环比涨超378倍... | 下一篇: 在线顾客购买意愿点击流数据可视化 |
推荐分享

- 1明日花キララ:明日花绮罗年度... 23753
- 2明日花キララ(明日花绮罗)经... 13907
- 3家庭养花知识大全 家庭养花有... 9306
- 4家庭养花风水知识 家庭养花“... 9021
- 5兰花叶子扭的是什么兰 8764
- 6君子兰什么品种最名贵 十大名... 8096
- 7五月天婷婷开心六月丁香:音乐... 7937
- 8十大致癌花卉排行榜,哪些花卉... 7740
- 9秋天养花,掌握这5点养花知识... 7569
- 10【花卉知识 】养花须知:新手... 7170




