-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor experiments.py, add gaussial_kl.py in metrics
- Loading branch information
1 parent
13f4a9d
commit 3732831
Showing
3 changed files
with
41 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,32 @@ | ||
from labproject.experiments import scaling_sliced_wasserstein_samples | ||
from labproject.plotting import plot_scaling_metric_dimensionality | ||
|
||
print("Running experiments...") | ||
dimensionality, distances = scaling_sliced_wasserstein_samples() | ||
plot_scaling_metric_dimensionality( | ||
dimensionality, distances, "Sliced Wasserstein", "Random Dataset" | ||
) | ||
print("Finished running experiments.") | ||
from labproject.experiments import * | ||
from labproject.plotting import * | ||
import time | ||
|
||
if __name__ == "__main__": | ||
|
||
print("Running experiments...") | ||
experiment = Experiment() | ||
|
||
experiment_results = {} | ||
# for exp_name in ['scaling_sliced_wasserstein_samples', 'scaling_kl_samples']: | ||
for exp_name in ["scaling_kl_samples"]: | ||
time_start = time.time() | ||
for i_d, dataset_pair in enumerate( | ||
[ | ||
[random_dataset(n=100000, d=100), random_dataset(n=100000, d=100)], | ||
] | ||
): | ||
dataset1, dataset2 = dataset_pair | ||
experiment_fn = globals()[exp_name] | ||
dimensionality, distances = experiment.run_experiment( | ||
dataset1=dataset1, dataset2=dataset2, experiment_fn=experiment_fn | ||
) | ||
experiment_results[(exp_name, i_d)] = (dimensionality, distances) | ||
time_end = time.time() | ||
print(f"Experiment {exp_name} finished in {time_end - time_start}") | ||
|
||
# single plot | ||
# plot_scaling_metric_dimensionality(dimensionality, distances, "Sliced Wasserstein", "Random Dataset") | ||
plot_scaling_metric_dimensionality(dimensionality, distances, "KL", "Random Dataset") | ||
|
||
print("Finished running experiments.") |