Predict Test Sample Response for SVM Regression Model
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi
I am running test on data samples using the example of SVM Regression Model, in the case of the example given in this MathWorks documentation (link) the training data needs to have the same number of rows as the predict data, this is required so far to be able to run the prediction. What can I do if my data varies from the number of rows? How can I train my support vector machine with a data that have diferent number of samples and still be able to predict with the consequence of having maybe bigger error?
Data sample of the training data for the model and the data that I want to use for Mdl = fitrsvm.
ans=10×2 table
Training data Data to predict
_____________ ______________
14 9.4833
27 28.938
10 7.765
28
22 21.054
29 31.484
24.5 30.306
18.5
32 28.225
28
0 comentarios
Respuestas (1)
Bhargavi Maganuru
el 11 de Sept. de 2019
You can make changes in the example given in MathWorks documentation page to use different data which has different number of samples.
load carsmall
tbl = table(Horsepower,Weight,MPG);
N = size(tbl,1);
Instead of using carsmall dataset you can load your own dataset.
rng(10); % For reproducibility
cvp = cvpartition(N,'Holdout',0.1);
idxTrn = training(cvp); % Training set indices
idxTest = test(cvp); % Test set indices
You can partition your own data into training data and the testing data using cvpartition(N,’HoldOut’,p) by setting p to get p*N number of test samples.
Also ObservedValuevariable in the ans table is the actual target value for the test data and the PredictedValue variable in the ans table is the predicted value for the test data.
1 comentario
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!