import matplotlib matplotlib.use('Agg') import numpy as np import matplotlib.pyplot as plt n_h = 50 time_steps = 100 random_state = np.random.RandomState(1999) sin = np.sin(np.linspace(-3 * np.pi, 3 * np.pi, time_steps))[:, None] cos = np.cos(np.linspace(-3 * np.pi, 3 * np.pi, time_steps))[:, None] seq = np.concatenate((sin, cos), axis=-1)[None] clf = GMMRNN(learning_alg="rmsprop", n_mixture_components=20, hidden_layer_sizes=[n_h], max_iter=1000, learning_rate=.0001, bidirectional=False, momentum=0.99, recurrent_activation="lstm", minibatch_size=10, save_frequency=1000, random_seed=1999) shp = seq.shape seq_r = seq.reshape(shp[0] * shp[1], shp[-1]) mean = seq_r.mean(axis=0, keepdims=True) std = seq_r.std(axis=0, keepdims=True) seq = seq - mean seq = seq / std clf.fit(seq) t1 = clf.sample(n_steps=time_steps) t2 = clf.force_sample(seq[0]) t3 = clf.sample(bias=0., n_steps=time_steps)
import matplotlib matplotlib.use('Agg') from minet.datasets import plot_scatter_iamondb_example from minet.datasets import plot_lines_iamondb_example from minet.datasets import fetch_iamondb import matplotlib.pyplot as plt from minet import GMMRNN import numpy as np X, y = fetch_iamondb() clf = GMMRNN(learning_alg="rmsprop", n_mixture_components=20, hidden_layer_sizes=[1000], max_iter=20000, learning_rate=.00001, bidirectional=False, momentum=0.99, recurrent_activation="lstm", minibatch_size=1000, save_frequency=100, random_seed=1999) seq = X[0][:, 1:] #seq = seq[1:] - seq[:-1] seq = seq[:100] mi0 = seq.min(axis=0) ma0 = seq.max(axis=0) seq = (seq - mi0) / (ma0 - mi0) clf.fit(seq)
import matplotlib.pyplot as plt n_h = 50 time_steps = 100 random_state = np.random.RandomState(1999) sin = np.sin(np.linspace(-3 * np.pi, 3 * np.pi, time_steps))[:, None] cos = np.cos(np.linspace(-3 * np.pi, 3 * np.pi, time_steps))[:, None] seq = np.concatenate((sin, cos), axis=-1)[None] clf = GMMRNN(learning_alg="rmsprop", n_mixture_components=20, hidden_layer_sizes=[n_h], max_iter=1000, learning_rate=.0001, bidirectional=False, momentum=0.99, recurrent_activation="lstm", minibatch_size=10, save_frequency=1000, random_seed=1999) shp = seq.shape seq_r = seq.reshape(shp[0] * shp[1], shp[-1]) mean = seq_r.mean(axis=0, keepdims=True) std = seq_r.std(axis=0, keepdims=True) seq = seq - mean seq = seq / std clf.fit(seq)