33import pytest
44from scipy .stats import expon , gamma , halfnorm , pareto
55
6- from src .estimators .semiparametric .nmv_semiparametric_estimator import NMVSemiParametricEstimator
6+ from src .estimators .semiparametric .nmv_semiparametric_estimator import NMVSemiparEstim
77from src .generators .nmv_generator import NMVGenerator
88from src .mixtures .nmv_mixture import NormalMeanVarianceMixtures
99
@@ -15,47 +15,47 @@ class TestSemiParametricMuEstimation:
1515 def test_mu_estimation_expon_no_parameters (self , real_mu : float ) -> None :
1616 mixture = NormalMeanVarianceMixtures ("canonical" , alpha = 0 , mu = real_mu , distribution = expon )
1717 sample = self .generator .canonical_generate (mixture , 10000 )
18- estimator = NMVSemiParametricEstimator ("mu_estimation" )
18+ estimator = NMVSemiparEstim ("mu_estimation" )
1919 est = estimator .estimate (sample )
2020 assert abs (real_mu - est .value ) < 1 and est .success is True
2121
2222 @pytest .mark .parametrize ("real_mu" , [10 ** i for i in range (0 , - 10 , - 2 )])
2323 def test_mu_estimation_expon_no_parameters_small (self , real_mu : float ) -> None :
2424 mixture = NormalMeanVarianceMixtures ("canonical" , alpha = 0 , mu = real_mu , distribution = expon )
2525 sample = self .generator .canonical_generate (mixture , 10000 )
26- estimator = NMVSemiParametricEstimator ("mu_estimation" )
26+ estimator = NMVSemiparEstim ("mu_estimation" )
2727 est = estimator .estimate (sample )
2828 assert abs (real_mu - est .value ) < 1 and est .success is True
2929
3030 @pytest .mark .parametrize ("real_mu" , [i for i in range (- 3 , 3 )])
3131 def test_mu_estimation_pareto_no_parameters (self , real_mu : float ) -> None :
3232 mixture = NormalMeanVarianceMixtures ("canonical" , alpha = 0 , mu = real_mu , distribution = pareto (2.62 ))
3333 sample = self .generator .canonical_generate (mixture , 50000 )
34- estimator = NMVSemiParametricEstimator ("mu_estimation" )
34+ estimator = NMVSemiparEstim ("mu_estimation" )
3535 est = estimator .estimate (sample )
3636 assert abs (real_mu - est .value ) < 1 and est .success is True
3737
3838 @pytest .mark .parametrize ("real_mu" , [10 ** i for i in range (0 , - 10 , - 2 )])
3939 def test_mu_estimation_pareto_no_parameters_small (self , real_mu : float ) -> None :
4040 mixture = NormalMeanVarianceMixtures ("canonical" , alpha = 0 , mu = real_mu , distribution = pareto (2.62 ))
4141 sample = self .generator .canonical_generate (mixture , 50000 )
42- estimator = NMVSemiParametricEstimator ("mu_estimation" )
42+ estimator = NMVSemiparEstim ("mu_estimation" )
4343 est = estimator .estimate (sample )
4444 assert abs (real_mu - est .value ) < 1 and est .success is True
4545
4646 @pytest .mark .parametrize ("real_mu" , [i for i in range (- 3 , 3 )])
4747 def test_mu_estimation_halfnorm_no_parameters (self , real_mu : float ) -> None :
4848 mixture = NormalMeanVarianceMixtures ("canonical" , alpha = 0 , mu = real_mu , distribution = halfnorm )
4949 sample = self .generator .canonical_generate (mixture , 10000 )
50- estimator = NMVSemiParametricEstimator ("mu_estimation" )
50+ estimator = NMVSemiparEstim ("mu_estimation" )
5151 est = estimator .estimate (sample )
5252 assert abs (real_mu - est .value ) < 1 and est .success is True
5353
5454 @pytest .mark .parametrize ("real_mu" , [i for i in range (- 3 , 3 )])
5555 def test_mu_estimation_gamma_no_parameters (self , real_mu : float ) -> None :
5656 mixture = NormalMeanVarianceMixtures ("canonical" , alpha = 0 , mu = real_mu , distribution = gamma (2 ))
5757 sample = self .generator .canonical_generate (mixture , 10000 )
58- estimator = NMVSemiParametricEstimator ("mu_estimation" )
58+ estimator = NMVSemiparEstim ("mu_estimation" )
5959 est = estimator .estimate (sample )
6060 assert abs (real_mu - est .value ) < 1 and est .success is True
6161
@@ -64,7 +64,7 @@ def test_mu_estimation_expon_1_parameter_m_positive(self, params: dict) -> None:
6464 real_mu = 1
6565 mixture = NormalMeanVarianceMixtures ("canonical" , alpha = 0 , mu = real_mu , distribution = expon )
6666 sample = self .generator .canonical_generate (mixture , 10000 )
67- estimator = NMVSemiParametricEstimator ("mu_estimation" , params )
67+ estimator = NMVSemiparEstim ("mu_estimation" , params )
6868 est = estimator .estimate (sample )
6969 assert abs (real_mu - est .value ) < 1 and est .success is True
7070
@@ -73,7 +73,7 @@ def test_mu_estimation_expon_1_parameter_m_negative(self, params: dict) -> None:
7373 real_mu = - 1
7474 mixture = NormalMeanVarianceMixtures ("canonical" , alpha = 0 , mu = real_mu , distribution = expon )
7575 sample = self .generator .canonical_generate (mixture , 10000 )
76- estimator = NMVSemiParametricEstimator ("mu_estimation" , params )
76+ estimator = NMVSemiparEstim ("mu_estimation" , params )
7777 est = estimator .estimate (sample )
7878 assert abs (real_mu - est .value ) < 1 and est .success is True
7979
@@ -84,7 +84,7 @@ def test_mu_estimation_expon_1_parameter_max_iterations(self, params: dict) -> N
8484 real_mu = 1
8585 mixture = NormalMeanVarianceMixtures ("canonical" , alpha = 0 , mu = real_mu , distribution = expon )
8686 sample = self .generator .canonical_generate (mixture , 10000 )
87- estimator = NMVSemiParametricEstimator ("mu_estimation" , params )
87+ estimator = NMVSemiparEstim ("mu_estimation" , params )
8888 est = estimator .estimate (sample )
8989 assert abs (real_mu - est .value ) < 1 and est .success is True
9090
@@ -93,7 +93,7 @@ def test_mu_estimation_expon_1_parameter_m_is_best_estimation(self, params: dict
9393 real_mu = 10
9494 mixture = NormalMeanVarianceMixtures ("canonical" , alpha = 0 , mu = real_mu , distribution = expon )
9595 sample = self .generator .canonical_generate (mixture , 10000 )
96- estimator = NMVSemiParametricEstimator ("mu_estimation" , params )
96+ estimator = NMVSemiparEstim ("mu_estimation" , params )
9797 est = estimator .estimate (sample )
9898 assert abs (est .value == params ["m" ]) and est .success is False
9999
@@ -104,7 +104,7 @@ def test_mu_estimation_expon_2_parameters_tol_positive(self, params: dict) -> No
104104 real_mu = 1
105105 mixture = NormalMeanVarianceMixtures ("canonical" , alpha = 0 , mu = real_mu , distribution = expon )
106106 sample = self .generator .canonical_generate (mixture , 10000 )
107- estimator = NMVSemiParametricEstimator ("mu_estimation" , params )
107+ estimator = NMVSemiparEstim ("mu_estimation" , params )
108108 est = estimator .estimate (sample )
109109 assert abs (real_mu - est .value ) < 1 and est .success is True
110110
@@ -115,7 +115,7 @@ def test_mu_estimation_expon_2_parameters_tol_negative(self, params: dict) -> No
115115 real_mu = - 1
116116 mixture = NormalMeanVarianceMixtures ("canonical" , alpha = 0 , mu = real_mu , distribution = expon )
117117 sample = self .generator .canonical_generate (mixture , 10000 )
118- estimator = NMVSemiParametricEstimator ("mu_estimation" , params )
118+ estimator = NMVSemiparEstim ("mu_estimation" , params )
119119 est = estimator .estimate (sample )
120120 assert abs (real_mu - est .value ) < 1 and est .success is True
121121
@@ -132,7 +132,7 @@ def test_mu_estimation_expon_3_parameters_omega_positive(self, params: dict) ->
132132 real_mu = 1
133133 mixture = NormalMeanVarianceMixtures ("canonical" , alpha = 0 , mu = real_mu , distribution = expon )
134134 sample = self .generator .canonical_generate (mixture , 10000 )
135- estimator = NMVSemiParametricEstimator ("mu_estimation" , params )
135+ estimator = NMVSemiparEstim ("mu_estimation" , params )
136136 est = estimator .estimate (sample )
137137 assert abs (real_mu - est .value ) < 1 and est .success is True
138138
@@ -149,7 +149,7 @@ def test_mu_estimation_expon_3_parameters_omega_negative(self, params: dict) ->
149149 real_mu = - 1
150150 mixture = NormalMeanVarianceMixtures ("canonical" , alpha = 0 , mu = real_mu , distribution = expon )
151151 sample = self .generator .canonical_generate (mixture , 10000 )
152- estimator = NMVSemiParametricEstimator ("mu_estimation" , params )
152+ estimator = NMVSemiparEstim ("mu_estimation" , params )
153153 est = estimator .estimate (sample )
154154 assert abs (real_mu - est .value ) < 1 and est .success is True
155155
@@ -168,7 +168,7 @@ def test_mu_estimation_expon_3_parameters_all_positive(self, params: dict) -> No
168168 real_mu = 1
169169 mixture = NormalMeanVarianceMixtures ("canonical" , alpha = 0 , mu = real_mu , distribution = expon )
170170 sample = self .generator .canonical_generate (mixture , 10000 )
171- estimator = NMVSemiParametricEstimator ("mu_estimation" , params )
171+ estimator = NMVSemiparEstim ("mu_estimation" , params )
172172 est = estimator .estimate (sample )
173173 assert abs (real_mu - est .value ) < 1 and est .success is True
174174
@@ -187,6 +187,6 @@ def test_mu_estimation_expon_3_parameters_all_negative(self, params: dict) -> No
187187 real_mu = - 1
188188 mixture = NormalMeanVarianceMixtures ("canonical" , alpha = 0 , mu = real_mu , distribution = expon )
189189 sample = self .generator .canonical_generate (mixture , 10000 )
190- estimator = NMVSemiParametricEstimator ("mu_estimation" , params )
190+ estimator = NMVSemiparEstim ("mu_estimation" , params )
191191 est = estimator .estimate (sample )
192192 assert abs (real_mu - est .value ) < 1 and est .success is True
0 commit comments