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
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
The experiments are conducted on three benchmark datasets:
Experiments can be run with the following command lines:
cd dbal
python run_experiments.py
Quick results can be obtained in the notebooks
folder: