Artificial Inteligence
  • Preface
  • Introduction
  • Machine Learning
    • Linear Algebra
    • Supervised Learning
      • Neural Networks
      • Linear Classification
      • Loss Function
      • Model Optimization
      • Backpropagation
      • Feature Scaling
      • Model Initialization
      • Recurrent Neural Networks
        • Machine Translation Using RNN
    • Deep Learning
      • Convolution
      • Convolutional Neural Networks
      • Fully Connected Layer
      • Relu Layer
      • Dropout Layer
      • Convolution Layer
        • Making faster
      • Pooling Layer
      • Batch Norm layer
      • Model Solver
      • Object Localization and Detection
      • Single Shot Detectors
        • Yolo
        • SSD
      • Image Segmentation
      • GoogleNet
      • Residual Net
      • Deep Learning Libraries
    • Unsupervised Learning
      • Principal Component Analysis
      • Generative Models
    • Distributed Learning
    • Methodology for usage
      • Imbalanced/Missing Datasets
  • Artificial Intelligence
    • OpenAI Gym
    • Tree Search
    • Markov Decision process
    • Reinforcement Learning
      • Q_Learning_Simple
      • Deep Q Learning
      • Deep Reinforcement Learning
    • Natural Language Processing
      • Word2Vec
  • Appendix
    • Statistics and Probability
      • Probability
        • Markov Chains
        • Random Walk
    • Lua and Torch
    • Tensorflow
      • Multi Layer Perceptron MNIST
      • Convolution Neural Network MNIST
      • SkFlow
    • PyTorch
      • Transfer Learning
      • DataLoader and DataSets
      • Visualizing Results
Powered by GitBook
On this page
  • Introduction
  • Usage example
  • Train operation
  • Step operation
  • Check Accuracy
  • Model loss operation

Was this helpful?

  1. Machine Learning
  2. Deep Learning

Model Solver

PreviousBatch Norm layerNextObject Localization and Detection

Last updated 5 years ago

Was this helpful?

Introduction

The mission of the model solver is to find the best set of parameters, that minimize the train/accuracy errors. On this chapter we will give a UML description with some piece of python/matlab code that allows you implement it yourself.

From the UML description we can infer some information about the Solver class:

  1. It uses the training set, and has a reference to your model

  2. Uses different type of optimizers(ex: SGD, ADAM, SGD with momentum)

  3. Keep tracks of all the loss, accuracy during the training phase

  4. Keep the set of parameters, that achieved best validation performance

Usage example

Train operation

This is the method called when you actually want to start a model training, the methods Step, Check_Accuracy are called inside the Train method:

  1. Calculate number of iterations per epoch, based on number of epochs, train size, and batch size

  2. Call step, for each iteration

  3. Decay the learning rate

  4. Calculate the validation accuracy

  5. Cache the best parameters based on validation accuracy

Step operation

Basically during the step operation the following operations are done:

  1. Extract a batch from the training set.

  2. Get the model loss and gradients

  3. Perform a parameter update with one of the optimizers.

Check Accuracy

This method basically is called at the end of each epoch. Basically it uses the current set of parameters, and predict the whole validation set. The objective is at the end get the accuracy. accuracy=mean(ypredicted==yvalidation)accuracy=mean(y_{predicted}==y_{validation})accuracy=mean(ypredicted​==yvalidation​)

Model loss operation

We mentioned during the "Step" operation that we get the model loss and gradients. This operation is implemented by the "getLoss" method. Consider the following basic model.

Also bellow we have the "softmaxloss" function including "dout", $$\frac{\partial L}{\partial X{scores}}$$

Bellow we have the "getLoss" function for the previous simple model.