Giter Club home page Giter Club logo

tf_vs_pt's Introduction

Exercise 2 - Custom training loop

Objective

In this exercise, you have to implement your first training and validation loops from scratch to train the logistic model you implemented. To do so, you will also have to create an optimizer.

Details

A training loop goes through element of the training dataset and uses it to update the model's weights. A validation loop goes through each element of the validation dataset and uses it to calculate the metrics (eg, accuracy). We call epoch an iteration of one training loop and one validation loop.

The input to your model should be normalized. You can do this by dividing them by 255: X /= 255.

You can run python training.py to train your first machine learning model!

You will need to specify the --imdir, e.g. --imdir GTSRB/Final_Training/Images/, using the provided GTSRB dataset.

Tips

You don't need tf.GradientTape for the validation loop as you will not be updating gradients.

The assign_sub Variable method will be useful to perform the weights update in the sgd optimizer.

Use the tf.one_hot function to get the one vector from the ground truth label.

tf_vs_pt's People

Contributors

alessandromondin avatar innovarul avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.