我正在尝试套用套索以外的正则化优化。
如果可以提供所需的所有数据,如何绘制类似于MATLAB中lassoPlot.m
生成的图形,如下所示?
如何绘制I
形的线?
我读了lassoPlot.m
,但找不到答案。
答案 0 :(得分:0)
如果我必须手动创建一个这样的绘图,我会做这样的事情:
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');
结果: