fromsklearnimportdatasetsfromsklearn.model_selectionimportcross_val_scorefromsklearn.linear_modelimportLogisticRegressionfromsklearn.naive_bayesimportGaussianNBfromsklearn.ensembleimportRandomForestClassifierfromsklearn.ensembleimportVotingClassifier iris = datasets.load_iris() X, y = iris.data[:,1:3], iris...
from sklearn.naive_bayes import GaussianNB from sklearn.ensemble import GradientBoostingClassifier from xgboost import XGBClassifier,XGBRegressor from catboost import CatBoostClassifier,CatBoostRegressor from sklearn.ensemble import RandomForestClassifier,RandomForestRegressor from sklearn.model_selection import train...
fromsklearn.preprocessingimportLabelEncoderle=LabelEncoder()le.fit(titanic['sex'])le.transform(titanic['sex']) 但是用le有可能指定male为0,所以手动指定。 和上面处理sex的目的相同,将从登船港口参数化,并且缺失的两个值单独赋值 titanic['embarked']=titanic['Embarked']titanic['embarked']=titanic['embarked'...