Several modules that will work with Python offer a variety of functions. Among them, I drew and compared graphs using the matplotlib library that helps me draw graphs efficiently and Pandas' own plot function. # default bar graph df['column'].value_counts().plot(kind='bar') # sub graph plt.subplot(100) df['column1'].plot(kind='hist') plt.subplot(150) plt.hist(df['column2']) plt.show() # seaborn histogram graph sns.histplot(data=df, x='column') # seaborn histogram graph with hue color sns.histplot(data=df, x='column', hue='column color') # seaborn histogram with round end sns.kdeplot(data=df, x='column', hue='column color')
By using the [voting ensemble model], we can learn multiple models respectively and compare the results. from sklearn.linear_model import LinearRegression as lr from xgboost import XGBRegressor as xgb from sklearn.ensemble import RandomForestRegressor as rfr from sklearn.ensemble import GradientBoostingRegressor as grb from sklearn.ensemble import VotingRegressor import joblib import time model_list=[lr(), rfr(), grb(), xgb()] # Convert mutli dimension array to single dimension array. train_y = train_y.to_numpy().flatten() # Save several models after learning sequence. model_result = [] for i in range(len(model_list)): model = model_list[i] model.fit(train_x, train_y) pred_y = model.predict(test_x) model_result.append(model) # Models list voting_models = [ ('linear_reg', model_rslt[0]), ('randForest', model_rslt[1]), ('gradBoost', model_rslt[2]), ('xgboost', model_rslt[3]) ] # Run VotingRegressor voting_...
Comments
Post a Comment