mlpack  blog
mlpack Documentation

Table of Contents

A list of all recent posts this page contains.

Implementing an mlpack-Tensorflow Translator - Week 4

Implementing an mlpack-Tensorflow Translator - Week 4

Where were we before?

We had a converter that could convert the network architecture of an onnx model to an mlpack model, given they are supported. The weights would not be transferred. Also, speaking of the json parser which we are using as an API here, it was not in a mergeable state as per mlpack's standards.

Where are we now?

  • In week 3, I focussed on extracting the weights from the onnx model when it is stored as raw bytes. That took some time and eventually https://github.com/lcskrishna/onnx-parser came of great help.
  • There was a lot to put together after that. I was eventually able to convert linear models and also get their weights transferred.
  • Support for the transfer of pre-trained weights for convolutional layers were also added but there was some dimension mismatch which I will have to fix.
  • I wrapped up the json parser next. Also added a few more layers for support. There is still an issue over the use of namespaces and there was a discussion between Atharva and Marcus on how to fix it.
  • Sadly, on Saturday I went out to play cricket with my friends and fell sick with a very high fever. A centurion on and off the field they say. I am still recovering and have not been able to resume work since :(

    What's left for the upcoming weeks?

  • The onnx to mlpack converter has to be completed. Not sure if anything is left other than finishing off the convolution support that I have mentioned above.
  • Fixing whatever namespace error is there with the json parser.
  • Starting and completing the mlpack to onnx parser.

If you have reached this far, here's something for you from Reddit:

My bro asked why I was speaking so softly in the house. I said I was afraid the NSA was listening. There was complete silence for a moment. Then he laughed, I laughed, Alexa laughed.

Implementing Improved Training Techniques for GANs - Week 4

Implementing Improved Training Techniques for GANs - Week 4

This week I mainly debugged my VirtualBatchNorm code as the numerical gradient test was failing. I was re-checking my derivations on paper and getting the same results as before. I checked my implementation where I couldn't find any problems. Later I discovered that I had made a silly mistake in the model for the numerical gradient test. I was adding a Linear<> layer of input size 10 whereas the output from the previous layer had size 5. After fixing the model, the numerical gradient test started to pass.

Additionally, I did some more work on the regularizers and making changes to my currently opened PRs. In the upcoming week I hope to finish with the regularizers PR and start working on spectral normalisation which seems more mathematically challenging.

Implementing probabilistic KDE error bounds - Week 4

Implementing probabilistic KDE error bounds - Week 4

This week probabilistic KDE API has been integrated into the existing codebase and many unit tests have been implemented. All tests seem to indicate that this implementation is working well. After a review by Ryan, there are a few things to improve a bit but for the most part it should be ready.

Another possibility for further improvement is to reclaim unused error tolerance as explained in this paper. I am working on this for this week as well.

It was interesting to learn some tips on how to test pieces of code that depend on random parameters.

Random number XKCD

Application of ANN Algorithms Implemented in mlpack - Week 4

Application of ANN Algorithms Implemented in mlpack - Week 4

Tasks

  • Completed the PR on image saving feature.
  • Written tutorials on how to use image utilities for loading and saving images.
  • Added global max & mean pooling to VGG19 model.

Results

Initially VGG19on minist dataset showed divergence,

Epoch 0
Loss after cycle 0 -> 310.261
Epoch 1
Loss after cycle 1 -> 223.393
Epoch 2
Loss after cycle 2 -> 2.83091e+10
Epoch 3
Loss after cycle 3 -> 6.03322e+45

So, I retuned the hyper parameters involving initialization and step size. I hope that it gives good results.

Next Week Goals

  • Completing the PR on Image Loading in accordance data::Load() and data::Save() API calls.
  • Complete the documentation on VGG.
  • Revise the tutorials for image loading/saving.

Thanks for reading. Have a nice day :smile:

Proximal Policy Optimization - Week 4

1 Proximal Policy Optimization - Week 1

This week, I mainly focus on Proximal Policy Optimization pull request.

  • Added Step and Episode function in PPO algorithm.
  • Added initial test case for the PPO algorithm.
  • Opened a PR for the the pendulum environment.
  • Added action prediction in the PPO algorithm.

I choose the continuous task, pendulum, to test the PPO algorithm, it seems that some code in the original code base did not support the continuous task. Next week, I will change that one.

Thanks for reading :).

NEAT & Multiobjective Optimization - Week 4

NEAT & Multiobjective Optimization - Week 4

This week, I mostly debugged the code and tested the code in the XOR test. At first, the results were disappointing, but they have since improved. However, there is still a lot of work to be done, since the performance is still far from up to par. Hopefully by the end of next week or maybe the one after that, I'll have a finished product.

Something I learned this week is how rigorous and time intensive testing is. At the time of writing a timeline for this project, I naively gave testing one week, but it looks like it will take me two or (god forbid) three to get it all done. This is a lesson any readers planning to apply for GSoC, give ample time for testing, especially with a large project. It'll be worth it :).

This week I went back to some old hip hop I love. I especially like jazz rap, and one of my favourite groups is A Tribe Called Quest. They have multiple classic albums, but my favourite is Midnight Marauders. Give it a listen :)

Thanks for reading!

String Processing Utilities - Week 02

String Processing Utilities - Week 02

This week I raised a new PR1927 to provide Bag of Words functionality, which followed the same model as DictionaryEncoding PR1814, but with different implementation. Also, made minor clean ups of other PR, and also decided to implement EncodingPolicy which will handle the encoding process.

The functionalites of PR1876 are almost done and I also got it approved, will be merged soon. Next week I would try to merge both DictionaryEncoding class and Bag of Words class, and would try to build bindings for String Cleaning functionalites.

Thank you :)

Note
Big fan of GaN, but sometimes :-p .

Quantum Gaussian Mixture Models - Week 4

Quantum Gaussian Mixture Models - Week 4

In the week 3, I did visualize the QGMM and the integral areas to check if them are correct.

This week, I worked on quantum EM algorithm implementation in Python code for simple check.

Next week, I'll code the quantum GMM in mlpack code base and write some test sutes.

Thanks for reading :)

String Processing Utilities - Week 03

String Processing Utilities - Week 03

This week I made minor cleanups in my old PR for Dictionary Encoding Class and Bag of Words Class. Also came back to feature selection PR as I did had some free time up my sleves.

Also First Evaluation Began and I have filled up the Feedback within 5 mins :). Also I starting Working on implementation of TF-IDF Class and would soone raise a PR for that class.

My college is resuming from 2nd of July :( and thus I am treavelling back to my college from home. Long Train Journey of 36 Hours. Will spare some time to code while travelling.

Thank you :)

Note
Machine Learning vs Deep Learning :-p .

Implementing Improved Training Techniques for GANs - Week 3

Implementing Improved Training Techniques for GANs - Week 3

This week I worked on finishing my implementation of VirtualBatchNormalization. The main difficulty was in writing the implementation of the Backward method. I was able to consult the implemnentation of the BatchNorm layer as a reference. I also looked at the implementations of the VirtualBatchNormalization layer in Tensorflow and Pytorch. The implementation of my Gradient method is correct as I verified through the numerical gradient test however the Backward method is still not working correctly. I hope to resolve this issue in the coming week. In the meantime I was able to find a bug in the implementation of the BatchNorm layer and fix it.

I also started working on regularizers and opened a PR. I have added support for L1 and L2 regularizers and hope to add support for orthogonal regularization in the coming week which should not take much time once the design is finalized.

Application of ANN Algorithms Implemented in mlpack - Week 3

Application of ANN Algorithms Implemented in mlpack - Week 3

Tasks

  • Adding Image saving feature to image utilities.
  • I have also documented VGG19.

Next Week Goals

  • Completing the PR on Image Loading with image saving.
  • Writing tutorials on image loading and saving feature.

Thanks for reading. Have a nice day :smile:

Implementing Essential Deep Learning Modules - Week 3

Implementing Essential Deep Learning Modules - Week 3

This week was quite productive from my previous week. I have completed the implemenation of Weight Norm Layer in this week. It was my first layer. I got quite familiar with the layer API. Also as weight norm will have a layer inside I was required to ensure that the proper calls to the wrapped layer are also made.

The main challenge during it's correct implemenation was in it's gradient testing. I was required to provide an offset to check the gradients,because the weights of the wrapped layer are intialized with respect to the vector and scalar parameter of the weight norm layer. Finding the need to do this was quite somewhat challenging as it got somewhat difficult to find the error. Also while testing it I also found lot of small syntactic mistakes in my implemenation.

I also worked on fixing the radical test. I wrote a small bash script for reproducing the error. While working on it, I also got to know what Singular Value Decomposition and Whitening is. ICA and PCA are quite interesting topics.

In the upcoming week I am going to implement Frechet Inception Distance for measuring the performance of GANs. It would be quite interesting thing to work on as it may involve working on Inception Model.