I hope it pans out for machine learning.
I kept a dream journal every night for over a year. Meditated extensively during that time. And rarely looked at a screen. Prison gives you a lot of free time.
I've also explored the closes eye visual space in drug induced lucid states extensively.
This time article aligns with my understanding of Busdhisms Six consciousness model.
https://time.com/5925206/why-do-we-dream/
In Western language, we would call the eye consciousness the visual cortex. When our eyes are closed, and we're in a relaxed state, we can see muscle memory practicing. Dreams. Visions if in an awake lucid state.
The visual cortex stays active when our eyes are closed. Otherwise it only takes an hour for other senses to start recruiting those neurons.
My dreams tend to be emotionally charged. So, dreams are, in my experience, a combination of the visual cortex doing busy work and unresolved emotional stuff if it's there, or fun joyful stuff, if I'm feeling joy.
I don't know that it has a 'purpose' other than busy work and keeping the cortex wired together. It can be put to purpose, such as dream journaling and deeper self awareness.