本文介绍了如何绘制与lassoPlot.m产生的图相似的图以指定正则化参数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试应用除套索以外的正则化优化.如果可以提供所需的所有数据,如何绘制类似于MATLAB中包含的lassoPlot.m
所产生的图形,如下所示?如何绘制I
形线条?我读了lassoPlot.m
,但找不到完成的方法.
I am trying to apply a regularized optimization other than Lasso.How can I plot the figure similar to the one produced by lassoPlot.m
included in MATLAB as shown below if all data needed can be provide?How to plot the I
-shaped lines?I read the lassoPlot.m
but cannot find out how it is done.
推荐答案
如果我必须手动创建一个这样的绘图,我会做这样的事情:
If I had to create a plot like this manually, I'd do something like this:
function q53809665
DATASET = [
0.601240818 459.5714648 6.549320679
0.38951982 407.6789162 6.915203670
0.250128593 366.9277664 8.668936114
0.162048287 339.5657219 9.739510946
0.104984588 307.3415556 8.790018144
0.067415433 285.0615823 8.484338823
0.043675756 269.5982984 11.06798324
0.028295771 260.4386699 15.11267808
0.018170016 257.2895579 18.61737927
0.011771625 259.6377656 21.91891116
0.007626364 263.2320447 26.44502524
0.004897239 271.3708739 29.95587021
0.003172725 281.8307622 33.79278025
0.002055481 297.9101884 37.48077341
0.001319919 313.8919378 41.61931914
0.000855123 329.4338429 45.13891826
0.000554000 343.8029749 48.41955847
0.000355749 355.8266151 51.22206310
0.000230475 364.9182681 53.60367903
0.000149316 371.7376732 55.08113765
9.58825E-05 376.5047798 56.84605825
6.21184E-05 379.8791639 57.35674048
4.02440E-05 382.3739682 57.86464961];
figure();
hEB = errorbar(DATASET(:,1), DATASET(:,2), DATASET(:,3),'.', 'MarkerEdgeColor','r',...
'MarkerSize',10, 'Color', 0.7*[1 1 1]);
hEB.Parent.XDir = 'reverse';
hEB.Parent.XScale = 'log';
hold on;
plot(DATASET(9,1), DATASET(9,2), 'og', 'MarkerSize', 10);
plot(DATASET(7,1), DATASET(7,2), 'ob', 'MarkerSize', 10);
xline(DATASET(9,1), ':g');
xline(DATASET(7,1), ':b');
xlabel('Lambda');
title('Cross-Validated Devians of Lasso Fit');
legend('Deviance with Error Bars', 'LambdaMinDeviance','Lambda1SE');
结果:
这篇关于如何绘制与lassoPlot.m产生的图相似的图以指定正则化参数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!