-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add rescaled version of harmonics dataset (#188)
- Loading branch information
Showing
1 changed file
with
23 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
from deep_bottleneck.datasets.base_dataset import Dataset | ||
from deep_bottleneck.datasets.harmonics import load as load_original_harmonics | ||
|
||
|
||
def load(nb_dir='') -> Dataset: | ||
"""Load the Information Bottleneck harmonics dataset with mean 0, i.e. | ||
the original harmonics dataset but 0.5 subtracted | ||
Returns: | ||
The zero centered harmonics dataset. | ||
""" | ||
|
||
data = load_original_harmonics() | ||
|
||
X_train = data.train.examples - 0.5 | ||
y_train = data.train.labels | ||
X_test = data.test.examples - 0.5 | ||
y_test = data.test.labels | ||
n_classes = data.n_classes | ||
|
||
shifted_dataset = Dataset.from_labelled_subset(X_train, y_train, X_test, y_test, n_classes) | ||
|
||
return shifted_dataset |