O'Reilly logo

Hands-On Natural Language Processing with Python by Rajalingappaa Shanmugamani, Rajesh Arumugam

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Training

For the training, we will use a slice of the input data, which can be increased to improve the model's performance:

min_learning_rate = 0.0006display_step = 20 early_stop_cnt = 0 early_stop_cnt_max = 3 per_epoch = 3 update_loss = 0 batch_loss = 0summary_update_loss = [] news_summaries_train = news_summaries_filtered[0:3000]news_texts_train = news_texts_filtered[0:3000]update_check = (len(news_texts_train)//batch_size//per_epoch)-1checkpoint = logs_path + 'best_so_far_model.ckpt' with tf.Session(graph=train_graph) as sess:    tf_summary_writer = tf.summary.FileWriter(logs_path, graph=train_graph)    merged_summary_op = tf.summary.merge_all()    sess.run(tf.global_variables_initializer())    for epoch_i in range(1, epochs+1):        update_loss = 0

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required