Skip to content

Commit

Permalink
tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
mcabbott committed Sep 27, 2022
1 parent 8b8e06c commit a026e5c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion docs/src/models/basics.md
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ m = Chain(x -> x^2, x -> x+1)
m(5) # => 26
```

## Layer helpers
## Layer Helpers

Flux provides a set of helpers for custom layers, which you can enable by calling

Expand Down
12 changes: 6 additions & 6 deletions docs/src/models/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Under the hood, Flux uses a technique called automatic differentiation to take g

Here's how you'd use Flux to build and train the most basic of models, step by step.

## Make a Trivial Prediction
### A Trivial Prediction

This example will predict the output of the function `4x + 2`. Making such predictions is called "linear regression", and is really too simple to *need* a neural network. But it's a nice toy example.

Expand All @@ -26,7 +26,7 @@ actual (generic function with 1 method)

This example will build a model to approximate the `actual` function.

## Provide Training and Test Data
## 1. Provide Training and Test Data

Use the `actual` function to build sets of data for training and verification:

Expand All @@ -40,7 +40,7 @@ julia> y_train, y_test = actual.(x_train), actual.(x_test)

Normally, your training and test data come from real world observations, but here we simulate them.

## Build a Model to Make Predictions
## 2. Build a Model to Make Predictions

Now, build a model to make predictions with `1` input and `1` output:

Expand Down Expand Up @@ -85,7 +85,7 @@ julia> loss(x_train, y_train)

More accurate predictions will yield a lower loss. You can write your own loss functions or rely on those already provided by Flux. This loss function is called [mean squared error](https://www.statisticshowto.com/probability-and-statistics/statistics-definitions/mean-squared-error/). Flux works by iteratively reducing the loss through *training*.

## Improve the Prediction
## 3. Improve the Prediction

Under the hood, the Flux [`Flux.train!`](@ref) function uses *a loss function* and *training data* to improve the *parameters* of your model based on a pluggable [`optimiser`](../training/optimisers.md):

Expand Down Expand Up @@ -150,7 +150,7 @@ Params([Float32[7.5777884], Float32[1.9466728]])

The parameters have changed. This single step is the essence of machine learning.

## Iteratively Train the Model
## 3+. Iteratively Train the Model

In the previous section, we made a single call to `train!` which iterates over the data we passed in just once. An *epoch* refers to one pass over the dataset. Typically, we will run the training for multiple epochs to drive the loss down even further. Let's run it a few more times:

Expand All @@ -168,7 +168,7 @@ Params([Float32[4.0178537], Float32[2.0050256]])

After 200 training steps, the loss went down, and the parameters are getting close to those in the function the model is built to predict.

## Verify the Results
## 4. Verify the Results

Now, let's verify the predictions:

Expand Down

0 comments on commit a026e5c

Please sign in to comment.