日韩久久久精品,亚洲精品久久久久久久久久久,亚洲欧美一区二区三区国产精品 ,一区二区福利

10種經典機器學習算法——Python版

系統 1692 0

klearn python API

  • LinearRegression
            
              from sklearn.linear_model import LinearRegression         # 線性回歸 #
module = LinearRegression()
module.fit(x, y)
module.score(x, y)
module.predict(test)
            
          
  • LogisticRegression
            
              from sklearn.linear_model import LogisticRegression         # 邏輯回歸 #
module = LogisticRegression()
module.fit(x, y)
module.score(x, y)
module.predict(test)
            
          
  • KNN
            
              from sklearn.neighbors import KNeighborsClassifier     #K近鄰#
from sklearn.neighbors import KNeighborsRegressor
module = KNeighborsClassifier(n_neighbors=6)
module.fit(x, y)
predicted = module.predict(test)
predicted = module.predict_proba(test)
            
          
  • SVM
            
              from sklearn import svm                                #支持向量機#
module = svm.SVC()
module.fit(x, y)
module.score(x, y)
module.predict(test)
module.predict_proba(test)
            
          
  • naive_bayes
            
              from sklearn.naive_bayes import GaussianNB            #樸素貝葉斯分類器#
module = GaussianNB()
module.fit(x, y)
predicted = module.predict(test)
            
          
  • DecisionTree
            
              from sklearn import tree                              #決策樹分類器#
module = tree.DecisionTreeClassifier(criterion='gini')
module.fit(x, y)
module.score(x, y)
module.predict(test)
            
          
  • K-Means
            
              from sklearn.cluster import KMeans                    #kmeans聚類#
module = KMeans(n_clusters=3, random_state=0)
module.fit(x, y)
module.predict(test)
            
          
  • RandomForest
            
              from sklearn.ensemble import RandomForestClassifier  #隨機森林#
from sklearn.ensemble import RandomForestRegressor
module = RandomForestClassifier()
module.fit(x, y)
module.predict(test)
            
          
  • GBDT
            
              from sklearn.ensemble import GradientBoostingClassifier      #Gradient Boosting 和 AdaBoost算法#
from sklearn.ensemble import GradientBoostingRegressor
module = GradientBoostingClassifier(n_estimators=100, learning_rate=0.1, max_depth=1, random_state=0)
module.fit(x, y)
module.predict(test)
            
          
  • PCA
            
              from sklearn.decomposition import PCA              #PCA特征降維#
train_reduced = PCA.fit_transform(train)
test_reduced = PCA.transform(test)
            
          

References


更多文章、技術交流、商務合作、聯系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號聯系: 360901061

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對您有幫助就好】

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長會非常 感謝您的哦!!!

發表我的評論
最新評論 總共0條評論
主站蜘蛛池模板: 吉林市| 宁德市| 响水县| 浦县| 仪征市| 汤阴县| 松潘县| 宜章县| 德兴市| 无锡市| 沙雅县| 师宗县| 望江县| 灵武市| 湖口县| 米泉市| 安图县| 沈阳市| 茶陵县| 永和县| 大余县| 新邵县| 永兴县| 九江县| 婺源县| 厦门市| 冀州市| 磴口县| 盐城市| 土默特左旗| 肥东县| 怀宁县| 南投市| 镇雄县| 永善县| 广宗县| 乌兰县| 安阳市| 景谷| 孝感市| 武安市|