Lasso Plot Datatip Shows only X and Y
3 ビュー (過去 30 日間)
古いコメントを表示
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:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/912185/image.png)
0 件のコメント
回答 (1 件)
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!
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!