<jupyter_start><jupyter_text>Training the model<jupyter_code>sess = tf.InteractiveSession()
init  = tf.initialize_all_variables()
sess.run(init)
## 15 loops
for epoch in range(training_epochs):
    
    ## Cost
    avg_cost = 0.0
    total_batch = int(n_samples/batch_size)
    
    for i in range(total_batch):
        
        ##Grab each batch
        batch_x, batch_y = mnist.train.next_batch(batch_size)
        
        ## Optimisation and Cost
        _,c = sess.run([optimizer, cost], feed_dict={x:batch_x, y:batch_y})
        
        ##Compute avg Cost
        avg_cost += c/total_batch
        
        print("Epoch: {} cost{:.4f}".format(epoch+1, avg_cost))
print("Model has completed {} epochs of training.".format(training_epochs))
        
correct_predictions = tf.equal(tf.argmax(predictions, 1), tf.argmax(y, 1))
correct_predictions = tf.cast(correct_predictions, 'float')
accuracy = tf.reduce_mean(correct_predictions)
accuracy.eval({x:mnist.test.images, y:mnist.test.labels})
##The Accuracy is approximately 94%<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12452830188679245, 'fraction_numerical': 0.009433962264150943, 'mean_word_length': 3.5536480686695278, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '543822', 'license': 'MIT', 'n_tokens_mistral': 377, 'n_tokens_neox': 366, 'n_words': 67, 'path': 'Deep-learning-Character-recog.ipynb', 'repo_name': 'Vedant1202/DL_Numbe-Recognition', 'size': '1060'}