官术网_书友最值得收藏!

Getting ready

Training a neural network is done in the following steps:

  1. Import the relevant packages and datasets
  2. Preprocess the targets (convert them into one-hot encoded vectors) so that we can perform optimization on top of them:
    • We shall be minimizing categorical cross entropy loss
  3. Create train and test datasets:
    • We have the train dataset so that we create a model based on it
    • The test dataset is not seen by the model:
      • Hence, the accuracy on the test dataset is an indicator of how well the model is likely to work on data when the model is productionalized, as data in the production scenario (which might occur a few days/weeks after building the model) cannot be seen by the model
  4. Initialize a model
  5. Define the model architecture:
    • Specify the number of units in a hidden layer
    • Specify the activation function that is to be performed in a hidden layer
    • Specify the number of hidden layers
    • Specify the loss function that we want to minimize
    • Provide the optimizer that will minimize the loss function
  6. Fit the model:
    • Mention the batch size to update weights
    • Mention the total number of epochs
  7. Test the model:
    • Mention the validation data, otherwise, mention the validation split, which will consider the last x% of total data as test data
    • Calculate the accuracy and loss values on top of the test dataset
  8. Check for anything interesting in the way in which loss value and accuracy values changed over an increasing number of epochs

Using this strategy, let's go ahead and build a neural network model in Keras, in the following section.

主站蜘蛛池模板: 台东市| 革吉县| 夏邑县| 县级市| 云林县| 岳普湖县| 临沧市| 郸城县| 乃东县| 定安县| 盘锦市| 山丹县| 郎溪县| 玉田县| 治县。| 区。| 开平市| 色达县| 兴安县| 绥德县| 农安县| 九台市| 灵宝市| 泗洪县| 枣阳市| 鄂伦春自治旗| 东乡族自治县| 宝鸡市| 嘉兴市| 德江县| 抚宁县| 双峰县| 化州市| 乐陵市| 鱼台县| 英山县| 淮安市| 岳西县| 建平县| 中山市| 星子县|