shogun icon indicating copy to clipboard operation
shogun copied to clipboard

Use iterative machine mixin in more algorithms

Open shubham808 opened this issue 6 years ago • 14 comments

This is a very good issue for those who want to be involved in the project inside the black box II

In order to make algorithms stoppable, we need to execute each iteration and then save the state in member variables. If a user decides to stop the process at any iteration, control is returned back. This means the user is free to continue, serialize, test etc. on the pre-trained model See Perceptron and NewtonSVM as examples. We want all iterative algorithms to apply this mixin

First Steps

  • Identify the initialization and iteration phase(what occurs in the training loop) of the algorithm
  • The initialization part (mostly above the training loop) goes into the init_model() method
  • The iteration function will implement a single iteration of the algorithm, so we will move the contents of the training loop into iteration function
  • Create new member variables if required to share data between init_model and iteration
  • Delete local copies of variables that represent state(like weights and bias)
  • Finally write tests to see if everything is consistent :) see NewtonSVM unit tests and Perceptron unit tests

Initially we want this done for a single Linear Machine algorithm (CAveragedPerceptron is a good place to start) See the iterative machine guide for more information

shubham808 avatar Jan 25 '19 17:01 shubham808

Hi @shubham808, I am new here. I read the wiki for inside the black box II project and I am really interested to work on it. This issue would be a great introduction to the project. So, Can I work on this?

souvik3333 avatar Feb 03 '19 18:02 souvik3333

Yes go ahead :)

shubham808 avatar Feb 04 '19 08:02 shubham808

I am new to open source and I will like to work on this issue.

han0305 avatar Mar 09 '19 08:03 han0305

I this issue closed as per the Merge on Mar 2?

samdbrice avatar Jul 09 '19 16:07 samdbrice

Nope, still lots of iterative algorithms/machines to port

karlnapf avatar Jul 09 '19 18:07 karlnapf

Ah ok, so this is akin to a Milestone/Sticky issue - not a one-off item. This is indeed a good first issue, I'll see if I can implement one.

samdbrice avatar Jul 09 '19 21:07 samdbrice

Just checked a few machines that are iterative and realised that most low hanging fruits have been taken. There are quite a few algorithms to port left but the changes will be slightly more nontrivial. Everything that is based on (stochastic) gradient descent is worth looking into here

karlnapf avatar Jul 09 '19 22:07 karlnapf

I would like to contribute. Is there any work left to be done in this issue?

progmatic-99 avatar Oct 26 '19 15:10 progmatic-99

Hi. If this is still open can I take up this one?

ashutosh-b-b avatar Jan 17 '20 04:01 ashutosh-b-b

Sure, go for it. Thanks!

sbrice avatar Jan 17 '20 16:01 sbrice

@samdbrice I did started to read the blog and understand it. Which algorithm should I go with knowing that I am a beginner here?

ashutosh-b-b avatar Jan 22 '20 20:01 ashutosh-b-b

I was thinking to start with Brute KNN can anyone guide me?

ashutosh-b-b avatar Jan 23 '20 06:01 ashutosh-b-b

@ashutosh-b-b you could start with that or with https://github.com/shogun-toolbox/shogun/blob/develop/src/shogun/metric/LMNN.cpp basically the idea is that you follow the CRTP pattern with IterativeMachine and move an iteration to logic into iteration function

vigsterkr avatar Jan 23 '20 09:01 vigsterkr

Thanks!

ashutosh-b-b avatar Jan 24 '20 03:01 ashutosh-b-b