rickvanveen / sklvq

http://sklvq.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
47 stars 9 forks source link

Add more values to the "State" parameter #65

Open Emraldis opened 3 years ago

Emraldis commented 3 years ago

Is your feature request related to a problem? Please describe. For certain applications it is useful to be able to easily pull more information out of a simple callback to the "State" parameter of a model while it is training. Currently the "State" parameter only has access to certain elements such as "variables" , "nit", "fun", "nfun", "tfun", and "step size".

Describe the solution you'd like If possible, the Relevance Matrix and Current Prototypes should be added to the "State" parameter as well.

Describe alternatives you've considered While it is possible to calculate these from the variables and elements already provided in the "State" parameter, having them in a more concise form would prevent a lot of unnecessary calculations.

rickvanveen commented 3 years ago

Agree! However, I propose an easier and more general approach: Instead of adding the relevance matrix and current prototypes. Add a copy of the current "model". The solvers and thus the callback function don't and shouldn't know which exact model GLVQ, GMLVQ or LGMLVQ they are dealing with.

Some addition changes are required to make this work but the essence of this is changing: variables=np.copy(model.get_variables()), to model=copy(model)

I'm not sure what the best way of making a copy of a fitted sklearn estimator is though.

SofieLovdal commented 2 years ago

@Emraldis is it the case that you created a version where the model (or relevance matrix/prototypes) were added to the State parameter? I would need to plot learning curves of the training process and need a similar functionality.

Emraldis commented 2 years ago

It was a while ago, so I don't quite remember what I added there, I think it currently just sends a copy of the model from which you could derive various data. I have a branch called "expanded_state_dict_dev" you can pull from and see if that does what you need it to.

On Tue, Apr 26, 2022 at 11:47 AM Sofie Lövdal @.***> wrote:

@Emraldis https://github.com/Emraldis is it the case that you created a version where the model (or relevance matrix/prototypes) were added to the State parameter? I would need to plot learning curves of the training process and need a similar functionality.

— Reply to this email directly, view it on GitHub https://github.com/rickvanveen/sklvq/issues/65#issuecomment-1109586702, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB5T43Q2DN47QBXHWKWGUD3VG63SPANCNFSM47B7YEEQ . You are receiving this because you were mentioned.Message ID: @.***>

-- Alpheaus Feltham

SofieLovdal commented 2 years ago

Thank you! I will look into it and might get back to you.

rickvanveen commented 2 years ago

It would also be great if this would be made into a pull request such that the next time we don't need to pass branches around :-)

Emraldis commented 2 years ago

Yeah, that's fair. I honestly thought I had done that. I'll see about getting that done.

On Tue, Apr 26, 2022 at 4:52 PM Rick @.***> wrote:

It would also be great if this would be made into a pull request such that the next time we don't need to pass branches around :-)

— Reply to this email directly, view it on GitHub https://github.com/rickvanveen/sklvq/issues/65#issuecomment-1109896556, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB5T43QXYW62OJUV4GY4OU3VG77KZANCNFSM47B7YEEQ . You are receiving this because you were mentioned.Message ID: @.***>

-- Alpheaus Feltham