FeatureSpec

com.spotify.featran.FeatureSpec
See theFeatureSpec companion object
class FeatureSpec[T]

Encapsulate specification for feature extraction and transformation.

Attributes

T

input record type to extract features from

Companion:
object
Source:
FeatureSpec.scala
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Concise view

Value members

Concrete methods

def compose[S](spec: FeatureSpec[S])(f: T => S): FeatureSpec[T]

Compose with another spec by applying a prepare function to input records first.

Compose with another spec by applying a prepare function to input records first.

Useful for reusing an existing spec for a different input record type.

Attributes

S

input record type of the other spec

f

function to prepare input records for the other spec

spec

spec to compose with

Source:
FeatureSpec.scala
def cross(k: (String, String))(f: (Double, Double) => Double): FeatureSpec[T]

Cross feature values of two underlying transformers.

Cross feature values of two underlying transformers.

Attributes

f

function to cross feature value pairs

k

names of transformers to be crossed

Source:
FeatureSpec.scala
def extract[M[_] : CollectionType](input: M[T]): FeatureExtractor[M, T]

Extract features from an input collection.

Extract features from an input collection.

This is done in two steps, a reduce step over the collection to aggregate feature summary, and a map step to transform values using the summary.

Attributes

M

input collection type, e.g. Array, List

input

input collection

Source:
FeatureSpec.scala
def extractWithSettings[M[_] : CollectionType](input: M[T], settings: M[String]): FeatureExtractor[M, T]

Extract features from an input collection using settings from a previous session.

Extract features from an input collection using settings from a previous session.

This bypasses the reduce step in extract and uses feature summary from settings exported in a previous session.

Attributes

M

input collection type, e.g. Array, List

input

input collection

settings

JSON settings from a previous session

Source:
FeatureSpec.scala

Extract features from individual records using settings from a previous session. Since the settings are parsed only once, this is more efficient and is recommended when the input is from an unbounded source, e.g. a stream of events or a backend service.

Extract features from individual records using settings from a previous session. Since the settings are parsed only once, this is more efficient and is recommended when the input is from an unbounded source, e.g. a stream of events or a backend service.

This bypasses the reduce step in extract and uses feature summary from settings exported in a previous session.

Attributes

settings

JSON settings from a previous session

Source:
FeatureSpec.scala
def extractWithSubsetSettings[M[_] : CollectionType](input: M[T], settings: M[String]): FeatureExtractor[M, T]

Extract features from an input collection using a partial settings from a previous session.

Extract features from an input collection using a partial settings from a previous session.

This bypasses the reduce step in extract and uses feature summary from settings exported in a previous session.

Attributes

M

input collection type, e.g. Array, List

input

input collection

settings

JSON settings from a previous session

Source:
FeatureSpec.scala

Extract features from individual records using partial settings. Since the settings are parsed only once, this is more efficient and is recommended when the input is from an unbounded source, e.g. a stream of events or a backend service.

Extract features from individual records using partial settings. Since the settings are parsed only once, this is more efficient and is recommended when the input is from an unbounded source, e.g. a stream of events or a backend service.

This bypasses the reduce step in extract and uses feature summary from settings exported in a previous session.

Attributes

settings

JSON settings from a previous session

Source:
FeatureSpec.scala
def filter(predicate: Feature[T, _, _, _] => Boolean): FeatureSpec[T]

Creates a new FeatureSpec with only the features that respect the given predicate.

Creates a new FeatureSpec with only the features that respect the given predicate.

Attributes

predicate

Function determining whether or not to include the feature

Source:
FeatureSpec.scala
def optional[A](f: T => Option[A], default: Option[A])(t: Transformer[A, _, _]): FeatureSpec[T]

Add an optional field specification.

Add an optional field specification.

Attributes

A

extracted feature type

default

default for missing values

f

function to extract feature Option[A] from record T

t

Transformer for extracted feature A

Source:
FeatureSpec.scala
def required[A](f: T => A)(t: Transformer[A, _, _]): FeatureSpec[T]

Add a required field specification.

Add a required field specification.

Attributes

A

extracted feature type

f

function to extract feature A from record T

t

Transformer for extracted feature A

Source:
FeatureSpec.scala