copulas package

Module contents

Top-level package for Copulas.

exception copulas.NotFittedError[source]

Bases: Exception

copulas.check_valid_values(function)[source]

Raises an exception if the given values are not supported.

Parameters

function (callable) – Method whose unique argument is a numpy.array-like object.

Returns

Decorated function

Return type

callable

Raises

ValueError – If there are missing or invalid values or if the dataset is empty.

copulas.get_instance(obj, **kwargs)[source]

Create new instance of the obj argument.

Parameters

obj (str, type, instance) –

copulas.get_qualified_name(_object)[source]

Return the Fully Qualified Name from an instance or class.

copulas.random_seed(seed)[source]
copulas.random_state(function)[source]
copulas.scalarize(function)[source]

Allow methods that only accepts 1-d vectors to work with scalars.

Parameters

function (callable) – Function that accepts and returns vectors.

Returns

Decorated function that accepts and returns scalars.

Return type

callable

copulas.store_args(__init__)[source]

Save *args and **kwargs used in the __init__ of a copula.

Parameters

__init__ (callable) – __init__ function to store their arguments.

Returns

Decorated __init__ function.

Return type

callable

copulas.vectorize(function)[source]

Allow a method that only accepts scalars to accept vectors too.

This decorator has two different behaviors depending on the dimensionality of the array passed as an argument:

1-d array

It will work under the assumption that the function argument is a callable with signature:

function(self, X, *args, **kwargs)

where X is an scalar magnitude.

In this case the arguments of the input array will be given one at a time, and both the input and output of the decorated function will have shape (n,).

2-d array

It will work under the assumption that the function argument is a callable with signature:

function(self, X0, ..., Xj, *args, **kwargs)

where Xi are scalar magnitudes.

It will pass the contents of each row unpacked on each call. The input is espected to have shape (n, j), the output a shape of (n,)

It will return a function that is guaranteed to return a numpy.array.

Parameters

function (callable) – Function that only accept and return scalars.

Returns

Decorated function that can accept and return numpy.array.

Return type

callable