一.feature_extraction
1.简介:
该模块用于对原始数据进行"特征提取"(feature extraction)
2.使用:
将"特征值映射列表"(lists of feature-value mappings)转换为矢量:class sklearn.feature_extraction.DictVectorizer([dtype<class 'numpy.float64'>,separator='=',sparse=True,sort=True])
实现"特征哈希"(feature hashing)/"哈希技巧"(hashing trick):class sklearn.feature_extraction.FeatureHasher([n_features=1048576,input_type='dict',dtype=<class 'numpy.float64'>,alternate_sign=True])
3.feature_extraction.image
(1)简介:
该子模块用于从图像中提取特征
(2)函数:
将2维图像转换为"补丁集合"(collection of patches):[<patches>=]sklearn.feature_extraction.image.extract_patches_2d(<image>,<patch_size>[,max_patches=None,random_state=None])
获取"像素连接图"(Graph of the pixel-to-pixel connections):sklearn.feature_extraction.image.grid_to_graph(<n_x>,<n_y>[,n_z=1,mask=None,return_as=<class 'scipy.sparse.coo.coo_matrix'>,dtype=<class 'int'>])
获取"像素梯度连接图"(Graph of the pixel-to-pixel gradient connections):sklearn.feature_extraction.image.img_to_graph(<img>[,mask=None,return_as=<class 'scipy.sparse.coo.coo_matrix'>,dtype=None])
通过图像的全部补丁重建图像:[<image>=]sklearn.feature_extraction.image.reconstruct_from_patches_2d(<patches>,<image_size>)
(3)类:
从图像集合中提取补丁:class sklearn.feature_extraction.image.PatchExtractor([patch_size