gammy.arraymapper.ArrayMapper

ArrayMapper

class ArrayMapper(function=<function ArrayMapper.<lambda>>)[source]

Bases: object

Callable input mapping object that obey arithmetic operations

When working with basis function regression, when building the design matrix, one needs the information ‘how eact term maps input array’. This class helps writing human-readable model definitions that explicitly show how inputs are mapped. For example,

formula = a(x[:, 0]) * x[:, 1] + x[:, 2] ** 2

is a valid definition as long as a is an instance of gammy.formulae.Formula and x is an instance of ArrayMapper.

TODO: Are some natural methods are still missing?

__add__(other)gammy.arraymapper.ArrayMapper[source]

Addition of arraymappers

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

Call the wrapped function

__getitem__(key: int)gammy.arraymapper.ArrayMapper[source]

Access index as in a NumPy Array

__mul__(other)gammy.arraymapper.ArrayMapper[source]

Multiplication of arraymappers

__neg__()gammy.arraymapper.ArrayMapper[source]

Negation operation

__pow__(n: float)gammy.arraymapper.ArrayMapper[source]

Raise an arraymapper to a power

__sub__(other)gammy.arraymapper.ArrayMapper[source]

Subtraction of arraymappers

__truediv__(other)gammy.arraymapper.ArrayMapper[source]

Division of arraymappers

function

Wrapped function

ravel()gammy.arraymapper.ArrayMapper[source]

Imitates the behavior of NumPy ravel method

reshape(*args, **kwargs)gammy.arraymapper.ArrayMapper[source]

Numpy reshape