scikit-adaptation / skada

Domain adaptation toolbox compatible with scikit-learn and pytorch
https://scikit-adaptation.github.io/
BSD 3-Clause "New" or "Revised" License
56 stars 16 forks source link

Fix masked inputs filtering in the base selector for regression tasks #86

Closed kachayev closed 5 months ago

kachayev commented 5 months ago

Closes #83.

import numpy as np
from sklearn.linear_model import LinearRegression
from skada import KLIEP

X_source = np.ones(10)
X_target = X_source

y_source = np.ones(10)
y_target = np.zeros(10)

from skada.datasets import DomainAwareDataset
dataset = DomainAwareDataset([(X_source, y_source, 's'), (X_target, y_target, 't')])
X, y, sample_domain = dataset.pack_train(as_sources=['s'], as_targets=['t'])

lr = LinearRegression()

kliep = KLIEP(base_estimator=lr)

kliep.fit(X.reshape(-1, 1), y, sample_domain=sample_domain)
kliep.predict(X.reshape(-1, 1))
Out[7]:
array([1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,
       1., 1., 1.])
codecov[bot] commented 5 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (78d42f3) 87.34% compared to head (027a492) 87.35%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #86 +/- ## ========================================== + Coverage 87.34% 87.35% +0.01% ========================================== Files 38 38 Lines 2433 2435 +2 ========================================== + Hits 2125 2127 +2 Misses 308 308 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.