Penelope v0.5.0 Penelope.ML.Feature.ContextFeaturizer View Source

This is a sequence featurizer that extracts a constant value from the prediction context and adds it as a feature for each element in each sequence for each sample. This is useful for biasing a sequence classifier at the sample level.

Example:

  model:   %{keys: ["k"]}
  context: %{k: 1.5}
  x:       [[1, 2, 3]]

  result:  [[%{k: 1.5}, %{k: 1.5}, %{k: 1.5}]]

Link to this section Summary

Functions

transforms the sequence feature list

Link to this section Functions

Link to this function transform(model, context, x) View Source
transform(model :: %{keys: [String.t()]}, context :: map(), x :: [[any()]]) ::
  [[map()]]

transforms the sequence feature list