필터 지우기
필터 지우기

Lasso Plot Datatip Shows only X and Y

조회 수: 3 (최근 30일)
Skrowh
Skrowh 2022년 3월 2일
답변: Aditya 2023년 10월 20일
hi community I am trying to figure out how I can modify the lasso plot so that the datatip shows the name of the selected coefficient with a fitted value, the L1 norm of a set of coefficients including the selected coefficient, and the index of the corresponding Lambda. I am basically following the example included in the documentation Trace plot of lasso fit - MATLAB lassoPlot (mathworks.com), however my lassoplot only shows x and y instead of the helpful information I need. I am using Matlab Online version, and I have tried didfferent data to
Here is a screen of how mine datatip only shows X and Y value:

답변 (1개)

Aditya
Aditya 2023년 10월 20일
Hi Skrowh,
I followed the documentation and have simulated the example you mentioned. However, I was unable to reproduce the error you referred to. In order to assist you better, kindly share the complete code that is producing this error.
Below is the code that I have simulated. Please run this code and let me know if you get any error with this code.
load acetylene
X = [x1 x2 x3];
D = x2fx(X,'interaction');
D(:,1) = []; % No constant term
B = lasso(D,y);
lassoPlot(B,'PredictorNames',{'x1','x2','x3','x1.*x2','x1.*x3','x2.*x3'});
legend('show','Location','NorthWest') % Show legend
Hope this helps!

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by