Hi Luca,
I understand that you need to use specific data points of your choice as the validation set for your regression model.
There are multiple ways to achieve this, some of them are
- You can split your dataset into ‘training’, ‘validation’, and ‘testing’ sets according to your requirements before feeding it to the model.
The code snippet below demonstrates how to split a dataset into 70% for training, 15% for validation, and 15% for testing:
split1 = 0.70 ; split2 = 0.85 ;
m = round(split1*r) ; n = round(split2*r) ;
Training = dataset(idx(1:m),:) ;
Validation = dataset(idx(m+1:n),:) ;
Testing = dataset(idx(n+1:end),:) ;
- You can use the ‘cvpartition’ MATLAB function.
- You can utilize the ‘Set aside a test data set’ feature in the ‘Regression Learner App’.
For more details, please refer the following MATLAB documentation
- https://www.mathworks.com/help/stats/cvpartition.html
- https://www.mathworks.com/help/stats/train-regression-model-using-hyperparameter-optimization-in-regression-learner-app.html
Hope this helps!
Best Regards, Aryan Gupta