In [1]:
%matplotlib inline

In [2]:
import os, sys
sys.path.append(os.path.abspath('../../main/python'))

import numpy as np
import matplotlib.pyplot as plt

import thalesians.tsa.distrs as distrs

In [3]:
normal_distr = distrs.NormalDistr([3., 7.], [[4., -3.], [-3., 9.]])

In [4]:
normal_distr


Out[4]:
NormalDistr(mean=[[3.]
 [7.]], cov=[[ 4. -3.]
 [-3.  9.]])

In [5]:
normal_distr.mean


Out[5]:
array([[3.],
       [7.]])

In [6]:
normal_distr.cov


Out[6]:
array([[ 4., -3.],
       [-3.,  9.]])

In [7]:
data = normal_distr.sample(1000)

In [8]:
np.shape(data)


Out[8]:
(1000, 2)

In [9]:
plt.plot(data, 'x');



In [10]:
empirical_distr = distrs.EmpiricalDistr(data)

In [11]:
empirical_distr.particle_count


Out[11]:
1000

In [12]:
empirical_distr.dim


Out[12]:
2

In [13]:
empirical_distr.weight_sum


Out[13]:
1.0000000000000004

In [14]:
empirical_distr.mean


Out[14]:
array([[3.03771919],
       [7.13587533]])

In [15]:
empirical_distr.var


Out[15]:
array([[3.90916885],
       [8.37304867]])

In [16]:
empirical_distr.cov


Out[16]:
array([[ 3.90916885, -2.65787735],
       [-2.65787735,  8.37304867]])

In [17]:
empirical_distr.vol

In [18]:
empirical_distr.var_n


Out[18]:
array([[3.90916885],
       [8.37304867]])

In [19]:
empirical_distr.cov_n


Out[19]:
array([[ 3.90916885, -2.65787735],
       [-2.65787735,  8.37304867]])

In [20]:
empirical_distr.vol_n


Out[20]:
array([[ 1.97716182,  0.        ],
       [-1.34428924,  2.56240807]])

In [21]:
empirical_distr.var_n_minus_1


Out[21]:
array([[8.80266568e+15],
       [1.88544294e+16]])

In [22]:
empirical_distr.cov_n_minus_1


Out[22]:
array([[ 8.80266568e+15, -5.98500773e+15],
       [-5.98500773e+15,  1.88544294e+16]])

In [23]:
empirical_distr.vol_n_minus_1


Out[23]:
array([[ 9.38225222e+07,  0.00000000e+00],
       [-6.37907358e+07,  1.21594290e+08]])

In [24]:
empirical_distr


Out[24]:
EmpiricalDistr(mean=[[3.03771919]
 [7.13587533]], cov=[[ 3.90916885 -2.65787735]
 [-2.65787735  8.37304867]], particle_count=1000, dim=2)