predicting house pricesa regression example note that you compile the network with the mse loss function--mean squared errorthe square of the difference between the predictions and the targets this is widely used loss function for regression problems you're also monitoring new metric during trainingmean absolute error (maeit' the absolute value of the difference between the predictions and the targets for instancean mae of on this problem would mean your predictions are off by $ on average validating your approach using -fold validation to evaluate your network while you keep adjusting its parameters (such as the number of epochs used for training)you could split the data into training set and validation setas you did in the previous examples but because you have so few data pointsthe validation set would end up being very small (for instanceabout examplesas consequencethe validation scores might change lot depending on which data points you chose to use for validation and which you chose for trainingthe validation scores might have high variance with regard to the validation split this would prevent you from reliably evaluating your model the best practice in such situations is to use -fold cross-validation (see figure it consists of splitting the available data into partitions (typically or )instantiating identical modelsand training each one on partitions while evaluating on the remaining partition the validation score for the model used is then the average of the validation scores obtained in terms of codethis is straightforward data split into partitions fold validation training training validation score # fold validation validation training validation score # fold validation training validation validation score # figure -fold cross-validat ion listing -fold validat ion import numpy as np num_val_samples len(train_data/ num_epochs all_scores [licensed to final scoreaverage