blue-yonder/vikos

teach_event with immutable model

HolgerPeters opened this issue · 1 comments

Currently, in the teacher trait, Teacher<M>::teach_event<Y, C>(&self, &mut Self::Training, &mut M, &C, &M::Input, Y) has two mutable arguments, the associated training type and model. My question is, whether we could rewrite this into a function with immutable arguments, that returns new values for these arguments. This way we might be able to rewrite learn_history's loop over the history as a folding operation (reduction).

I think this can be done. I also like the idea of expressing learn_history in terms of fold very much. However having the low level mutable interface is very handy in some applications there I use the model in one thread, while the other is training it.
My suggestion is to introduce a function wrapping the low level interface and using this function to rewrite learn_history in terms of fold.