33import ot
44
55
6- # import pytest
7-
86
97def test_conditional_gradient ():
108
11- n = 100 # nb bins
9+ n_bins = 100 # nb bins
1210 np .random .seed (0 )
1311 # bin positions
14- x = np .arange (n , dtype = np .float64 )
12+ x = np .arange (n_bins , dtype = np .float64 )
1513
1614 # Gaussian distributions
17- a = ot .datasets .get_1D_gauss (n , m = 20 , s = 5 ) # m= mean, s= std
18- b = ot .datasets .get_1D_gauss (n , m = 60 , s = 10 )
15+ a = ot .datasets .get_1D_gauss (n_bins , m = 20 , s = 5 ) # m= mean, s= std
16+ b = ot .datasets .get_1D_gauss (n_bins , m = 60 , s = 10 )
1917
2018 # loss matrix
21- M = ot .dist (x .reshape ((n , 1 )), x .reshape ((n , 1 )))
19+ M = ot .dist (x .reshape ((n_bins , 1 )), x .reshape ((n_bins , 1 )))
2220 M /= M .max ()
2321
2422 def f (G ):
@@ -37,17 +35,17 @@ def df(G):
3735
3836def test_generalized_conditional_gradient ():
3937
40- n = 100 # nb bins
38+ n_bins = 100 # nb bins
4139 np .random .seed (0 )
4240 # bin positions
43- x = np .arange (n , dtype = np .float64 )
41+ x = np .arange (n_bins , dtype = np .float64 )
4442
4543 # Gaussian distributions
46- a = ot .datasets .get_1D_gauss (n , m = 20 , s = 5 ) # m= mean, s= std
47- b = ot .datasets .get_1D_gauss (n , m = 60 , s = 10 )
44+ a = ot .datasets .get_1D_gauss (n_bins , m = 20 , s = 5 ) # m= mean, s= std
45+ b = ot .datasets .get_1D_gauss (n_bins , m = 60 , s = 10 )
4846
4947 # loss matrix
50- M = ot .dist (x .reshape ((n , 1 )), x .reshape ((n , 1 )))
48+ M = ot .dist (x .reshape ((n_bins , 1 )), x .reshape ((n_bins , 1 )))
5149 M /= M .max ()
5250
5351 def f (G ):
0 commit comments