spines.transforms

Transforms subpackage for spines.

class spines.transforms.Transform(*args, **kwargs)[source]

Bases: spines.core.base.BaseObject

Base Transform class

construct(*args, **kwargs) → None[source]

Constructs the transformer prior to use

Parameters
  • args (optional) – Arguments to use in constructing the transformer.

  • kwargs (optional) – Keyword arguments to use in constructing the transformer.

fit(*args, **kwargs) → Union[None, Dict[KT, VT]][source]

Fits the parameters for this transformation

Parameters
  • args – Data to use for fitting this Transformer.

  • kwargs (optional) – Additional keyword-arguments to use in fit call.

Returns

Dictionary of updates from fit, or None.

Return type

dict or None

score(*args, **kwargs) → float[source]

Returns the score measure for this Transform

Parameters
  • args (optional) – Arguments (data inputs and outputs) to pass to the score call.

  • kwargs (optional) – Additional keyword-arguements to pass to the score call.

Returns

Score for the given inputs and outputs.

Return type

float

transform(*args, **kwargs) → Any[source]

Transforms the given data

Parameters
  • args – Data to perform transformation on.

  • kwargs (optional) – Additional keyword arguments to use in transform call.

Returns

Transformed inputs.

Return type

object

class spines.transforms.Pass(*args, **kwargs)[source]

Bases: spines.transforms.base.Transform

Transform which simply passes the given values through

output

Parameter class

Parameters
  • value_type (type or Iterable of type) – The type(s) of values allowed for this parameter.

  • default (object, optional) – Default value for this parameter, if any.

  • desc (str, optional) – Description for this parameter, if any.

transform(*args, **kwargs)[source]

Passes the given input args back out

If this transform’s output parameter is set, it will attempt to call it’s __call__ with the given args and kwargs. If no output parameter is set this will return the input args as a tuple if they have a length greater than one otherwise it will just return the first input element of args.

Parameters
  • args – Input data to pass back out.

  • kwargs (optional) – Additional keyword arguments to use if output parameter is set.