Skip to content

antoinedemathelin/dbal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Discrepancy-Based Active Learning for Domain Adaptation

Requirements

The following packages are required to run the experiments:

  • tensorflow (>= 2.0)
  • scikit-learn
  • numpy
  • pandas
  • Pillow
  • matplotlib (for visualization)

Besides, the adapt package has been used for TrAdaBoost and DANN

Example

A simple example is provided in notebooks/Toy_example. It presents an application of the K-medoids algorithm on the following toy domain adaptation problem:

from utils import toy_example

np.random.seed(2)
Xs, Xt, f = toy_example()
ys = f(Xs)
yt = f(Xt)

Given a budget of 10 queries, the labels selection can be optimized using the K-medoids algorithm:

from query_methods import KMedoidsQuery

np.random.seed(0)
kmedoids = KMedoidsQuery()
kmedoids.fit(Xt, Xs, ys, 10)
queries = kmedoids.predict(10)

np.random.seed(0)
model = MLPRegressor()
model.fit(np.concatenate((Xs, Xt[queries])), np.concatenate((ys, yt[queries])))
y_pred = model.predict(X)
score = mean_absolute_error(yt, model.predict(Xt))
print("Target MAE = %.3f"%score)

>>> Target MAE = 0.077

Experiments

The experiments are conducted on three benchmark datasets:

Experiments can be run with the following command lines:

cd dbal
python run_experiments.py

Notebooks

Quick results can be obtained in the notebooks folder:

Superconductivity

name

Office

name

Digits

name

About

discrepancy-based-active-learning

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published