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

10種經(jīng)典機器學(xué)習(xí)算法——Python版

系統(tǒng) 1769 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


更多文章、技術(shù)交流、商務(wù)合作、聯(lián)系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號聯(lián)系: 360901061

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

【本文對您有幫助就好】

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

發(fā)表我的評論
最新評論 總共0條評論
主站蜘蛛池模板: 景泰县| 金平| 贵德县| 兴和县| 拜城县| 庆安县| 社旗县| 石柱| 黑水县| 尖扎县| 无锡市| 根河市| 雷州市| 时尚| 陵水| 卢湾区| 天等县| 搜索| 夹江县| 鞍山市| 会昌县| 易门县| 家居| 育儿| 东乡县| 兴宁市| 重庆市| 和政县| 青神县| 湄潭县| 柳江县| 新密市| 武夷山市| 常宁市| 茂名市| 体育| 临武县| 专栏| 巩义市| 陆良县| 如东县|