Beispiel #1
0
restored_model.summary(print_fn=lambda x: log.write(x + '\n'))

#
# train model
#

start_time = datetime.datetime.now()
log.write("start training at {}\n".format(start_time))

csv_logger = CSVLogger(train_file_log, append=True, separator=',')

seqs = pussy.make_vectors(users_train, ratings)

for i in range(epochs_groups):
    restored_model.fit_generator(
        pussy.train_generator(seqs, users_train, n_movies, left_out, kept),
        epochs=predict_every,
        steps_per_epoch=steps_per_epoch,
        validation_data=pussy.train_generator(seqs, users_train, n_movies,
                                              left_out, kept),
        validation_steps=validation_steps,
        callbacks=[csv_logger])
    restored_model.save("model_restored_file_{}".format(i) + file_parameters)

final_time = datetime.datetime.now()
log.write("\nfinal time {}\n".format(final_time))
log.write("\ntotal training time {}\n\n".format(final_time - start_time))

#
# save model
#
Beispiel #2
0
seqs = pussy.make_vectors(users_train, ratings)






start_time = datetime.datetime.now()
log.write( "start training at {}\n".format(start_time) )


csv_logger = CSVLogger(train_file_log, append=True, separator=',')

for i in range(epochs_groups):
	model.fit_generator(pussy.train_generator(seqs, users_train, n_movies, left_out, kept), epochs=predict_every, steps_per_epoch=steps_per_epoch,
			validation_data=pussy.train_generator(seqs, users_train, n_movies, left_out, kept), validation_steps=validation_steps,
			callbacks=[csv_logger])
	model.save("model_file_{}".format(i) + file_parameters)
	#pussy.evaluate_model(model, users_train, ratings, n_movies).to_csv(path_or_buf="{}_{}_train.csv".format(file_parameters,(1+i)*predict_every), header=True, sep=",", index=False)
	#pussy.evaluate_model(model, users_test, ratings, n_movies).to_csv(path_or_buf="{}_{}_test.csv".format(file_parameters,(1+i)*predict_every), header=True, sep=",", index=False)
	


final_time = datetime.datetime.now()
log.write( "\nfinal time {}\n".format(final_time) )
log.write( "\ntotal training time {}\n\n".format(final_time - start_time) )



Beispiel #3
0
model.summary(print_fn=lambda x: log.write(x + '\n'))

#
# train model
#

seqs = pussy.make_vectors(users_train, ratings)

start_time = datetime.datetime.now()
log.write("start training at {}\n".format(start_time))

csv_logger = CSVLogger(train_file_log, append=True, separator=',')

for i in range(epochs_groups):
    model.fit_generator(pussy.train_generator(seqs, users_train, n_movies,
                                              left_out, left_out),
                        epochs=predict_every,
                        steps_per_epoch=steps_per_epoch,
                        validation_data=pussy.train_generator(
                            seqs, users_train, n_movies, left_out, left_out),
                        validation_steps=validation_steps,
                        callbacks=[csv_logger])
    model.save("model_file_{}".format(i) + file_parameters)
    #pussy.evaluate_model(model, users_train, ratings, n_movies).to_csv(path_or_buf="{}_{}_train.csv".format(file_parameters,(1+i)*predict_every), header=True, sep=",", index=False)
    #pussy.evaluate_model(model, users_test, ratings, n_movies).to_csv(path_or_buf="{}_{}_test.csv".format(file_parameters,(1+i)*predict_every), header=True, sep=",", index=False)

final_time = datetime.datetime.now()
log.write("\nfinal time {}\n".format(final_time))
log.write("\ntotal training time {}\n\n".format(final_time - start_time))

#