55from sklearn .datasets import load_iris
66from sklearn .utils import check_random_state , extmath
77
8- from skmatter .linear_model import OrthogonalRegression , RidgeRegression2FoldCV
8+ from skmatter .linear_model import OrthogonalRegression , Ridge2FoldCV
99
1010
1111class BaseTests (unittest .TestCase ):
@@ -108,37 +108,35 @@ def setUpClass(cls):
108108 cls .ridge_regressions = []
109109
110110 def test_ridge_regression_2fold_regularization_method_raise_error (self ):
111- # tests if wrong regularization_method in RidgeRegression2FoldCV raises error
111+ # tests if wrong regularization_method in Ridge2FoldCV raises error
112112 with self .assertRaises (ValueError ):
113- RidgeRegression2FoldCV (
113+ Ridge2FoldCV (
114114 regularization_method = "dummy" ,
115115 ).fit (self .features_small , self .features_small )
116116
117117 def test_ridge_regression_2fold_alpha_type_raise_error (self ):
118- # tests if wrong alpha type in RidgeRegression2FoldCV raises error
118+ # tests if wrong alpha type in Ridge2FoldCV raises error
119119 with self .assertRaises (ValueError ):
120- RidgeRegression2FoldCV (
120+ Ridge2FoldCV (
121121 alpha_type = "dummy" ,
122122 ).fit (self .features_small , self .features_small )
123123
124124 def test_ridge_regression_2fold_relative_alpha_type_raise_error (self ):
125125 # tests if an error is raised if alpha not in [0,1)
126126 with self .assertRaises (ValueError ):
127- RidgeRegression2FoldCV (alphas = [1 ], alpha_type = "relative" ).fit (
127+ Ridge2FoldCV (alphas = [1 ], alpha_type = "relative" ).fit (
128128 self .features_small , self .features_small
129129 )
130130
131131 with self .assertRaises (ValueError ):
132- RidgeRegression2FoldCV (alphas = [- 0.1 ], alpha_type = "relative" ).fit (
132+ Ridge2FoldCV (alphas = [- 0.1 ], alpha_type = "relative" ).fit (
133133 self .features_small , self .features_small
134134 )
135135
136136 def test_ridge_regression_2fold_iterable_cv (self ):
137137 # tests if we can use iterable as cv parameter
138138 cv = [([0 , 1 , 2 , 3 ], [4 , 5 , 6 ])]
139- RidgeRegression2FoldCV (alphas = [1 ], cv = cv ).fit (
140- self .features_small , self .features_small
141- )
139+ Ridge2FoldCV (alphas = [1 ], cv = cv ).fit (self .features_small , self .features_small )
142140
143141 ridge_parameters = [
144142 ["absolute_tikhonov" , "absolute" , "tikhonov" ],
@@ -151,11 +149,11 @@ def test_ridge_regression_2fold_iterable_cv(self):
151149 def test_ridge_regression_2fold_cv_small_to_small (
152150 self , name , alpha_type , regularization_method
153151 ):
154- # tests if RidgeRegression2FoldCV can predict small features using small
152+ # tests if Ridge2FoldCV can predict small features using small
155153 # features with use_orthogonal_projector False
156154 err = np .linalg .norm (
157155 self .features_small
158- - RidgeRegression2FoldCV (
156+ - Ridge2FoldCV (
159157 alphas = self .alphas ,
160158 alpha_type = alpha_type ,
161159 regularization_method = regularization_method ,
@@ -169,7 +167,7 @@ def test_ridge_regression_2fold_cv_small_to_small(
169167
170168 @parameterized .expand (ridge_parameters )
171169 def test_ridge_regression_2fold_cv_small_to_large (
172- # tests if RidgeRegression2FoldCV can predict large features using small
170+ # tests if Ridge2FoldCV can predict large features using small
173171 # features with use_orthogonal_projector False
174172 self ,
175173 name ,
@@ -178,7 +176,7 @@ def test_ridge_regression_2fold_cv_small_to_large(
178176 ):
179177 err = np .linalg .norm (
180178 self .features_large
181- - RidgeRegression2FoldCV (
179+ - Ridge2FoldCV (
182180 alphas = self .alphas ,
183181 alpha_type = alpha_type ,
184182 regularization_method = regularization_method ,
@@ -196,7 +194,7 @@ def test_ridge_regression_2fold_regularization(
196194 self , name , alpha_type , regularization_method
197195 ):
198196 # tests if the regularization in the CV split of
199- # RidgeRegression2FoldCV does effect the results
197+ # Ridge2FoldCV does effect the results
200198
201199 # regularization parameters are chosen to match the singular values o
202200 # the features, thus each regularization parameter affects the minimized
@@ -207,8 +205,8 @@ def test_ridge_regression_2fold_regularization(
207205 if alpha_type == "relative" :
208206 alphas = singular_values [1 :][::- 1 ] / singular_values [0 ]
209207
210- # tests if RidgeRegression2FoldCV does do regularization correct
211- ridge = RidgeRegression2FoldCV (
208+ # tests if Ridge2FoldCV does do regularization correct
209+ ridge = Ridge2FoldCV (
212210 alphas = alphas ,
213211 alpha_type = alpha_type ,
214212 regularization_method = regularization_method ,
0 commit comments