필터 지우기
필터 지우기

How to initialize the class in MATALB?

조회 수: 1 (최근 30일)
Adan91h
Adan91h 2018년 7월 5일
편집: per isakson 2018년 7월 8일
I want to use 'fitrgp' function in Matlab Simulink.
fitrgp returns a GPmodel and its type of class is 'RegressionGP'.
for example:
y=fitrgp(rand(100,2),rand(100,1));
class(y)
ans =
'RegressionGP'
i used the matlab function block in MATLAB simulink and used the following code
function y = fcn()
coder.extrinsic('fitrgp');
y=fitrgp(rand(100,2),rand(100,1));
it gives me following error and recommends me to preinitialize the output.
Function output 'y' cannot be an mxArray in this context. Consider
preinitializing the output variable with a known type
how can i preinitialize this 'RegressionGP' class so that i can use 'fitrgp' command in MATLAB Simulink?
  댓글 수: 2
Wooshik Kim
Wooshik Kim 2018년 7월 5일
you can try initializing y
what is the output of fitrgp?
if it is an array, initialize y with an array of the same size
Adan91h
Adan91h 2018년 7월 6일
Hi Kim,
No it is not an array. The output is a ''class'' with type 'RegressionGP'.
see the below response
>> y=fitrgp(rand(100,2),rand(100,1));
>> y
y =
RegressionGP
ResponseName: 'Y'
CategoricalPredictors: []
ResponseTransform: 'none'
NumObservations: 100
KernelFunction: 'SquaredExponential'
KernelInformation: [1×1 struct]
BasisFunction: 'Constant'
Beta: 0.5041
Sigma: 0.2552
PredictorLocation: []
PredictorScale: []
Alpha: [100×1 double]
ActiveSetVectors: [100×2 double]
PredictMethod: 'Exact'
ActiveSetSize: 100
FitMethod: 'Exact'
ActiveSetMethod: 'Random'
IsActiveSetVector: [100×1 logical]
LogLikelihood: -11.8893
ActiveSetHistory: []
BCDInformation: []
Properties, Methods
>>

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Gaussian Process Regression에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by