Phase one of GSoc is over this week. We have had a terrific run.

In this post we will look at how we are going to implement our IterativeMachine class and a few issues we faced along with how we tackled them.

The class overides train_machine which calls a virtual method init_model that will perform all the things needed by the main training loop. Communication between the training loop and init_model will be done through member varaibles. Next component is continue_train method. This is where we have our COMPUTATION_CONTROLLERS macro and the main training loop. This will run the single iteration implemented in the model and update state after each iteration.

One issue was how to deal with features and labels. For labels we have used the already present member in CMachine. For features we added a new m_continue_features member as an extra. This is intended to keep things between IterativeMachine and base classes like LinearMachine machine apart.

For now we have only have an IterativeLinearMachine class that inherits from LinearMachine machine and implemented the idea in Perceptron. We will build on it this week.

For end of training ops like cleaning/resetting states, warnings, errors etc. we have an end_training() method that can be overloaded in base class.

The final problem is where to place the IterativeMachine class in the inheritance ladder. The obvious solution appears to be multiple inheritance but we cannot do that since there will be some function overloading and it proved tough. Another method is to implement IterativeMachine as a mixin for machines. A mixin is a class that can inherit from another class dynamically through a template argument. It is not a standalone class but adds more things to a base class. The result is a custom base class. Exactly what we want. This keeps the Iterative Framework minimal. We might not need the extra feature member anymore. Also the class will be keeping up with all API changes we introduce later because it will inherit most of everything from the orignal base classes.

I have implemented this as a work in progress and it is working nicely. I have issues using it in interfaces and that is something we will be looking into this week.

Another thing i worked on this week is a benchmark for “put” using perceptron this gave mixed results and more digging is required.

Contributions

Iterative Machine