I'm doing a masters in CS that requires me to implement from scratch most of the neural network models and because python libraries aren't applicable to what i want.

The problem is that i don't feel capable of implementing those from scratch. Even the MLP seems very difficult, i always try but get stuck and restart. Meantime, i feel that my supervisor think it's a natural thing and i shouldn't have problems implementing those algorithms.

I know that when we are talking about research, it shouldn't be easy - because anyone else would do it if so - but i'd be glad to receive some advices about this process i am going through: Am I not prepared enough for this or is it an overambitious idea to implement all these networks from scratch? Should i continue this? I've already thought about giving up.

Ps: any good materials (books, videos, etc) focusing in implementation of neural networks are welcome.

  • $\begingroup$ From someone who did give up, a long time ago, I would recommend sticking with it. Accept feeling in over your head as the first phase; the answers here are giving good advice - keep digging! $\endgroup$ – Daniel M Gessel Feb 17 at 17:24

I have been implementing a branch and bound solver with heuristics for an NP-hard problem. It got complicated at some points and had to reimplement parts a couple of times. The problem was (I think), that I started implementing with only an intuition about the design and how it looks like. That is bad software engineering and is catastrophic in big project.

So forget your computer for now. Bring a bunch of white papers and a pen. Describe the steps of the algorithm precisely. Design the program, decide the data structures and how they will communicate. Decide where data should be kept and how it should be commuted. When you have the details drawn on papers, coding is just a matter of writing it down and doing some optimization.

Another good advise is to start by writing the simplest version you can imagine. Implement only what you need to have, in the simplest way you can think of. No optimization, no copy/reference calls thinking just get it to run correctly at first. Once you are at that point you have something to deliver, start making it better. Check where you are doing stuff naively where you can do it better. Find all copies where you could have just done it on the original structure. Because if you kept optimizing and adding features while implementing you will never finish. There will always be something to add.

  • 2
    $\begingroup$ These are valuable advices. Thank you. I've been trying the same way you did. Sometimes my algorithm threw erros and i was fixing it in a 'trial-and-error' manner. That's not good because the more complex the project became, the harder it was to understand what to do. $\endgroup$ – joann2555 Feb 14 at 15:18

(Not enough reputation to comment, so writing here.)

  1. Unless your algorithms are secret, please post your algorithms here. Maybe someone (not me though) can find a library for you. Maybe someone can tell how long does it take to implement it.

  2. Use Git and GitHub. You can rollback bad code with this.

  3. Always write tests. This helps against regressions as you update/optimize your algorithm. Moreover, code without testing are almost certainly broken.

  • 1
    $\begingroup$ Thanks for the kind advices. I am dealing with Ensemble Learning (Machine Learning) but none of available libraries apply to my project. I have no experience coding AI algorithms from scratch, and they are very frustrating if you don't know 100% what you are doing. $\endgroup$ – joann2555 Feb 17 at 21:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.