climb.tool.impl.data_suite.third_party.copulas package

Subpackages

Submodules

climb.tool.impl.data_suite.third_party.copulas.datasets module

climb.tool.impl.data_suite.third_party.copulas.datasets.sample_bivariate_age_income(size=1000, seed=42)[source]

Sample from a bivariate toy dataset.

This dataset contains two columns which correspond to the simulated age and income which are positively correlated with outliers.

Parameters:
  • size (int) – Amount of samples to generate. Defaults to 1000.

  • seed (int) – Random seed to use. Defaults to 42.

Retruns:
pandas.DataFrame:

DataFrame with two columns, age and income.

climb.tool.impl.data_suite.third_party.copulas.datasets.sample_trivariate_xyz(size=1000, seed=42)[source]

Sample from three dimensional toy dataset.

The output is a DataFrame containing three columns:

  • x: Beta distribution with a=0.1 and b=0.1

  • y: Beta distribution with a=0.1 and b=0.5

  • z: Normal distribution + 10 times y

Parameters:
  • size (int) – Amount of samples to generate. Defaults to 1000.

  • seed (int) – Random seed to use. Defaults to 42.

Retruns:
pandas.DataFrame:

DataFrame with three columns, x, y and z.

climb.tool.impl.data_suite.third_party.copulas.datasets.sample_univariate_bernoulli(size=1000, seed=42)[source]

Sample from a Bernoulli distribution with p=0.3.

The distribution is built by sampling a uniform random and then setting 0 or 1 depending on whether the value is above or below 0.3.

Parameters:
  • size (int) – Amount of samples to generate. Defaults to 1000.

  • seed (int) – Random seed to use. Defaults to 42.

Retruns:
pandas.Series:

Series with the sampled values.

climb.tool.impl.data_suite.third_party.copulas.datasets.sample_univariate_beta(size=1000, seed=42)[source]

Sample from a beta distribution with a=3 and b=1 and loc=4.

Parameters:
  • size (int) – Amount of samples to generate. Defaults to 1000.

  • seed (int) – Random seed to use. Defaults to 42.

Retruns:
pandas.Series:

Series with the sampled values.

climb.tool.impl.data_suite.third_party.copulas.datasets.sample_univariate_bimodal(size=1000, seed=42)[source]

Sample from a bimodal distribution which mixes two Gaussians at 0.0 and 10.0 with stdev=1.

The distribution is built by sampling a standard normal and a normal with mean 10 and then selecting one or the other based on a bernoulli distribution.

Parameters:
  • size (int) – Amount of samples to generate. Defaults to 1000.

  • seed (int) – Random seed to use. Defaults to 42.

Retruns:
pandas.Series:

Series with the sampled values.

climb.tool.impl.data_suite.third_party.copulas.datasets.sample_univariate_degenerate(size=1000, seed=42)[source]

Sample from a degenerate distribution that only takes one random value.

Parameters:
  • size (int) – Amount of samples to generate. Defaults to 1000.

  • seed (int) – Random seed to use. Defaults to 42.

Retruns:
pandas.Series:

Series with the sampled values.

climb.tool.impl.data_suite.third_party.copulas.datasets.sample_univariate_exponential(size=1000, seed=42)[source]

Sample from an exponential distribution at 3.0 with rate 1.0.

Parameters:
  • size (int) – Amount of samples to generate. Defaults to 1000.

  • seed (int) – Random seed to use. Defaults to 42.

Retruns:
pandas.Series:

Series with the sampled values.

climb.tool.impl.data_suite.third_party.copulas.datasets.sample_univariate_normal(size=1000, seed=42)[source]

Sample from a normal distribution with mean 1 and stdev 1.

Parameters:
  • size (int) – Amount of samples to generate. Defaults to 1000.

  • seed (int) – Random seed to use. Defaults to 42.

Retruns:
pandas.Series:

Series with the sampled values.

climb.tool.impl.data_suite.third_party.copulas.datasets.sample_univariate_uniform(size=1000, seed=42)[source]

Sample from a uniform distribution in [-1.0, 3.0].

Parameters:
  • size (int) – Amount of samples to generate. Defaults to 1000.

  • seed (int) – Random seed to use. Defaults to 42.

Retruns:
pandas.Series:

Series with the sampled values.

climb.tool.impl.data_suite.third_party.copulas.datasets.sample_univariates(size=1000, seed=42)[source]

Sample from a list of univariate distributions.

Parameters:
  • size (int) – Amount of samples to generate. Defaults to 1000.

  • seed (int) – Random seed to use. Defaults to 42.

Retruns:
pandas.DataFrame:

DataFrame with the sampled distributions.

climb.tool.impl.data_suite.third_party.copulas.visualization module

climb.tool.impl.data_suite.third_party.copulas.visualization.compare_1d(real, synth, columns=None, figsize=None)[source]
climb.tool.impl.data_suite.third_party.copulas.visualization.compare_2d(real, synth, columns=None, figsize=None)[source]
climb.tool.impl.data_suite.third_party.copulas.visualization.compare_3d(real, synth, columns=None, figsize=(10, 4))[source]
climb.tool.impl.data_suite.third_party.copulas.visualization.hist_1d(data, fig=None, title=None, position=None, bins=20, label=None)[source]

Plot 1 dimensional data in a histogram.

climb.tool.impl.data_suite.third_party.copulas.visualization.scatter_2d(data, columns=None, fig=None, title=None, position=None)[source]

Plot 2 dimensional data in a scatter plot.

climb.tool.impl.data_suite.third_party.copulas.visualization.scatter_3d(data, columns=None, fig=None, title=None, position=None)[source]

Plot 3 dimensional data in a scatter plot.

climb.tool.impl.data_suite.third_party.copulas.visualization.side_by_side(plotting_func, arrays)[source]

Module contents

Top-level package for Copulas.

exception climb.tool.impl.data_suite.third_party.copulas.NotFittedError[source]

Bases: Exception

climb.tool.impl.data_suite.third_party.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.

climb.tool.impl.data_suite.third_party.copulas.get_instance(obj, **kwargs)[source]

Create new instance of the obj argument.

Parameters:

obj (str, type, instance)

climb.tool.impl.data_suite.third_party.copulas.get_qualified_name(_object)[source]

Return the Fully Qualified Name from an instance or class.

climb.tool.impl.data_suite.third_party.copulas.random_seed(seed)[source]
climb.tool.impl.data_suite.third_party.copulas.random_state(function)[source]
climb.tool.impl.data_suite.third_party.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

climb.tool.impl.data_suite.third_party.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

climb.tool.impl.data_suite.third_party.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