How can I fix Errors when predicting values in trained LSBoost model?

3 ビュー (過去 30 日間)
SK
SK 2019 年 11 月 25 日
コメント済み: SK 2019 年 11 月 25 日
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 件のコメント
SK
SK 2019 年 11 月 25 日
Ridwan, I appreciate your willingness to help. trainedModel.mat exeeds 5MB limit even if zipped and I couldn't attach it here. Would you mind sharing your email so I could send you both? or please send an email to chigapo@gmail.com and I will respond. Thanks again!
Ridwan Alam
Ridwan Alam 2019 年 11 月 25 日
SK, I understand. On a second thought, I don't think I need to rerun the model. Let's debug step-by-step:
  1. what are the column names on "Forecast.xlsx"?
  2. inside the exported "trainedModel" struct, what are the values for "PredictorNames" and "CategoricalPredictors"?
  3. what are the variable names of T? you can find that out using T.Properties.VariableNames.

サインインしてコメントする。

採用された回答

Ridwan Alam
Ridwan Alam 2019 年 11 月 25 日
T = readtable("Forecast.xlsx");
T.HoursEnding = categorical(T.HoursEnding);
T.Month = categorical(T.Month);
yfit = trainedModel.predictFcn(T)
  3 件のコメント
Ridwan Alam
Ridwan Alam 2019 年 11 月 25 日
Thanks! Glad to help. Please vote up if you liked the conversation as well. Have a good day.
SK
SK 2019 年 11 月 25 日
Voted you up ma friend.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGaussian Process Regression についてさらに検索

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by