Add code on neural nets implementation

I've refactored the code on neural networks, and firstly push up the head files for easier code review. Thanks.