
scikit-learn
文章平均质量分 86
机器学习python开源社区scikit-learn文章翻译及实际项目中常用到的scikit-learn技术分享。
mmc2015
北大信科学院,关注深度强化学习。http://net.pku.edu.cn/~maohangyu/
展开
-
scikit-learn(工程中用的相对较多的模型介绍):2.3. Clustering(可用于特征的无监督降维)
参考:http://scikit-learn.org/stable/modules/clustering.html在实际项目中,我们真的很少用到那些简单的模型,比如LR、kNN、NB等,虽然经典,但在工程中确实不实用。今天我们不关注具体的模型,而关注无监督的聚类方法。之所以关注无监督聚类方法,是因为,在实际项目中,我们除了使用PCA等方法降维外,有时原创 2015-08-11 08:37:52 · 2126 阅读 · 0 评论 -
scikit-learn(不常用,仅了解知识点):2.2. Manifold learning(流形学习)
参考:http://scikit-learn.org/stable/modules/manifold.html1、流形学习是非线性的降维方法(an approach to non-linear dimensionality reduction)。2、因为随机映射会随机损失数据内部信息;因为类似于PCA、LDA等降维方法基于线性假设,经常会损失数据内部非线性的结构信息原创 2015-08-11 08:29:09 · 3061 阅读 · 0 评论 -
scikit-learn(工程中用的相对较多的模型介绍):1.14. Semi-Supervised
参考:http://scikit-learn.org/stable/modules/label_propagation.htmlThe semi-supervised estimators insklearn.semi_supervised are able to make use of this additional unlabeled data to better ca原创 2015-08-07 09:09:10 · 5430 阅读 · 0 评论 -
scikit-learn(工程中用的相对较多的模型介绍):1.13. Feature selection
参考:http://scikit-learn.org/stable/modules/feature_selection.htmlThe classes in the sklearn.feature_selection module can be used for feature selection/dimensionality reduction on sample sets, e原创 2015-08-07 09:03:28 · 3764 阅读 · 0 评论 -
scikit-learn(工程中用的相对较多的模型介绍):1.12. Multiclass and multilabel algorithms
http://scikit-learn.org/stable/modules/multiclass.html在实际项目中,我们真的很少用到那些简单的模型,比如LR、kNN、NB等,虽然经典,但在工程中确实不实用。今天我们关注在工程中用的相对较多的 Multiclass and multilabel algorithms。warning:sciki原创 2015-08-07 08:27:58 · 3466 阅读 · 0 评论 -
scikit-learn(工程中用的相对较多的模型介绍):1.11. Ensemble methods
参考:http://scikit-learn.org/stable/modules/ensemble.html在实际项目中,我们真的很少用到那些简单的模型,比如LR、kNN、NB等,虽然经典,但在工程中确实不实用。今天我们关注在工程中用的相对较多的Ensemble methods。Ensemble methods(集成方法)主要是综合多个esti原创 2015-08-04 08:24:16 · 15879 阅读 · 2 评论 -
scikit-learn(工程中用的相对较多的模型介绍):1.4. Support Vector Machines
参考:http://scikit-learn.org/stable/modules/svm.html在实际项目中,我们真的很少用到那些简单的模型,比如LR、kNN、NB等,虽然经典,但在工程中确实不实用。今天我们关注在工程中用的相对较多的SVM。SVM功能不少:Support vector machines (SVMs) are a se原创 2015-08-04 07:33:26 · 2667 阅读 · 1 评论 -
scikit-learn:External Resources, Videos and Talks
参考:http://scikit-learn.org/stable/presentations.htmlscikit-learn的User Guide基本看完了(除了具体estimator部分),这里再摘录scikit-learn官方网站提供的额外资源,供之后学习。关于supervised learning和unsupervised learning中涉及到的estimator,用原创 2015-07-31 09:17:58 · 1149 阅读 · 0 评论 -
scikit-learn:3.5. Validation curves: plotting scores to evaluate models
参考:http://scikit-learn.org/stable/modules/learning_curve.htmlestimator's generalization error can be decomposed in terms ofbias, variance and noise. The bias of an estimator is its avera原创 2015-07-30 09:23:56 · 2021 阅读 · 0 评论 -
scikit-learn:3.4. Model persistence
参考:http://scikit-learn.org/stable/modules/model_persistence.html训练了模型之后,我们希望可以保存下来,遇到新样本时直接使用已经训练好的保存了的模型,而不用重新再训练模型。本节介绍pickle在保存模型方面的应用。(After training a scikit-learn model, it is desirable原创 2015-07-30 08:59:03 · 2134 阅读 · 0 评论 -
scikit-learn:3.3. Model evaluation: quantifying the quality of predictions
参考:http://scikit-learn.org/stable/modules/model_evaluation.html#scoring-parameter三种方法评估模型的预测质量:Estimator score method: Estimators都有 score method作为默认的评估标准,不属于本节内容,具体参考不同estimators的文档。Scorin原创 2015-07-29 08:57:49 · 3221 阅读 · 2 评论 -
scikit-learn:3.2. Grid Search: Searching for estimator parameters
参考:http://scikit-learn.org/stable/modules/grid_search.htmlGridSearchCV通过(蛮力)搜索参数空间(参数的所有可能组合),寻找最好的 Cross-validation: evaluating estimator performance score对应的超参数(翻译文章参考:http://blog.youkuaiyun.com/m原创 2015-07-28 09:23:08 · 2590 阅读 · 0 评论 -
scikit-learn:3.1. Cross-validation: evaluating estimator performance
参考:http://scikit-learn.org/stable/modules/cross_validation.htmloverfitting很常见,所以提出使用test set来验证模型的performance。给个直观的例子:>>> import numpy as np>>> from sklearn import cross_validation>>> from s原创 2015-07-28 09:12:08 · 2457 阅读 · 0 评论 -
scikit-learn:3. Model selection and evaluation
参考:http://scikit-learn.org/stable/model_selection.html有待翻译,敬请期待:3.1. Cross-validation: evaluating estimator performance3.1.1. Computing cross-validated metrics3.1.1.1. Obtain原创 2015-07-27 21:07:24 · 1880 阅读 · 0 评论 -
scikit-learn:7. Computational Performance(计算效能<延迟和吞吐量>)
参考:http://scikit-learn.org/stable/modules/computational_performance.html对于有些应用,estimators的计算效能(主要指预测新样本时的延迟和吞吐量)非常关键,我们也考虑训练的效能,但由于训练可以offline,所以我们更关注预测时的效能问题。预测延迟(Prediction latency):预测一个新样本花原创 2015-07-27 20:58:12 · 1646 阅读 · 0 评论 -
scikit-learn:6. Strategies to scale computationally: bigger data
参考:http://scikit-learn.org/stable/modules/scaling_strategies.html对于examples、features(或者两者)数量很大的情况,挑战传统的方法要解决两个问题:内存和效率。办法是Out-of-core (or “external memory”) learning。有三种方法可以实现out-of-core,分别是:原创 2015-07-27 09:12:34 · 1606 阅读 · 0 评论 -
scikit-learn:4.8. Transforming the prediction target (y)
参考:http://scikit-learn.org/stable/modules/preprocessing_targets.html没什么好翻译的,直接给例子。1、Label binarizationLabelBinarizer is a utility class to help create a label indicator matrix from原创 2015-07-26 17:52:44 · 1536 阅读 · 0 评论 -
scikit-learn:4.7. Pairwise metrics, Affinities and Kernels
参考:http://scikit-learn.org/stable/modules/metrics.htmlThe sklearn.metrics.pairwise submodule implements utilities to evaluate pairwise distances(样本对的距离) or affinity of sets of samples(样本集的相似度)原创 2015-07-26 16:35:39 · 2066 阅读 · 0 评论 -
scikit-learn:4.6. Kernel Approximation
参考:http://scikit-learn.org/stable/modules/kernel_approximation.html之所以使用approximate explicit feature maps compared to the kernel trick, 是因为这样便于online learning,且能够适用于大数据集。但是还是建议,如果可能,approximat原创 2015-07-26 15:36:55 · 3417 阅读 · 0 评论 -
scikit-learn:4.5. Random Projection
参考:http://scikit-learn.org/stable/modules/random_projection.htmlThe sklearn.random_projection module 通过trading accuracy(可控的范围)来降维数据,提高效率。实现了两类unstructured random matrix:: Gaussian random mat原创 2015-07-26 12:47:59 · 3766 阅读 · 0 评论 -
scikit-learn:4.4. Unsupervised dimensionality reduction(降维)
参考:http://scikit-learn.org/stable/modules/unsupervised_reduction.html对于高维features,常常需要在supervised之前unsupervised dimensionality reduction。下面三节的翻译会在之后附上。4.4.1. PCA: principal compo原创 2015-07-26 11:14:55 · 2063 阅读 · 0 评论 -
scikit-learn:4.3. Preprocessing data(standardi/normali/binari..zation、encoding、missing value)
参考:http://scikit-learn.org/stable/modules/preprocessing.html主要讲述The sklearn.preprocessing package的utility function and transformer classes,包括standardization、normalization、binarization、encoding原创 2015-07-23 09:10:21 · 2588 阅读 · 3 评论 -
scikit-learn:4.2.3. Text feature extraction
http://scikit-learn.org/stable/modules/feature_extraction.html4.2节内容太多,因此将文本特征提取单独作为一块。1、the bag of words representation将raw data表示成长度固定的数字特征向量,scikit-learn提供了三个方式:tokenizing:给每一个token(字、词原创 2015-07-22 07:57:15 · 4269 阅读 · 0 评论 -
scikit-learn:4.2. Feature extraction(特征提取,不是特征选择)
http://scikit-learn.org/stable/modules/feature_extraction.html带病在网吧里。。。。。。写,求支持。。。1、首先澄清两个概念:特征提取和特征选择( Feature extraction is very different from Feature selection)。the former consis原创 2015-07-21 21:10:23 · 13216 阅读 · 3 评论 -
scikit-learn:4.1. Pipeline and FeatureUnion: combining estimators(特征与预测器结合;特征与特征结合)
http://scikit-learn.org/stable/modules/pipeline.html 1、pipeline和featureUnion是干什么的:pipeline之前已经介绍过了,结合transformer和estimator。featureUinon听名字就知道,将多个transformer的结果vector拼接成大的vector。两者的区别:前者相当原创 2015-07-21 20:29:32 · 3141 阅读 · 2 评论 -
scikit-learn:4. 数据集预处理(clean数据、reduce降维、expand增维、generate特征提取)
本文参考:http://scikit-learn.org/stable/data_transforms.html本篇主要讲数据预处理,包括四部分:数据清洗、数据降维(PCA类)、数据增维(Kernel类)、提取自定义特征。哇哈哈,还是关注预处理比较靠谱。。。。重要的不翻译:scikit-learn providesa library of transformers, whi原创 2015-07-16 21:07:14 · 4203 阅读 · 0 评论 -
scikit-learn:CountVectorizer提取tf都做了什么
http://scikit-learn.org/stable/modules/generated/sklearn.feature_extraction.text.CountVectorizer.html#sklearn.feature_extraction.text.CountVectorizerclass sklearn.feature_extraction.text.C原创 2015-07-13 18:58:52 · 26244 阅读 · 8 评论 -
scikit-learn:构建文本分类的“pipeline”简化分类过程、网格搜索调参
前两篇分别将“加载数据”和“提取tf、tf-idf,进而构建分类器”,其实这个过程,vectorizer => transformer => classifier,早已被“scikit-learn provides a Pipeline class”一下就可以搞定:本篇翻译:http://scikit-learn.org/stable/tutorial/text_analytics/w翻译 2015-07-12 21:21:15 · 3266 阅读 · 6 评论 -
scikit-learn:训练分类器、预测新数据、评价分类器
http://scikit-learn.org/stable/tutorial/text_analytics/working_with_text_data.html构建分类器,以NB为例:from sklearn.naive_bayes import MultinomialNBclf = MultinomialNB().fit(X_tfidf, rawData.target)要原创 2015-07-13 08:14:59 · 9404 阅读 · 0 评论 -
scikit-learn:从文本文件中提取特征(tf、idf)
http://scikit-learn.org/stable/tutorial/text_analytics/working_with_text_data.html昨晚写了两篇文章,明明保存了,今早却没了,只好简单的重复一下。。。1、tf:首先要解决high-dimensional sparse datasets的问题,scipy.sparse matrices 就是这样的原创 2015-07-13 07:48:40 · 4228 阅读 · 0 评论 -
scikit-learn:0.5. Choosing the right estimator(你的问题适合什么estimator来建模呢)
内容来自:http://scikit-learn.org/stable/index.htmlOften the hardest part of solving a machine learning problem can be finding the right estimator for the job.Different estimators are better原创 2015-07-01 08:45:10 · 1781 阅读 · 0 评论 -
scikit-learn:5. 加载内置公用的数据
之前写过一篇如何加载自己的数据,参考:http://blog.youkuaiyun.com/mmc2015/article/details/46852755本篇主要写如何加载scikit-learn内置数据,参考:http://scikit-learn.org/stable/datasets/index.html#general-dataset-api重点介绍“5.7:The 20原创 2015-07-16 08:58:38 · 5491 阅读 · 0 评论 -
scikit-learn:加载自己的原始数据
这里不讨论加载常用的公用数据集,而是讨论加载自己的原始数据(即,实际中遇到的数据)http://scikit-learn.org/stable/modules/generated/sklearn.datasets.load_files.html#sklearn.datasets.load_filessklearn.datasets.load_files(翻译 2015-07-12 20:28:21 · 18939 阅读 · 6 评论 -
scikit-learn:0.1. 数据集格式和预测器
http://scikit-learn.org/stable/tutorial/statistical_inference/settings.html1、数据集:数据集都是2维的,第一维度是“样本维”,第二维度是“特征维”。>>> from sklearn import datasets>>> iris = datasets.load_iris()>>> data =翻译 2015-07-12 16:38:30 · 3422 阅读 · 0 评论 -
scikit-learn:0. user_guide——需要学习的所有内容
内容来自:http://scikit-learn.org/stable/index.html1. Supervised learning1.1. Generalized Linear Models1.2. Linear and quadratic discriminant analysis1.3. Kernel ridge regression1.4. Su原创 2015-07-01 08:49:11 · 1393 阅读 · 0 评论