scikit-learn

維基百科,自由的百科全書
跳至導覽 跳至搜尋

scikit-learn
File:Scikit learn logo small.svg
原作者David Cournapeau
首次發布2007年6月,​19年前​(2007-06
當前版本
    Module:EditAtWikidata第29行Lua錯誤:attempt to index field 'wikibase' (a nil value)
    原始碼庫
    • {{URL|example.com|可选的显示文本}}
    Module:EditAtWikidata第29行Lua錯誤:attempt to index field 'wikibase' (a nil value)
    程式語言Python, Cython, C, C++
    引擎
      Module:EditAtWikidata第29行Lua錯誤:attempt to index field 'wikibase' (a nil value)
      作業系統Linux, macOS, Windows
      類型機器學習
      許可協議三條款BSD許可證
      網站scikit-learn.org

      Scikit-learn(曾叫做scikits.learnsklearn)是用於Python程式語言自由並開源機器學習[1]。它包含了各種分類回歸聚類算法,包括多層感知器支持向量機隨機森林梯度提升k-平均聚類DBSCAN,它被設計協同於Python數值庫NumPy和和科學庫SciPy

      概述[編輯]

      scikit-learn計劃開始於scikits.learn,它是David Cournapeau英語David CournapeauGoogle編程之夏計劃。它的名字來源自成為「SciKit」(SciPy工具箱)的想法,即一個獨立開發和發行的第三方SciPy擴展[2]。最初的代碼庫被其他開發者重寫了。在2010年,來自法國羅康庫爾法國國家信息與自動化研究所的Fabian Pedregosa、Gael Varoquaux、Alexandre Gramfort和Vincent Michel,領導了這個項目並在2010年2月1日進行了首次公開發行[3]。在各種scikit中,scikit-learn和scikit-image英語scikit-image截至2012年11月 (2012-11)是「良好維護和流行的」[4]。Scikit-learn是在GitHub上最流行的機器學習庫之一[5]

      特徵[編輯]

      • 聚成大型目錄的成熟的機器學習算法和數據預處理方法(比如特徵工程)。
      • 常見數據科學任務的實用方法,比如將數據分裂成訓練集和測試集交叉驗證網格搜索
      • 運行機器學習模型的一致方式(estimator.fit()estimator.predict()),模型庫可以實現它們。
      • 構造數據科學處理過程的聲明式方式(Pipeline),包括數據預處理和模型擬合。

      例子[編輯]

      擬合一個隨機森林分類器

      >>> from sklearn.ensemble import RandomForestClassifier
      >>> classifier = RandomForestClassifier(random_state=0)
      >>> X = [[ 1,  2,  3],  # 2 samples, 3 features
      ...      [11, 12, 13]]
      >>> y = [0, 1]  # classes of each sample
      >>> classifier.fit(X, y)
      RandomForestClassifier(random_state=0)
      

      實現[編輯]

      Scikit-learn主要用Python編寫的,並廣泛使用NumPy進行高性能線性代數和數組運算。此外,一些核心算法用Cython書寫來以提高性能。在某些情況下,用Python擴展出特定方法是不可能的;比如支持向量機,是通過用Cython包裝LIBSVM英語LIBSVM實現;邏輯斯諦回歸線性支持向量機,是通過對LIBLINEAR英語LIBLINEAR的類似的包裝實現的。

      Scikit-learn與很多其他Python庫可以良好的集成起來,比如用於繪圖的matplotlibplotly英語plotly,用於陣列向量化的NumPy,用於數據幀的pandas,用於科學計算的SciPy等等。

      有關工具[編輯]

      • sklearn-onnx是將scikit-learn模型轉換成ONNX的工具[6]
      • SciKeras是對Keras模塊的scikit-learn兼容的包裝器[7]
      • skorch是包裝了PyTorch的scikit-learn兼容的神經網絡庫[8]

      參見[編輯]

      引用[編輯]

      1. ^ Fabian Pedregosa; Gaël Varoquaux; Alexandre Gramfort; Vincent Michel; Bertrand Thirion; Olivier Grisel; Mathieu Blondel; Peter Prettenhofer; Ron Weiss; Vincent Dubourg; Jake Vanderplas; Alexandre Passos; David Cournapeau; Matthieu Perrot; Édouard Duchesnay. Scikit-learn: Machine Learning in Python. Journal of Machine Learning Research. 2011, 12: 2825–2830 [2020-10-31]. (原始內容存檔於2020-12-01). 
      2. ^ Dreijer, Janto. scikit-learn. [2020-10-31]. (原始內容存檔於2020-11-07). 
      3. ^ About us — scikit-learn 0.20.1 documentation. scikit-learn.org. [2020-10-31]. (原始內容存檔於2020-11-06). 
      4. ^ Eli Bressert. SciPy and NumPy: an overview for developers. O'Reilly. 2012: 43 [2020-10-31]. (原始內容存檔於2016-04-25). 
      5. ^ The State of the Octoverse: machine learning. The GitHub Blog. GitHub. 2019-01-24 [2019-10-17]. (原始內容存檔於2020-11-07) (en-US). 
      6. ^ sklearn-onnx — Convert scikit-learn models and pipelines to ONNX. [2023-09-22]. (原始內容存檔於2023-10-11). 
      7. ^ SciKeras - Scikit-Learn API wrapper for Keras. [2022-09-01]. (原始內容存檔於2022-06-19). 
      8. ^ skorch - A scikit-learn compatible neural network library that wraps PyTorch. [2022-09-01]. (原始內容存檔於2022-08-24). 

      外部連結[編輯]