Using Generalized Additive Model to smooth the data

3 ビュー (過去 30 日間)
Sahar khalili
Sahar khalili 2022 年 9 月 15 日
コメント済み: Konrad 2022 年 9 月 20 日
Hi, I have some data, which is light measured vs date, 24 measurements every day.
I would like to use Generalized Additive Model (GAM) to smooth the measurments to better integrates trend in my dataset.
Here is my dataset. Does anyone can help me how to use GAM to smooth my dataset?
  5 件のコメント
Sahar khalili
Sahar khalili 2022 年 9 月 19 日
I am using these datetime values as vaiables, and I write down this code Mdl = fitrgam(y1,xData)
But I face this error:
Error using classreg.learning.regr.FullRegressionModel.prepareData (line 381)
Invalid data type. Response must be a double or single vector.
Konrad
Konrad 2022 年 9 月 20 日
Sounds like your (repsonse-) variable has the wrong data type ;)
The screenshot in your question indicates that your response variable 'P_surf' is of type cell. Try to convert it:
y1 = cell2mat(P_surf);
Your predictor (which has only 358 colums btw) seems to be of type 'datetime'. If fitgram() can't handle that, try to convert it using datenum().
If that does not solve the error, post the output of class(y1) and class(xData).

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

回答 (0 件)

カテゴリ

Help Center および File ExchangeSpectral Measurements についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by