How can I fix Errors when predicting values in trained LSBoost model?
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hello friends, I am totally new to Matlab. I built a LSBoost Model in regression Lerner and imported it to Matlab. I wanted to test the model by inputing the value to predict the outcome. The model has 80 variables, 2 of which are Categorical (HoursEnding and Month). Below are my two lines of codes and bunch of error messages I am getting as a result. Guys please help me out with understanding the missing pieces and hot solve them. Much appreciate it.
My codes after importing trainedMidel into Matlab. Forecast.xlsx are where my predicting values are stored to solve for Y.
T = readtable("Forecast.xlsx");
yfit = trainedModel.predictFcn(T)
There are the errors I am getting as results. It appears that 2 of my categorical variables (HoursEnding and Month) need to be properly declaired. I just don't know how to.
Error using classreg.learning.internal.table2PredictMatrix>makeXMatrix (line 96)
Table variable HoursEnding is not a valid predictor.
Error in classreg.learning.internal.table2PredictMatrix (line 47)
Xout = makeXMatrix(X,CategoricalPredictors,vrange,pnames);
Error in classreg.learning.regr.RegressionModel/predict (line 169)
X = classreg.learning.internal.table2PredictMatrix(X,[],[],...
Error in classreg.learning.regr.CompactRegressionEnsemble/predict (line 95)
yfit = predict@classreg.learning.regr.RegressionModel(this,X,varargin{:});
Error in mlearnapp.internal.model.coremodel.TrainedRegressionEnsemble>@(x)predict(RegressionEnsemble,x) (line 50)
functionHandle = @(x) predict(RegressionEnsemble, x);
Error in mlearnapp.internal.model.transformation.TrainedManualFeatureSelection>@(x)decoratedPredictFunction(featureSelectionFunction(x)) (line 66)
functionHandle = @(x) decoratedPredictFunction(featureSelectionFunction(x));
Error in mlearnapp.internal.model.DatasetSpecification>@(x)exportableModel.predictFcn(predictorExtractionFcn(x)) (line 166)
newExportableModel.predictFcn = @(x) exportableModel.predictFcn(predictorExtractionFcn(x));
3 Kommentare
Ridwan Alam
am 25 Nov. 2019
SK, I understand. On a second thought, I don't think I need to rerun the model. Let's debug step-by-step:
- what are the column names on "Forecast.xlsx"?
- inside the exported "trainedModel" struct, what are the values for "PredictorNames" and "CategoricalPredictors"?
- what are the variable names of T? you can find that out using T.Properties.VariableNames.
Akzeptierte Antwort
Ridwan Alam
am 25 Nov. 2019
T = readtable("Forecast.xlsx");
T.HoursEnding = categorical(T.HoursEnding);
T.Month = categorical(T.Month);
yfit = trainedModel.predictFcn(T)
3 Kommentare
Ridwan Alam
am 25 Nov. 2019
Thanks! Glad to help. Please vote up if you liked the conversation as well. Have a good day.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Gaussian Process Regression finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!