-
Notifications
You must be signed in to change notification settings - Fork 54
Expand file tree
/
Copy pathtest_pred.py
More file actions
23 lines (20 loc) · 773 Bytes
/
test_pred.py
File metadata and controls
23 lines (20 loc) · 773 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from sklearn.linear_model import RidgeClassifier
from adapt.utils import make_classification_da
from adapt.feature_based import PRED
Xs, ys, Xt, yt = make_classification_da()
def test_pred():
model = PRED(RidgeClassifier(), pretrain=True, Xt=Xt[:3], yt=yt[:3],
verbose=0, random_state=0)
model.fit(Xs, ys)
model.predict(Xt)
model.predict(Xt, "src")
model.score(Xt, yt, domain="src")
model.score(Xt, yt, domain="tgt")
model = PRED(RidgeClassifier().fit(Xs, ys),
pretrain=False, Xt=Xt[:3], yt=yt[:3],
verbose=0, random_state=0)
model.fit(Xs, ys)
model.predict(Xt)
model.predict(Xt, "src")
model.score(Xt, yt, domain="src")
model.score(Xt, yt, domain="tgt")