Another example where fitrlinear performs badly and I don't know where the problem is
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Peter He
el 6 de Abr. de 2022
Comentada: Peter He
el 31 de Dic. de 2023
I'm testing the three functions fitlm, fitglm, and fitrlinear by trying linear regression using the same dataset. fitrlinear performs very poorly compared to fitlm and fitglm. I was expecting the same models (therefore the same MSE's) for the three different functions.
I had another issue with fitrlinear when ridge regularization is used. Here is the link to that question,wich has not been answered yet.
0 comentarios
Respuesta aceptada
Milan Bansal
el 29 de Dic. de 2023
Hi Peter He,
It is my understanding that you are testing "fitlm", "fitglm", and "fitrlinear" function to fit a linear model to your dataset but the "fitrlinear" model is performing poorly as compared to other two models. Also the Mean Square Error (MSE) for "fitlm" and "fitglm" model are same but it significantly high in case of "fitrlinear" model.
The "fitrlinear" model is optimized for large-scale, high-dimensional data. It uses iterative solvers that are more scalable to large datasets, such as stochastic gradient descent (SGD) or dual coordinate descent. The convergence is subjected to tolerance on Beta coefficients.
To achieve the same performance and MSE as "fitlm" and "fitglm" models, set the value "BetaTolerance" parameter in "fitrlinear" as 0. Also ensure that the "lambda" parameter is also set to 0 to avoid regularization. Please refer to the code snippet below: -
mdl = fitrlinear(trainingSet_X,trainingSet_Y,'Learner','leastsquares','Lambda',0,"BetaTolerance",0)
Please refer to the documentation below to learn more about "fitrlinear" model.
Please refer to the documentation below to learn more about "BetaTolerance" parameter of "fitrlinear" model.
Hope it helps!
Más respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!