Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from ekrim/master
MADE generative pass, tanh layer for scaling params, moons example
- Loading branch information
Showing
5 changed files
with
84 additions
and
13 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 |
---|---|---|
@@ -1,3 +1,6 @@ | ||
# Data | ||
datasets/data/ | ||
|
||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
|
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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import numpy as np | ||
import matplotlib.pyplot as plt | ||
from sklearn import datasets as ds | ||
|
||
import datasets | ||
import datasets.util | ||
|
||
|
||
class MOONS: | ||
|
||
class Data: | ||
|
||
def __init__(self, data): | ||
|
||
self.x = data.astype(np.float32) | ||
self.N = self.x.shape[0] | ||
|
||
def __init__(self): | ||
|
||
trn, val, tst = load_data() | ||
|
||
self.trn = self.Data(trn) | ||
self.val = self.Data(val) | ||
self.tst = self.Data(tst) | ||
|
||
self.n_dims = self.trn.x.shape[1] | ||
|
||
def show_histograms(self, split): | ||
|
||
data_split = getattr(self, split, None) | ||
if data_split is None: | ||
raise ValueError('Invalid data split') | ||
|
||
datasets.util.plot_hist_marginals(data_split.x) | ||
plt.show() | ||
|
||
|
||
def load_data(): | ||
x = ds.make_moons(n_samples=30000, shuffle=True, noise=0.05)[0] | ||
return x[:24000], x[24000:27000], x[27000:] |
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