Jayaram18 / Jayaram18/TensorFlow-Pokemon-Course
Compile and Evaluate Model
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
Once we have decided on the specifics of our model, we need to do two processes: Compile the model and fit the data to the model.
We can compile the model like so:
`model.compile(optimizer='sgd', loss='sparse_categorical_crossentropy', metrics=['accuracy'])`
Here we're just feeding three parameters to `model.compile`. We pick an optimizer, which determines how the model is updated as it gains information, a loss function, which measures how accurate the model is as it trains, and metrics, which specifies which information it provides so we can analyze the model.
The optimizer we're using is the Stochastic Gradient Descent (SGD) optimization algorithm, but there are others available. For our loss we're using sparse_categorical_crossentropy. If our values were one-hot encoded, we would want to use "categorial_crossentropy" instead.
Then we have the model fit our training data:
`model.fit(train_data, train_labels, epochs=400)`
The three parameters `model.fit` needs are our training data, our training labels, and the number of epochs. One epoch is when the model has iterated over every sample once. Essentially the number of epochs is equal to the number of times we want to cycle through the data. We'll start with just 1 epoch, and then show that increasing the epoch improves the results.
**True or False**: We fit our model using *test_data* and *test_labels*.
Contributor guide
No contributing guide indexed for this repository
Research direction
No file, test, or entry point is named in the issue; inspect the repository's course structure to find where this lesson belongs. Use the supplied model.compile and model.fit examples and the True/False prompt as the completion criteria.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- documentation, machine-learning
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100