Penelope v0.4.0 Penelope.ML.Feature.StackVectorizer
This vectorizer horizontally stacks the results of a sequence of
inner vectorizers applied to an incoming feature matrix. This is analogous
to the behavior of the FeatureUnion
component in sklearn.
Example:
features = [
{:count_vectorizer, []},
{:regex_vectorizer, [regexes: [~r/ed$/, ~r/ing$/]]},
]
pipeline = [
{:ptb_tokenizer, []},
{:feature_stack, features},
{:svm_classifier, [c: 2.0]},
]
Penelope.ml.pipeline.fit(%{}, x, y, pipeline)
Link to this section Summary
Functions
imports parameters from a serialized model
exports a runtime model to a serializable data structure
fits each of the configured inner vectorizers
transform a list of feature vectors using the inner featurizers and stack the results into a single vector per sample
Link to this section Functions
imports parameters from a serialized model
exports a runtime model to a serializable data structure
Link to this function
fit(context, x, y, features)
fit(context :: map(), x :: [any()], y :: [any()], features :: [{String.t() | atom(), any()}]) :: [{atom(), any()}]
fits each of the configured inner vectorizers
Link to this function
transform(model, context, x)
transform(model :: [{atom(), any()}], context :: map(), x :: [any()]) :: [Penelope.ML.Vector.t()]
transform a list of feature vectors using the inner featurizers and stack the results into a single vector per sample