@@ -78,8 +78,8 @@ def __init__(
7878 dependency_type = "accumulate" , length = len (samples ),
7979 )
8080
81- self .samples = samples
82- self .h_mat = covariance
81+ self ._samples = samples
82+ self ._covariance = covariance
8383 self ._permute = numpy .eye (len (rotation ), dtype = int )[rotation ]
8484 self ._pcovariance = numpy .matmul (numpy .matmul (
8585 self ._permute , covariance ), self ._permute .T )
@@ -107,9 +107,9 @@ def get_parameters(self, idx, cache, assert_numerical=True):
107107
108108 def _pdf (self , x_loc , idx , dim , cache ):
109109 """Kernel density function."""
110- s , t = numpy .mgrid [:x_loc .shape [- 1 ], :self .samples .shape [- 1 ]]
110+ s , t = numpy .mgrid [:x_loc .shape [- 1 ], :self ._samples .shape [- 1 ]]
111111 if not dim :
112- samples = self .samples [idx , t ]
112+ samples = self ._samples [idx , t ]
113113 z_loc = ((x_loc [s ]- samples )* self ._fwd_transform [:, 0 , 0 ])
114114 self ._zloc = z_loc [:, :, numpy .newaxis ]
115115 kernel = self ._kernel (self ._zloc )/ self ._inv_transform [:, 0 , 0 ]
@@ -122,7 +122,7 @@ def _pdf(self, x_loc, idx, dim, cache):
122122 x_loc = [self ._get_cache (dim_ , cache , get = 0 )
123123 for dim_ in self ._rotation [:dim ]] + [x_loc ]
124124 x_loc = numpy .dstack ([x [s ] for x in x_loc ])
125- samples = numpy .dstack ([self .samples [dim_ , t ]
125+ samples = numpy .dstack ([self ._samples [dim_ , t ]
126126 for dim_ in self ._rotation [:dim + 1 ]])
127127 zloc = numpy .sum ((x_loc - samples )* self ._fwd_transform [:, dim , :dim + 1 ], - 1 )
128128 self ._zloc = numpy .dstack ([self ._zloc [:, :, :dim ], zloc ])
@@ -138,9 +138,9 @@ def _pdf(self, x_loc, idx, dim, cache):
138138
139139 def _cdf (self , x_loc , idx , dim , cache ):
140140 """Forward mapping."""
141- s , t = numpy .mgrid [:x_loc .shape [- 1 ], :self .samples .shape [- 1 ]]
141+ s , t = numpy .mgrid [:x_loc .shape [- 1 ], :self ._samples .shape [- 1 ]]
142142 if not dim :
143- z_loc = (x_loc [s ]- self .samples [idx , t ])* self ._fwd_transform [:, 0 , 0 ]
143+ z_loc = (x_loc [s ]- self ._samples [idx , t ])* self ._fwd_transform [:, 0 , 0 ]
144144 self ._zloc = z_loc [:, :, numpy .newaxis ]
145145 out = numpy .sum (self ._ikernel (z_loc )* self .weights , axis = - 1 )
146146 assert out .shape == x_loc .shape , (out .shape , x_loc .shape )
@@ -150,7 +150,7 @@ def _cdf(self, x_loc, idx, dim, cache):
150150 for dim_ in self ._rotation [:dim ]] + [x_loc ]
151151 x_loc = numpy .dstack ([x [s ] for x in x_loc ])
152152
153- samples = numpy .dstack ([self .samples [dim_ , t ]
153+ samples = numpy .dstack ([self ._samples [dim_ , t ]
154154 for dim_ in self ._rotation [:dim + 1 ]])
155155 zloc = numpy .sum ((x_loc - samples )* self ._fwd_transform [:, dim , :dim + 1 ], - 1 )
156156 self ._zloc = numpy .dstack ([self ._zloc [:, :, :dim ], zloc ])
@@ -161,7 +161,7 @@ def _cdf(self, x_loc, idx, dim, cache):
161161
162162 def _ppf (self , u_loc , idx , dim , cache ):
163163 """Inverse mapping."""
164- xloc0 = numpy .quantile (self .samples [idx ], u_loc )
164+ xloc0 = numpy .quantile (self ._samples [idx ], u_loc )
165165 out = chaospy .approximate_inverse (
166166 self , idx , u_loc , xloc0 = xloc0 , cache = cache , iterations = 1000 )
167167 return out
0 commit comments