- Mean
- Median
- Sum
- Maximum or Minimum
- Standard deviation
how to make vector as response value using gaussian process regression?
1 view (last 30 days)
Show older comments
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1116090/image.png)
I want to predict 'Vertices' coulmn with fitrgp(gaussian process regression).
gprMdl = fitrgp(a,'Vertices','KernelFunction','ardsquaredexponential',...
'FitMethod','sr','PredictMethod','fic','Standardize',1)
the error occured saying that Invalid datatype. Response variable must be double vector or single vector.
Please let me know how to solve this problem.
Thanks.
0 Comments
Answers (1)
Harimurali
on 15 Sep 2023
Hi Sierra,
I understand that you want to use the first column, that is, the ‘vertices’ column from the table, which is of the type of cell array, as the response variable for Gaussian Process Regression.
In this case, when you are using the “fitrgp” function, it is required that the response variable be a double vector or single vector. Gaussian process regression in MATLAB assumes a single response variable for each observation.
The column could be converted into a double vector and used as a response variable. To achieve this, you can use a method known as "aggregation" or "summary statistics". This entails using a selected measure or summary statistic to summarize the vector entries into a single value.
Here are a few common metrics you can consider:
Here's an example of how you can convert the column into a double vector using the mean as the summary statistic:
c = cell2table({[1,2,4], 2, 4;[2, 3], 3, 5; [10, 20, 5,6], 15, 6});
c.Var1 = cellfun(@mean, c{:, 1});
gprMdl = fitrgp(c, 'Var1', 'KernelFunction','ardsquaredexponential',...
'FitMethod','sr','PredictMethod','fic','Standardize',1);
Please refer to the following documentation for more information on ‘responseVarName’ parameter of the “fitrgrgp” function:
You may also refer to the help documentation for the "fitrgp" function in MATLAB using the following command:
help fitrgp
Hope this helps to resolve the error.
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!