Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove target labels in the method comparison example #92

Merged
merged 3 commits into from
Feb 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions examples/plot_method_comparison.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
CORAL
)
from skada.datasets import make_shifted_datasets
from skada import source_target_split

# Use same random seed for multiple calls to make_datasets to
# ensure same distributions
Expand Down Expand Up @@ -83,41 +82,45 @@
shift="covariate_shift",
label="binary",
noise=0.4,
random_state=RANDOM_SEED
random_state=RANDOM_SEED,
return_dataset=True
),
make_shifted_datasets(
n_samples_source=20,
n_samples_target=20,
shift="target_shift",
label="binary",
noise=0.4,
random_state=RANDOM_SEED
random_state=RANDOM_SEED,
return_dataset=True
),
make_shifted_datasets(
n_samples_source=20,
n_samples_target=20,
shift="concept_drift",
label="binary",
noise=0.4,
random_state=RANDOM_SEED
random_state=RANDOM_SEED,
return_dataset=True
),
make_shifted_datasets(
n_samples_source=20,
n_samples_target=20,
shift="subspace",
label="binary",
noise=0.4,
random_state=RANDOM_SEED
random_state=RANDOM_SEED,
return_dataset=True
),
]

figure, axes = plt.subplots(len(classifiers) + 2, len(datasets), figsize=(9, 27))
# iterate over datasets
for ds_cnt, ds in enumerate(datasets):
# preprocess dataset, split into training and test part
X, y, sample_domain = ds

Xs, Xt, ys, yt = source_target_split(X, y, sample_domain=sample_domain)
X, y, sample_domain = ds.pack_train(as_sources=['s'], as_targets=['t'])
Xs, ys = ds.get_domain("s")
Xt, yt = ds.get_domain("t")

x_min, x_max = X[:, 0].min() - 0.5, X[:, 0].max() + 0.5
y_min, y_max = X[:, 1].min() - 0.5, X[:, 1].max() + 0.5
Expand Down
Loading