機器學習函數調用及繪圖常用代碼總結

機器學習函數調用:

決策樹:from sklearn.tree import DecisionTreeRegressor
隨機森林:from sklearn.ensemble import RandomForestClassifier
線性迴歸from sklearn.linear_model import LinearRegression
邏輯迴歸:from sklearn.linear_model import LogisticRegression

繪圖常用代碼:
模板:
無子圖:

fig = plt.figure()     
ax1 = fig.add_subplot(1, 1, 1)    /一行一列第一列
ax1.plot(X, Y, marker=" ", c=" ")     //繪製X,Y的圖像,形狀爲 marker, 顏色爲c

plt.xticks(rotation =   )                     //設置X刻度旋轉角度

plt.xlabel()          //設置X軸標籤
plt.ylabel()          //設置y軸標籤

plt.show()       //顯示圖片

有子圖:

fig = plt.figure()        
ax1 = fig.add_subplot(1, 2, 1)       //一行兩列第一列
ax2 = fig.add_subplot(1, 2, 2)       //一行兩列第二列

ax1.set_xlabel("    ")               //設置子圖1的X軸標籤
ax1.set_ylabel("    ")               //設置子圖2的Y軸標籤

plt.show()       //顯示圖片
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章