keras - get different results on different data size -


i'm trying build model generate chiense text. problem when use several atrticles training datas , trained them each model.fit(), got bad results loss not decrease @ all. however, when combine several articles one, performs well. loss shrinks down rapidly. causes problem , how can fix it? need memory if combine datas one.....

here's code:

for filename in os.listdir(dir_path):     filename = dir_path + filename     tmp = " ".join(text_to_word_sequence(open(filename).read()))     raw_text.append(tmp)     # raw_text list articles   seq_length = 25 model = sequential() model.add(lstm(n_vocab, input_shape=(seq_length, 1), return_sequences=true)) model.add(dropout(0.2)) model.add(lstm(n_vocab)) model.add(dropout(0.2)) model.add(dense(n_vocab, activation='softmax')) model.compile(loss='categorical_crossentropy', optimizer='adam')   dataxs, datays = process(raw_text)  in range(1000):     j in range(len(dataxs)):         model.fit(dataxs[j], datays[j], epochs=1, batch_size=128) 

here's modified makes performance better:

all_text = "" filename in os.listdir(dir_path):     filename = dir_path + filename     tmp = " ".join(text_to_word_sequence(open(filename).read()))     all_text += tmp  raw_text.append(all_text) 

thanks.


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -