Unable to run the code in Time limit

Problem: Spam Classification Using Neural Net
Code: SPAMCLAS
Problem Link: SPAMCLAS Problem - CodeChef

Can somebody explain me the issue with my code.
It passes the test case but is exceeding the time limit.
How can I improve this code to run in Time limit ?

Code Link- CodeChef: Practical coding for everyone