def sample_test(): data, char_to_ix, ix_to_char = DataService.get_data() chars = list(set(data)) data_size, vocab_size = len(data), len(chars) np.random.seed(2) _, n_a = 20, 100 Wax, Waa, Wya = np.random.randn(n_a, vocab_size), np.random.randn( n_a, n_a), np.random.randn(vocab_size, n_a) b, by = np.random.randn(n_a, 1), np.random.randn(vocab_size, 1) parameters = {"Wax": Wax, "Waa": Waa, "Wya": Wya, "b": b, "by": by} indices = ModelService.sample(parameters, char_to_ix, 0) print("Sampling:") print("list of sampled indices:\n", indices) print("list of sampled characters:\n", [ix_to_char[i] for i in indices])
from data_service import DataService from model_service import ModelService data, char_to_ix, ix_to_char = DataService.get_data() parameters = ModelService.model(data, ix_to_char, char_to_ix, verbose=True)