2
2
Test base
3
3
"""
4
4
5
+ import os
5
6
from sklearn .linear_model import LogisticRegression , LinearRegression
6
7
from sklearn .model_selection import GridSearchCV
7
8
from adapt .base import BaseAdaptDeep , BaseAdaptEstimator
@@ -34,19 +35,20 @@ def test_all_metrics():
34
35
35
36
36
37
def test_adapt_scorer ():
37
- scorer = make_uda_scorer (j_score , Xs , Xt )
38
- adapt_model = KMM (LinearRegression (), Xt = Xt , kernel = "rbf" , gamma = 0. )
39
- gs = GridSearchCV (adapt_model , {"gamma" : [1000 , 1e-5 ]},
40
- scoring = scorer , return_train_score = True ,
41
- cv = 3 , verbose = 0 , refit = False )
42
- gs .fit (Xs , ys )
43
- assert gs .cv_results_ ['mean_train_score' ].argmax () == 0
44
-
45
- scorer = make_uda_scorer (cov_distance , Xs , Xt )
46
- adapt_model = CORAL (LinearRegression (), Xt = Xt , lambda_ = 1. )
47
- gs = GridSearchCV (adapt_model , {"lambda_" : [1e-5 , 10000. ]},
48
- scoring = scorer , return_train_score = True ,
49
- cv = 3 , verbose = 0 , refit = False )
50
- gs .fit (Xs , ys )
51
- assert gs .cv_results_ ['mean_train_score' ].argmax () == 0
52
- assert gs .cv_results_ ['mean_test_score' ].argmax () == 0
38
+ if os .name != 'nt' :
39
+ scorer = make_uda_scorer (j_score , Xs , Xt )
40
+ adapt_model = KMM (LinearRegression (), Xt = Xt , kernel = "rbf" , gamma = 0. )
41
+ gs = GridSearchCV (adapt_model , {"gamma" : [1000 , 1e-5 ]},
42
+ scoring = scorer , return_train_score = True ,
43
+ cv = 3 , verbose = 0 , refit = False )
44
+ gs .fit (Xs , ys )
45
+ assert gs .cv_results_ ['mean_train_score' ].argmax () == 0
46
+
47
+ scorer = make_uda_scorer (cov_distance , Xs , Xt )
48
+ adapt_model = CORAL (LinearRegression (), Xt = Xt , lambda_ = 1. )
49
+ gs = GridSearchCV (adapt_model , {"lambda_" : [1e-5 , 10000. ]},
50
+ scoring = scorer , return_train_score = True ,
51
+ cv = 3 , verbose = 0 , refit = False )
52
+ gs .fit (Xs , ys )
53
+ assert gs .cv_results_ ['mean_train_score' ].argmax () == 0
54
+ assert gs .cv_results_ ['mean_test_score' ].argmax () == 0
0 commit comments