Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
computer_science:machine_learning:udacity:intro_to_tensorflow_for_deep_learning:basics_training_your_first_model [2020/08/11 12:35] – carlossousa | computer_science:machine_learning:udacity:intro_to_tensorflow_for_deep_learning:basics_training_your_first_model [2023/12/01 12:07] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 15: | Line 15: | ||
---- | ---- | ||
- | ==== Import dependencies ==== | + | ===== Import dependencies |
First, import TensorFlow. Here, we're calling it '' | First, import TensorFlow. Here, we're calling it '' | ||
Line 30: | Line 30: | ||
</ | </ | ||
- | ==== Set up Training Data ==== | + | ===== Set up Training Data ===== |
We create two lists '' | We create two lists '' | ||
Line 43: | Line 43: | ||
</ | </ | ||
- | **Some Machine Learning terminology** | + | ==== Some Machine Learning terminology |
- | * **Feature** | + | |
* **Labels** | * **Labels** | ||
* **Example** | * **Example** | ||
Next, create the model. We will use the simplest possible model we can, a Dense network. Since the problem is straightforward, | Next, create the model. We will use the simplest possible model we can, a Dense network. Since the problem is straightforward, | ||
- | ==== Create the model ==== | + | ===== Create the model ===== |
We'll call the layer '' | We'll call the layer '' | ||
Line 63: | Line 63: | ||
</ | </ | ||
- | ==== Compile the model with loss and optimizer functions ==== | + | ===== Compile the model with loss and optimizer functions |
Before training, the model has to be compiled. When compiled for training, the model is given: | Before training, the model has to be compiled. When compiled for training, the model is given: | ||
Line 86: | Line 86: | ||
One part of the Optimizer you may need to think about when building your own models is the learning rate ('' | One part of the Optimizer you may need to think about when building your own models is the learning rate ('' | ||
- | ==== Train the Model ==== | + | ===== Train the Model ===== |
Train the model by calling the '' | Train the model by calling the '' | ||
Line 101: | Line 101: | ||
</ | </ | ||
- | ==== Display Training Statistics ==== | + | ===== Display Training Statistics |
The '' | The '' | ||
Line 116: | Line 116: | ||
</ | </ | ||
- | ==== Use the Model to Predict Values ==== | + | ===== Use the Model to Predict Values |
Now you have a model that has been trained to learn the relationship between '' | Now you have a model that has been trained to learn the relationship between '' | ||
Line 155: | Line 155: | ||
With additional neurons, additional inputs, and additional outputs, the formula becomes much more complex, but the idea is the same. | With additional neurons, additional inputs, and additional outputs, the formula becomes much more complex, but the idea is the same. | ||
- | ==== A little experiment ==== | + | ===== A little experiment |
Just for fun, what if we created more Dense layers with different units, which therefore also has more variables? | Just for fun, what if we created more Dense layers with different units, which therefore also has more variables? | ||
Line 178: | Line 178: | ||
As you can see, this model is also able to predict the corresponding Fahrenheit value really well. But when you look at the variables (weights) in the '' | As you can see, this model is also able to predict the corresponding Fahrenheit value really well. But when you look at the variables (weights) in the '' | ||
- | ==== The complete code and output ==== | + | ===== The complete code and output |
The Code: | The Code: |