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). 

      外部链接[编辑]