sklearn.feature_extraction.DictVectorizer — scikit-learn 0.17.1 documentation

This transformer turns lists of mappings (dict-like objects) of feature names to feature values into Numpy arrays or scipy.sparse matrices for use with scikit-learn estimators. When feature values are strings, this transformer will do a binary one-hot (aka one-of-K) coding: one boolean-valued feature is constructed for each of the possible string values that the feature can take on. For instance, a feature “f” that can take on the values “ham” and “spam” will become two features in the output, one signifying “f=ham”, the other “f=spam”. Features that do not occur in a sample (mapping) will have a zero value in the resulting array/matrix. The type of feature values. Passed to Numpy array/scipy.sparse matrix constructors as the dtype argument. Dict(s) or Mapping(s) from feature names (arbitrary Python objects) to feature values (strings or convertible to dtype). Dict(s) or Mapping(s) from feature names (arbitrary Python objects) to feature values (strings or convertible to dtype). If one-of-K coding is applied to categorical features, this will include the constructed feature names but not the original ones. If True, will return the parameters for this estimator and contained subobjects that are estimators. X must have been produced by this DictVectorizer’s transform or fit_transform method, it may only have passed through transformers that preserve the number of features and their order. In the case of one-hot/one-of-K coding, the constructed feature names and values are returned rather than the original ones. The method works on simple estimators as well as on nested objects (such as pipelines). The former have parameters of the form <,component>,__<,parameter>, so that it’s possible to update each component of a nested object. Dict(s) or Mapping(s) from feature names (arbitrary Python objects) to feature values (strings or convertible to dtype). Source.


Яндекс.Метрика Рейтинг@Mail.ru Free Web Counter
page counter
Last Modified: May 26, 2015 @ 12:00 am