You think machine learning is tough?
In this thread we will go over how we can train a neural net in less than 3 minutes with only 8 lines of code.
(and no setup required)
In this thread we will go over how we can train a neural net in less than 3 minutes with only 8 lines of code.
(and no setup required)
We'll be using google collab for this exercise, it is an online IDE with free GPU support.
More about collab https://twitter.com/PrasoonPratham/status/1310173969325027328?s=20
More about collab https://twitter.com/PrasoonPratham/status/1310173969325027328?s=20
We'll try to predict the relation between the number of flats of a given house and its price accordingly.
Here's the code
Here's the code
Let's try to understand what is going on here
1. We import TensorFlow and Keras which are frameworks for making neural nets
2. Our Neural Net: This is where all the magic happens, for this exercise we need only one neuron.
1. We import TensorFlow and Keras which are frameworks for making neural nets
2. Our Neural Net: This is where all the magic happens, for this exercise we need only one neuron.
Think of a neuron as a function that tries to determine the correct relation between the input data (number of flats) and output data(the price of the house) through trial and error
In more complex neural nets we have hundreds or even thousands of neurons connected to each other
In more complex neural nets we have hundreds or even thousands of neurons connected to each other
3. Now we fit the model onto the data and repeat the process of trial and error for 500 times (aka the epochs).
4. Now we predict what will be the price of a house with 10 flats.
4. Now we predict what will be the price of a house with 10 flats.
That's it! It was that easy.
Here's the collab so that you can try it out for yourself https://colab.research.google.com/drive/1FxSrY6hwdgszzNydyobTLsMyO0bfpiPs?usp=sharing
Here's the collab so that you can try it out for yourself https://colab.research.google.com/drive/1FxSrY6hwdgszzNydyobTLsMyO0bfpiPs?usp=sharing