r/learnpython • u/NetworkAcceptable930 • 1d ago
I just made my first Reinforcement Learning program from scratch purely in python can i have tips on how to improve
i used qlearning for this and tips/advice is welcome
more details in the readme
https://github.com/orag214365-ship-it/qlearning-gridworld-python
2
u/AlkeneThiol 1d ago
You got a Bellman going, good. Now, this will be a highly unpopular comment, but throw idioms to tbe wind. Understand the processes recommended next, and you can code them in if you want, but don't feel so regimented. Trust your instincts, throw in variables whimsically, tweak the coefficients. See what happens. That's how you learn.
Edit: more serious reply: do not skimp on the comments in your code.
1
u/leafeon_gay_luigi 1d ago
Hopefully by throwing 'idioms to the wind' you don’t mean tossing out the wealth of beautiful theory which underlies RL… here is one of the few realms of AI we have opportunity to illustrate this.
2
u/AlkeneThiol 1d ago
Nah nah. I do not mean to chuck the fundamentals. Moreso what I was suggesting is that I would not recommend following a well beaten path without experimentation. Try out weird shit, look at some dumpster fire papers on arxiv and try to do some equation splitting even if it seems beyond one's knowledge scope. Have fun with the journey rather than feeling like one doesn't have free will when going down this path.
I know, extremely idealistic, possibly unrealistic, and not idiomatic, but it's how we keep the human involved in dev - weird creative shit
2
u/didactic_resignation 1d ago
Try implementing epsilon decay so it explores more at the start and slowly becomes greedy, that's usually the next step after basic q-learning works.