tick.simulation

This module provides basic tools for the simulation of model weights and features matrices. This is particularly useful to test optimization algorithms, and to compare the statistical properties of inference methods.

1. Simulation of model weights

Here are functions for the simulation of model weights.

weights_sparse_exp([n_weigths, nnz, scale, …])

Sparse and exponential model weights generator

weights_sparse_gauss([n_weights, nnz, std, …])

Sparse and gaussian model weights generator Instance of weights for a model, given by a sparse vector, where non-zero coordinates (chosen at random) are centered Gaussian with given standard-deviation

Example

import matplotlib.pyplot as plt
from tick.simulation import weights_sparse_exp, weights_sparse_gauss

n_features = 100
weights1 = weights_sparse_exp(n_features, nnz=20)
weights2 = weights_sparse_gauss(n_features, nnz=10)

plt.figure(figsize=(10, 3))
plt.subplot(1, 2, 1)
plt.stem(weights1)
plt.subplot(1, 2, 2)
plt.stem(weights2)

plt.tight_layout()
plt.show()

(Source code, png, hires.png, pdf)

../_images/plot_simulation_weights1.png

2. Simulation of a features matrix

Here are functions for the simulation of a features matrix: each simulated vector or features is distributed as a centered Gaussian vector with a particular covariance matrix (uniform symmetrized or toeplitz).

features_normal_cov_uniform([n_samples, …])

Normal features generator with uniform covariance

features_normal_cov_toeplitz([n_samples, …])

Normal features generator with toeplitz covariance