def test_single_timestep(self): chunks, next_chars = chunk_names(self.test_df, 'name', 1) self.assertEqual(['d', 'a', 'r', 't', 'h', ' ', 'v', 'a', 'd', 'e', 'r'], chunks) self.assertEqual(['a', 'r', 't', 'h', ' ', 'v', 'a', 'd', 'e', 'r', '\n'], next_chars)
def test_three_timesteps(self): chunks, next_chars = chunk_names(self.test_df, 'name', 3) # 'darth vader' self.assertEqual(['dar', 'art', 'rth', 'th ', 'h v', ' va', 'vad', 'ade', 'der'], chunks) self.assertEqual(['t', 'h', ' ', 'v', 'a', 'd', 'e', 'r', '\n'], next_chars)
vocab_size = len(chars) vocab_size # In[178]: timesteps = 1 # In[179]: chunks, next_char = chunk_names(combined, 'name', timesteps) # In[180]: X = numpy.zeros((len(chunks), timesteps, vocab_size)) y = numpy.zeros((len(chunks), vocab_size)) # In[181]: for i, chunk in enumerate(chunks): for t, token in enumerate(chunk): index = token_to_index[token]