{"group":{"id":1,"name":"Community","lockable":false,"created_at":"2012-01-18T18:02:15.000Z","updated_at":"2026-04-16T00:12:35.000Z","description":"Problems submitted by members of the MATLAB Central community.","is_default":true,"created_by":161519,"badge_id":null,"featured":false,"trending":false,"solution_count_in_trending_period":0,"trending_last_calculated":"2026-04-16T00:00:00.000Z","image_id":null,"published":true,"community_created":false,"status_id":2,"is_default_group_for_player":false,"deleted_by":null,"deleted_at":null,"restored_by":null,"restored_at":null,"description_opc":null,"description_html":null,"published_at":null},"problems":[{"id":44734,"title":"Solve the 2-norm Regularization Problem","description":"In data fitting, regularization is a technique to stabilize an ill-posed problem. \u003chttps://en.wikipedia.org/wiki/Tikhonov_regularization Ridge Regression (aka Tikhonov regularizaton)\u003e adds the 2-norm of the coefficient vector to the least squares problem. The cost function looks like this:\r\n\r\nJ=1/2*norm(A*x-b,2)^2+norm(alpha*x,2)^2   (MATLAB equation if image doesn't display)\r\n\r\n\u003c\u003chttps://image.ibb.co/n0G5xp/Equation1.png\u003e\u003e\r\n\r\nwhere |x| is the coefficient vector, |b| corresponds to observations, |A| comes from evaluating terms of an equation, alpha corresponds to a chosen scalar weight value, and |J| is the cost. The minimization of this cost function is ridge regression. When alpha is zero and the least squares problem is ill-conditioned, this problem is unstable meaning that small changes in |b| cause large changes in |x|. Choosing alpha appropriately for a given problem stabilizes the problem causing small changes in |b| causes a small change in |x|.\r\n\r\nThis Cody problem is about solving the Ridge Regression problem. Implement the solution to the ridge regression problem. This is best done by solving a dual problem. Minimizes a different cost function yields the solution that solves the Ridge Regression problem:\r\n\r\nJ = 1/2*norm([A;alpha*eye(n)]*x-[b;zeros(1,n)],2)^2  (MATLAB equation if image doesn't display)\r\n\r\n\u003c\u003chttps://image.ibb.co/hkAZOU/equation2.png\u003e\u003e\r\n\r\nTherefore, write a function that minimum of the dual problem for a given A, alpha, and b.","description_html":"\u003cp\u003eIn data fitting, regularization is a technique to stabilize an ill-posed problem. \u003ca href = \"https://en.wikipedia.org/wiki/Tikhonov_regularization\"\u003eRidge Regression (aka Tikhonov regularizaton)\u003c/a\u003e adds the 2-norm of the coefficient vector to the least squares problem. The cost function looks like this:\u003c/p\u003e\u003cp\u003eJ=1/2*norm(A*x-b,2)^2+norm(alpha*x,2)^2   (MATLAB equation if image doesn't display)\u003c/p\u003e\u003cimg src = \"https://image.ibb.co/n0G5xp/Equation1.png\"\u003e\u003cp\u003ewhere \u003ctt\u003ex\u003c/tt\u003e is the coefficient vector, \u003ctt\u003eb\u003c/tt\u003e corresponds to observations, \u003ctt\u003eA\u003c/tt\u003e comes from evaluating terms of an equation, alpha corresponds to a chosen scalar weight value, and \u003ctt\u003eJ\u003c/tt\u003e is the cost. The minimization of this cost function is ridge regression. When alpha is zero and the least squares problem is ill-conditioned, this problem is unstable meaning that small changes in \u003ctt\u003eb\u003c/tt\u003e cause large changes in \u003ctt\u003ex\u003c/tt\u003e. Choosing alpha appropriately for a given problem stabilizes the problem causing small changes in \u003ctt\u003eb\u003c/tt\u003e causes a small change in \u003ctt\u003ex\u003c/tt\u003e.\u003c/p\u003e\u003cp\u003eThis Cody problem is about solving the Ridge Regression problem. Implement the solution to the ridge regression problem. This is best done by solving a dual problem. Minimizes a different cost function yields the solution that solves the Ridge Regression problem:\u003c/p\u003e\u003cp\u003eJ = 1/2*norm([A;alpha*eye(n)]*x-[b;zeros(1,n)],2)^2  (MATLAB equation if image doesn't display)\u003c/p\u003e\u003cimg src = \"https://image.ibb.co/hkAZOU/equation2.png\"\u003e\u003cp\u003eTherefore, write a function that minimum of the dual problem for a given A, alpha, and b.\u003c/p\u003e","function_template":"function x = ridgeRegression(A,alpha,b)\r\n  x = A\\b;\r\nend","test_suite":"clc; clear; close all;\r\n%% Test 1\r\nx = [36.8730230456394;39.5842747401717;43.380027112517;45.5490284681428;47.7180298237686;51.2426570266606;54.4961590600994;54.4961590600994;46.0912788070492;42.295526434704;46.0912788070493;57.2074107546317;87.3023045639404;93.2670582919114;97.3339358337099;97.0628106642567;107.907817442386;117.668323542702;126.615454134659;122.277451423407;115.77044735653;120.379575237235;114.008133755084;126.073203795752;128.513330320831;108.043380027112;144.509715318572;147.220967013104;145.051965657479;141.79846362404;144.509715318572;154.134658834162;145.594215996385;142.20515137822;165.250790781744;188.025305015816;174.875734297334;178.535924084953;182.196113872571;197.650248531405;197.107998192499;196.972435607772;193.44780840488;196.972435607772;230.998644374153;230.998644374153;257.026660641663;265.16041572526;60.4609127880705;57.478535924085;56.394035246272;249.977406235879;251.875282422052;260.009037505648];\r\ny = [356.149242377445;298.33521343792;53.36679594417;153.87816272061;369.497443166114;469.878773890057;714.171003910829;944.386831248959;830.085141105366;1039.08233557753;1470.37291088954;1505.27783828066;2164.26154151238;2113.32967065118;2710.06186465197;1055.41161286966;155.09074891013;765.66528069907;361.929344910872;1606.94977682562;1578.79697146034;2132.31168341422;2284.0019895516;2124.57128738942;2779.01348148774;4003.99860861424;3094.02581865822;3748.44200554603;4014.83711358974;2029.53768932436;2158.77402009707;2402.45508067111;1568.74193370111;813.671340379116;4077.64777784641;4665.39122971844;2062.33603266505;320.97774107871;716.310096974383;736.410419788883;1535.02358528902;1916.33155292304;2506.59770421349;3088.99342342664;3409.47052570325;2682.85182066728;3054.45584788382;5787.48858120914;2555.32546398489;339.784205170881;109.672406674747;3673.83707132802;3759.98595610633;6766.39998439567];\r\nA = [x.^0 x];\r\nalpha = 0;\r\nc = [50.5072813195826;14.809837633449];\r\nc2 = ridgeRegression(A,alpha,y);\r\ndc = c - c2;\r\nassert(norm(dc) \u003c eps(norm(c))*1000);\r\n%% Test 2\r\nx = [36.8730230456394;39.5842747401717;43.380027112517;45.5490284681428;47.7180298237686;51.2426570266606;54.4961590600994;54.4961590600994;46.0912788070492;42.295526434704;46.0912788070493;57.2074107546317;87.3023045639404;93.2670582919114;97.3339358337099;97.0628106642567;107.907817442386;117.668323542702;126.615454134659;122.277451423407;115.77044735653;120.379575237235;114.008133755084;126.073203795752;128.513330320831;108.043380027112;144.509715318572;147.220967013104;145.051965657479;141.79846362404;144.509715318572;154.134658834162;145.594215996385;142.20515137822;165.250790781744;188.025305015816;174.875734297334;178.535924084953;182.196113872571;197.650248531405;197.107998192499;196.972435607772;193.44780840488;196.972435607772;230.998644374153;230.998644374153;257.026660641663;265.16041572526;60.4609127880705;57.478535924085;56.394035246272;249.977406235879;251.875282422052;260.009037505648];\r\ny = [356.149242377445;298.33521343792;53.36679594417;153.87816272061;369.497443166114;469.878773890057;714.171003910829;944.386831248959;830.085141105366;1039.08233557753;1470.37291088954;1505.27783828066;2164.26154151238;2113.32967065118;2710.06186465197;1055.41161286966;155.09074891013;765.66528069907;361.929344910872;1606.94977682562;1578.79697146034;2132.31168341422;2284.0019895516;2124.57128738942;2779.01348148774;4003.99860861424;3094.02581865822;3748.44200554603;4014.83711358974;2029.53768932436;2158.77402009707;2402.45508067111;1568.74193370111;813.671340379116;4077.64777784641;4665.39122971844;2062.33603266505;320.97774107871;716.310096974383;736.410419788883;1535.02358528902;1916.33155292304;2506.59770421349;3088.99342342664;3409.47052570325;2682.85182066728;3054.45584788382;5787.48858120914;2555.32546398489;339.784205170881;109.672406674747;3673.83707132802;3759.98595610633;6766.39998439567];\r\nA = [x.^0 x];\r\nalpha = 1;\r\nc = [46.3633165923753;14.8348826094771];\r\nc2 = ridgeRegression(A,alpha,y);\r\ndc = c - c2;\r\nassert(norm(dc) \u003c eps(norm(c))*1000);\r\n%% Test 3\r\nx = [36.8730230456394;39.5842747401717;43.380027112517;45.5490284681428;47.7180298237686;51.2426570266606;54.4961590600994;54.4961590600994;46.0912788070492;42.295526434704;46.0912788070493;57.2074107546317;87.3023045639404;93.2670582919114;97.3339358337099;97.0628106642567;107.907817442386;117.668323542702;126.615454134659;122.277451423407;115.77044735653;120.379575237235;114.008133755084;126.073203795752;128.513330320831;108.043380027112;144.509715318572;147.220967013104;145.051965657479;141.79846362404;144.509715318572;154.134658834162;145.594215996385;142.20515137822;165.250790781744;188.025305015816;174.875734297334;178.535924084953;182.196113872571;197.650248531405;197.107998192499;196.972435607772;193.44780840488;196.972435607772;230.998644374153;230.998644374153;257.026660641663;265.16041572526;60.4609127880705;57.478535924085;56.394035246272;249.977406235879;251.875282422052;260.009037505648];\r\ny = [356.149242377445;298.33521343792;53.36679594417;153.87816272061;369.497443166114;469.878773890057;714.171003910829;944.386831248959;830.085141105366;1039.08233557753;1470.37291088954;1505.27783828066;2164.26154151238;2113.32967065118;2710.06186465197;1055.41161286966;155.09074891013;765.66528069907;361.929344910872;1606.94977682562;1578.79697146034;2132.31168341422;2284.0019895516;2124.57128738942;2779.01348148774;4003.99860861424;3094.02581865822;3748.44200554603;4014.83711358974;2029.53768932436;2158.77402009707;2402.45508067111;1568.74193370111;813.671340379116;4077.64777784641;4665.39122971844;2062.33603266505;320.97774107871;716.310096974383;736.410419788883;1535.02358528902;1916.33155292304;2506.59770421349;3088.99342342664;3409.47052570325;2682.85182066728;3054.45584788382;5787.48858120914;2555.32546398489;339.784205170881;109.672406674747;3673.83707132802;3759.98595610633;6766.39998439567];\r\nA = [x.^0 x];\r\nalpha = 10;\r\nc = [5.15542113869052;15.0827828176993];\r\nc2 = ridgeRegression(A,alpha,y);\r\ndc = c - c2;\r\nassert(norm(dc) \u003c eps(norm(c))*1000);\r\n%% Test 4\r\nx = [36.8730230456394;39.5842747401717;43.380027112517;45.5490284681428;47.7180298237686;51.2426570266606;54.4961590600994;54.4961590600994;46.0912788070492;42.295526434704;46.0912788070493;57.2074107546317;87.3023045639404;93.2670582919114;97.3339358337099;97.0628106642567;107.907817442386;117.668323542702;126.615454134659;122.277451423407;115.77044735653;120.379575237235;114.008133755084;126.073203795752;128.513330320831;108.043380027112;144.509715318572;147.220967013104;145.051965657479;141.79846362404;144.509715318572;154.134658834162;145.594215996385;142.20515137822;165.250790781744;188.025305015816;174.875734297334;178.535924084953;182.196113872571;197.650248531405;197.107998192499;196.972435607772;193.44780840488;196.972435607772;230.998644374153;230.998644374153;257.026660641663;265.16041572526;60.4609127880705;57.478535924085;56.394035246272;249.977406235879;251.875282422052;260.009037505648];\r\ny = [356.149242377445;298.33521343792;53.36679594417;153.87816272061;369.497443166114;469.878773890057;714.171003910829;944.386831248959;830.085141105366;1039.08233557753;1470.37291088954;1505.27783828066;2164.26154151238;2113.32967065118;2710.06186465197;1055.41161286966;155.09074891013;765.66528069907;361.929344910872;1606.94977682562;1578.79697146034;2132.31168341422;2284.0019895516;2124.57128738942;2779.01348148774;4003.99860861424;3094.02581865822;3748.44200554603;4014.83711358974;2029.53768932436;2158.77402009707;2402.45508067111;1568.74193370111;813.671340379116;4077.64777784641;4665.39122971844;2062.33603266505;320.97774107871;716.310096974383;736.410419788883;1535.02358528902;1916.33155292304;2506.59770421349;3088.99342342664;3409.47052570325;2682.85182066728;3054.45584788382;5787.48858120914;2555.32546398489;339.784205170881;109.672406674747;3673.83707132802;3759.98595610633;6766.39998439567];\r\nA = [x.^0 x];\r\nalpha = 100;\r\nc = [0.146854633219172;14.986428814777];\r\nc2 = ridgeRegression(A,alpha,y);\r\ndc = c - c2;\r\nassert(norm(dc) \u003c eps(norm(c))*1000);\r\n%% Test 5\r\n% This one is rank deficient without regularization.\r\nx = [36.8730230456394;39.5842747401717;43.380027112517;45.5490284681428;47.7180298237686;51.2426570266606;54.4961590600994;54.4961590600994;46.0912788070492;42.295526434704;46.0912788070493;57.2074107546317;87.3023045639404;93.2670582919114;97.3339358337099;97.0628106642567;107.907817442386;117.668323542702;126.615454134659;122.277451423407;115.77044735653;120.379575237235;114.008133755084;126.073203795752;128.513330320831;108.043380027112;144.509715318572;147.220967013104;145.051965657479;141.79846362404;144.509715318572;154.134658834162;145.594215996385;142.20515137822;165.250790781744;188.025305015816;174.875734297334;178.535924084953;182.196113872571;197.650248531405;197.107998192499;196.972435607772;193.44780840488;196.972435607772;230.998644374153;230.998644374153;257.026660641663;265.16041572526;60.4609127880705;57.478535924085;56.394035246272;249.977406235879;251.875282422052;260.009037505648];\r\ny = [356.149242377445;298.33521343792;53.36679594417;153.87816272061;369.497443166114;469.878773890057;714.171003910829;944.386831248959;830.085141105366;1039.08233557753;1470.37291088954;1505.27783828066;2164.26154151238;2113.32967065118;2710.06186465197;1055.41161286966;155.09074891013;765.66528069907;361.929344910872;1606.94977682562;1578.79697146034;2132.31168341422;2284.0019895516;2124.57128738942;2779.01348148774;4003.99860861424;3094.02581865822;3748.44200554603;4014.83711358974;2029.53768932436;2158.77402009707;2402.45508067111;1568.74193370111;813.671340379116;4077.64777784641;4665.39122971844;2062.33603266505;320.97774107871;716.310096974383;736.410419788883;1535.02358528902;1916.33155292304;2506.59770421349;3088.99342342664;3409.47052570325;2682.85182066728;3054.45584788382;5787.48858120914;2555.32546398489;339.784205170881;109.672406674747;3673.83707132802;3759.98595610633;6766.39998439567];\r\nA = x.^(0:6);\r\nc = A\\y;\r\nalpha = 0;\r\nc2 = ridgeRegression(A,alpha,y);\r\ndc = c - c2;\r\nassert(norm(dc) \u003c eps(norm(c))*1000);\r\n%% Test 6\r\nx = [36.8730230456394;39.5842747401717;43.380027112517;45.5490284681428;47.7180298237686;51.2426570266606;54.4961590600994;54.4961590600994;46.0912788070492;42.295526434704;46.0912788070493;57.2074107546317;87.3023045639404;93.2670582919114;97.3339358337099;97.0628106642567;107.907817442386;117.668323542702;126.615454134659;122.277451423407;115.77044735653;120.379575237235;114.008133755084;126.073203795752;128.513330320831;108.043380027112;144.509715318572;147.220967013104;145.051965657479;141.79846362404;144.509715318572;154.134658834162;145.594215996385;142.20515137822;165.250790781744;188.025305015816;174.875734297334;178.535924084953;182.196113872571;197.650248531405;197.107998192499;196.972435607772;193.44780840488;196.972435607772;230.998644374153;230.998644374153;257.026660641663;265.16041572526;60.4609127880705;57.478535924085;56.394035246272;249.977406235879;251.875282422052;260.009037505648];\r\ny = [356.149242377445;298.33521343792;53.36679594417;153.87816272061;369.497443166114;469.878773890057;714.171003910829;944.386831248959;830.085141105366;1039.08233557753;1470.37291088954;1505.27783828066;2164.26154151238;2113.32967065118;2710.06186465197;1055.41161286966;155.09074891013;765.66528069907;361.929344910872;1606.94977682562;1578.79697146034;2132.31168341422;2284.0019895516;2124.57128738942;2779.01348148774;4003.99860861424;3094.02581865822;3748.44200554603;4014.83711358974;2029.53768932436;2158.77402009707;2402.45508067111;1568.74193370111;813.671340379116;4077.64777784641;4665.39122971844;2062.33603266505;320.97774107871;716.310096974383;736.410419788883;1535.02358528902;1916.33155292304;2506.59770421349;3088.99342342664;3409.47052570325;2682.85182066728;3054.45584788382;5787.48858120914;2555.32546398489;339.784205170881;109.672406674747;3673.83707132802;3759.98595610633;6766.39998439567];\r\nA = x.^(0:6);\r\nalpha = 10;\r\nc = [-1.48348345971319;-21.370159200147;1.50455732468686;-0.0214851248485215;0.000148821639521563;-5.20003346155603e-07;7.26127822714741e-10];\r\nc2 = ridgeRegression(A,alpha,y);\r\ndc = c - c2;\r\nassert(norm(dc) \u003c eps(norm(c))*1000);\r\n%% Test 7\r\nx = [36.8730230456394;39.5842747401717;43.380027112517;45.5490284681428;47.7180298237686;51.2426570266606;54.4961590600994;54.4961590600994;46.0912788070492;42.295526434704;46.0912788070493;57.2074107546317;87.3023045639404;93.2670582919114;97.3339358337099;97.0628106642567;107.907817442386;117.668323542702;126.615454134659;122.277451423407;115.77044735653;120.379575237235;114.008133755084;126.073203795752;128.513330320831;108.043380027112;144.509715318572;147.220967013104;145.051965657479;141.79846362404;144.509715318572;154.134658834162;145.594215996385;142.20515137822;165.250790781744;188.025305015816;174.875734297334;178.535924084953;182.196113872571;197.650248531405;197.107998192499;196.972435607772;193.44780840488;196.972435607772;230.998644374153;230.998644374153;257.026660641663;265.16041572526;60.4609127880705;57.478535924085;56.394035246272;249.977406235879;251.875282422052;260.009037505648];\r\ny = [356.149242377445;298.33521343792;53.36679594417;153.87816272061;369.497443166114;469.878773890057;714.171003910829;944.386831248959;830.085141105366;1039.08233557753;1470.37291088954;1505.27783828066;2164.26154151238;2113.32967065118;2710.06186465197;1055.41161286966;155.09074891013;765.66528069907;361.929344910872;1606.94977682562;1578.79697146034;2132.31168341422;2284.0019895516;2124.57128738942;2779.01348148774;4003.99860861424;3094.02581865822;3748.44200554603;4014.83711358974;2029.53768932436;2158.77402009707;2402.45508067111;1568.74193370111;813.671340379116;4077.64777784641;4665.39122971844;2062.33603266505;320.97774107871;716.310096974383;736.410419788883;1535.02358528902;1916.33155292304;2506.59770421349;3088.99342342664;3409.47052570325;2682.85182066728;3054.45584788382;5787.48858120914;2555.32546398489;339.784205170881;109.672406674747;3673.83707132802;3759.98595610633;6766.39998439567];\r\nA = x.^(0:6);\r\nalpha = 10000;\r\nc = [3.07150764626882e-05;0.0011811811626465;0.0297325806037763;0.00644572962571577;-7.30850526187996e-05;2.69506809802866e-07;-3.12356553672693e-10];\r\nc2 = ridgeRegression(A,alpha,y);\r\ndc = c - c2;\r\nassert(norm(dc) \u003c eps(norm(c))*1000);","published":true,"deleted":false,"likes_count":0,"comments_count":2,"created_by":9579,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":4,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2018-08-27T03:50:10.000Z","updated_at":"2018-09-20T12:02:32.000Z","published_at":"2018-08-27T03:55:52.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/image\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/media/image1.png\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/image\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/media/image2.png\"}],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eIn data fitting, regularization is a technique to stabilize an ill-posed problem.\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://en.wikipedia.org/wiki/Tikhonov_regularization\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eRidge Regression (aka Tikhonov regularizaton)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e adds the 2-norm of the coefficient vector to the least squares problem. The cost function looks like this:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eJ=1/2*norm(A*x-b,2)^2+norm(alpha*x,2)^2 (MATLAB equation if image doesn't display)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:customXml w:element=\\\"image\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"height\\\" w:val=\\\"-1\\\"/\u003e\u003cw:attr w:name=\\\"width\\\" w:val=\\\"-1\\\"/\u003e\u003cw:attr w:name=\\\"relationshipId\\\" w:val=\\\"rId1\\\"/\u003e\u003c/w:customXmlPr\u003e\u003c/w:customXml\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ewhere\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ex\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e is the coefficient vector,\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eb\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e corresponds to observations,\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eA\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e comes from evaluating terms of an equation, alpha corresponds to a chosen scalar weight value, and\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eJ\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e is the cost. The minimization of this cost function is ridge regression. When alpha is zero and the least squares problem is ill-conditioned, this problem is unstable meaning that small changes in\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eb\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e cause large changes in\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ex\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e. Choosing alpha appropriately for a given problem stabilizes the problem causing small changes in\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eb\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e causes a small change in\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ex\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis Cody problem is about solving the Ridge Regression problem. Implement the solution to the ridge regression problem. This is best done by solving a dual problem. Minimizes a different cost function yields the solution that solves the Ridge Regression problem:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eJ = 1/2*norm([A;alpha*eye(n)]*x-[b;zeros(1,n)],2)^2 (MATLAB equation if image doesn't display)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:customXml w:element=\\\"image\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"height\\\" w:val=\\\"-1\\\"/\u003e\u003cw:attr w:name=\\\"width\\\" w:val=\\\"-1\\\"/\u003e\u003cw:attr w:name=\\\"relationshipId\\\" w:val=\\\"rId2\\\"/\u003e\u003c/w:customXmlPr\u003e\u003c/w:customXml\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eTherefore, write a function that minimum of the dual problem for a given A, alpha, and b.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"},{\"partUri\":\"/media/image1.png\",\"contentType\":\"image/png\",\"content\":\"data:image/png;base64,iVBORw0KGgoAAAANSUhEU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lsaqpZ68hQomW/qkyhlr2aLDs79cqV+s+S/qexsb41CQ6lWvaryhRq2avDBAI+Vq2hoZKw7dvtqTV/jX27/+MtLy+TxWIwmVqkOTs7aJZeA45PrZN3715QbSktU42tmP0PtjfDeE6klHYAAAAASUVORK5CYII=\"},{\"partUri\":\"/media/image2.png\",\"contentType\":\"image/png\",\"content\":\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIgAAAAmCAIAAACQzkSbAAAKeklEQVR42u1aB1cUyRb2B+nA4AyijII8fSCIoiAmJCeHIEgakg4gKiAYcAF1QOISFBOYFsGAEh5rAAzooOgiIKIirLjJ3X2fU0u/prvpaaBn8J3DOffMqa6pDtVf3Xu/+3XN+/vvj0azL1/ew4x5x/9fm2eEe/zxx7v373tqaiqdnOyrqgrnXjqnvXjRXlJy7M6dH4wHTHf3/djYnfn52RLJ/O+/z5/DgG0tLfUaTfa5c2UuLmvd3Fx//31ontHu/euvgyYmCyoq5oDhsHXrVldVnURDq71narogMzPVqMDglpWVBYz+d+9ewNAYHn4Fdyb24cPLmd9xbGyAuuCbN89EnxGuSV3/8+c3/IMxI2rwx48/oWd09PXQ0HM4B9rW1opdu6LR+OWXNwrF4piYMOMBg1vqPIYJTGCgV2CgNxqxsRELF5paWMhhu3fHCA8CxcV5nH8hn5GryeVmrq5Oos/I2dkRVya3QBQinQMDT+/evYkl//btc/rguLhIMhJzTEz8OruMjCRfX4/792/Rh929e8PMzKShocaowOg85iSjX6n0gekePYI0pkQrNmxYp/elHzmSbiBg8vIOMjrPny93d98slUoAD+dZ/v6eZNmlpyf7+U0A5s8/P+BclSrMSMl/IjBMVrZ9uzdMB8xO0hBuoBJSqYmr6zr+YdnZ6XrHTAuYNXl5h9j9O3YEWlpaTHaWv78XiVrp6Sk6j2mk/srJyTx27NBffw1zAHPjRm1ISICPjztm4uGxRa2OFTuUnZwcmIgpAfPpU5+3t5uVlaWt7b/0AgPHEh2Y9es5PAZma2uzbdtGXmCIx6ToPKZxfJFpQ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8wDbZ9aUIoi44ORaqbyOAl1dXFerUyzJTw5tbWekwQ9a8xgMECX7LEnG4JCVFCtDKsIPjBxJ0x/fCYkpLjDGkV82d8DpiVfWWNjZdlMimlf5eVaRSKRYytE5xaGc4iERsLzspKoVKFGZuVTUkr02rvWVpa4JcctrVdB/VEcYrK4NKl0w8e/MMIsrL2Aq3JEoyR95XhveNeCBJ4bBubZTk5mUK0MoQygl939wPMpago95sCJgJseM+eBFhd3Tnyb0PDBTe3jSEhAaGhgZgJEn55eQEoaViY8suX9yBmul1w2zAGZWx8fOTETzX/IVfz8NhsoOTv6bmV3KKrq40quQoLc5RK3+Bgv+vXa6jBV66cISNXr7bj0cqionaAIs1CHcM2EAHU/DrHP4E3SKyoKG/mV759+yp1Qf5vz9OzlJR46votLfX8g/Pzj1KDyT7hY8cORkaG0jcMXbhQgXVGPurPPjBzRqypqQ7EjHzkHhzUzgHzTdjQ0HNEORQVqGb6+rpOnSqcA+abMJQvIGZy+VdDo7OzaQ6Yb8J+/rlvdPQ1Zej5L4MnGSvuavADAAAAAElFTkSuQmCC\"}]}"}],"problem_search":{"errors":[],"problems":[{"id":44734,"title":"Solve the 2-norm Regularization Problem","description":"In data fitting, regularization is a technique to stabilize an ill-posed problem. \u003chttps://en.wikipedia.org/wiki/Tikhonov_regularization Ridge Regression (aka Tikhonov regularizaton)\u003e adds the 2-norm of the coefficient vector to the least squares problem. The cost function looks like this:\r\n\r\nJ=1/2*norm(A*x-b,2)^2+norm(alpha*x,2)^2   (MATLAB equation if image doesn't display)\r\n\r\n\u003c\u003chttps://image.ibb.co/n0G5xp/Equation1.png\u003e\u003e\r\n\r\nwhere |x| is the coefficient vector, |b| corresponds to observations, |A| comes from evaluating terms of an equation, alpha corresponds to a chosen scalar weight value, and |J| is the cost. The minimization of this cost function is ridge regression. When alpha is zero and the least squares problem is ill-conditioned, this problem is unstable meaning that small changes in |b| cause large changes in |x|. Choosing alpha appropriately for a given problem stabilizes the problem causing small changes in |b| causes a small change in |x|.\r\n\r\nThis Cody problem is about solving the Ridge Regression problem. Implement the solution to the ridge regression problem. This is best done by solving a dual problem. Minimizes a different cost function yields the solution that solves the Ridge Regression problem:\r\n\r\nJ = 1/2*norm([A;alpha*eye(n)]*x-[b;zeros(1,n)],2)^2  (MATLAB equation if image doesn't display)\r\n\r\n\u003c\u003chttps://image.ibb.co/hkAZOU/equation2.png\u003e\u003e\r\n\r\nTherefore, write a function that minimum of the dual problem for a given A, alpha, and b.","description_html":"\u003cp\u003eIn data fitting, regularization is a technique to stabilize an ill-posed problem. \u003ca href = \"https://en.wikipedia.org/wiki/Tikhonov_regularization\"\u003eRidge Regression (aka Tikhonov regularizaton)\u003c/a\u003e adds the 2-norm of the coefficient vector to the least squares problem. The cost function looks like this:\u003c/p\u003e\u003cp\u003eJ=1/2*norm(A*x-b,2)^2+norm(alpha*x,2)^2   (MATLAB equation if image doesn't display)\u003c/p\u003e\u003cimg src = \"https://image.ibb.co/n0G5xp/Equation1.png\"\u003e\u003cp\u003ewhere \u003ctt\u003ex\u003c/tt\u003e is the coefficient vector, \u003ctt\u003eb\u003c/tt\u003e corresponds to observations, \u003ctt\u003eA\u003c/tt\u003e comes from evaluating terms of an equation, alpha corresponds to a chosen scalar weight value, and \u003ctt\u003eJ\u003c/tt\u003e is the cost. The minimization of this cost function is ridge regression. When alpha is zero and the least squares problem is ill-conditioned, this problem is unstable meaning that small changes in \u003ctt\u003eb\u003c/tt\u003e cause large changes in \u003ctt\u003ex\u003c/tt\u003e. Choosing alpha appropriately for a given problem stabilizes the problem causing small changes in \u003ctt\u003eb\u003c/tt\u003e causes a small change in \u003ctt\u003ex\u003c/tt\u003e.\u003c/p\u003e\u003cp\u003eThis Cody problem is about solving the Ridge Regression problem. Implement the solution to the ridge regression problem. This is best done by solving a dual problem. Minimizes a different cost function yields the solution that solves the Ridge Regression problem:\u003c/p\u003e\u003cp\u003eJ = 1/2*norm([A;alpha*eye(n)]*x-[b;zeros(1,n)],2)^2  (MATLAB equation if image doesn't display)\u003c/p\u003e\u003cimg src = \"https://image.ibb.co/hkAZOU/equation2.png\"\u003e\u003cp\u003eTherefore, write a function that minimum of the dual problem for a given A, alpha, and b.\u003c/p\u003e","function_template":"function x = ridgeRegression(A,alpha,b)\r\n  x = A\\b;\r\nend","test_suite":"clc; clear; close all;\r\n%% Test 1\r\nx = [36.8730230456394;39.5842747401717;43.380027112517;45.5490284681428;47.7180298237686;51.2426570266606;54.4961590600994;54.4961590600994;46.0912788070492;42.295526434704;46.0912788070493;57.2074107546317;87.3023045639404;93.2670582919114;97.3339358337099;97.0628106642567;107.907817442386;117.668323542702;126.615454134659;122.277451423407;115.77044735653;120.379575237235;114.008133755084;126.073203795752;128.513330320831;108.043380027112;144.509715318572;147.220967013104;145.051965657479;141.79846362404;144.509715318572;154.134658834162;145.594215996385;142.20515137822;165.250790781744;188.025305015816;174.875734297334;178.535924084953;182.196113872571;197.650248531405;197.107998192499;196.972435607772;193.44780840488;196.972435607772;230.998644374153;230.998644374153;257.026660641663;265.16041572526;60.4609127880705;57.478535924085;56.394035246272;249.977406235879;251.875282422052;260.009037505648];\r\ny = [356.149242377445;298.33521343792;53.36679594417;153.87816272061;369.497443166114;469.878773890057;714.171003910829;944.386831248959;830.085141105366;1039.08233557753;1470.37291088954;1505.27783828066;2164.26154151238;2113.32967065118;2710.06186465197;1055.41161286966;155.09074891013;765.66528069907;361.929344910872;1606.94977682562;1578.79697146034;2132.31168341422;2284.0019895516;2124.57128738942;2779.01348148774;4003.99860861424;3094.02581865822;3748.44200554603;4014.83711358974;2029.53768932436;2158.77402009707;2402.45508067111;1568.74193370111;813.671340379116;4077.64777784641;4665.39122971844;2062.33603266505;320.97774107871;716.310096974383;736.410419788883;1535.02358528902;1916.33155292304;2506.59770421349;3088.99342342664;3409.47052570325;2682.85182066728;3054.45584788382;5787.48858120914;2555.32546398489;339.784205170881;109.672406674747;3673.83707132802;3759.98595610633;6766.39998439567];\r\nA = [x.^0 x];\r\nalpha = 0;\r\nc = [50.5072813195826;14.809837633449];\r\nc2 = ridgeRegression(A,alpha,y);\r\ndc = c - c2;\r\nassert(norm(dc) \u003c eps(norm(c))*1000);\r\n%% Test 2\r\nx = [36.8730230456394;39.5842747401717;43.380027112517;45.5490284681428;47.7180298237686;51.2426570266606;54.4961590600994;54.4961590600994;46.0912788070492;42.295526434704;46.0912788070493;57.2074107546317;87.3023045639404;93.2670582919114;97.3339358337099;97.0628106642567;107.907817442386;117.668323542702;126.615454134659;122.277451423407;115.77044735653;120.379575237235;114.008133755084;126.073203795752;128.513330320831;108.043380027112;144.509715318572;147.220967013104;145.051965657479;141.79846362404;144.509715318572;154.134658834162;145.594215996385;142.20515137822;165.250790781744;188.025305015816;174.875734297334;178.535924084953;182.196113872571;197.650248531405;197.107998192499;196.972435607772;193.44780840488;196.972435607772;230.998644374153;230.998644374153;257.026660641663;265.16041572526;60.4609127880705;57.478535924085;56.394035246272;249.977406235879;251.875282422052;260.009037505648];\r\ny = [356.149242377445;298.33521343792;53.36679594417;153.87816272061;369.497443166114;469.878773890057;714.171003910829;944.386831248959;830.085141105366;1039.08233557753;1470.37291088954;1505.27783828066;2164.26154151238;2113.32967065118;2710.06186465197;1055.41161286966;155.09074891013;765.66528069907;361.929344910872;1606.94977682562;1578.79697146034;2132.31168341422;2284.0019895516;2124.57128738942;2779.01348148774;4003.99860861424;3094.02581865822;3748.44200554603;4014.83711358974;2029.53768932436;2158.77402009707;2402.45508067111;1568.74193370111;813.671340379116;4077.64777784641;4665.39122971844;2062.33603266505;320.97774107871;716.310096974383;736.410419788883;1535.02358528902;1916.33155292304;2506.59770421349;3088.99342342664;3409.47052570325;2682.85182066728;3054.45584788382;5787.48858120914;2555.32546398489;339.784205170881;109.672406674747;3673.83707132802;3759.98595610633;6766.39998439567];\r\nA = [x.^0 x];\r\nalpha = 1;\r\nc = [46.3633165923753;14.8348826094771];\r\nc2 = ridgeRegression(A,alpha,y);\r\ndc = c - c2;\r\nassert(norm(dc) \u003c eps(norm(c))*1000);\r\n%% Test 3\r\nx = [36.8730230456394;39.5842747401717;43.380027112517;45.5490284681428;47.7180298237686;51.2426570266606;54.4961590600994;54.4961590600994;46.0912788070492;42.295526434704;46.0912788070493;57.2074107546317;87.3023045639404;93.2670582919114;97.3339358337099;97.0628106642567;107.907817442386;117.668323542702;126.615454134659;122.277451423407;115.77044735653;120.379575237235;114.008133755084;126.073203795752;128.513330320831;108.043380027112;144.509715318572;147.220967013104;145.051965657479;141.79846362404;144.509715318572;154.134658834162;145.594215996385;142.20515137822;165.250790781744;188.025305015816;174.875734297334;178.535924084953;182.196113872571;197.650248531405;197.107998192499;196.972435607772;193.44780840488;196.972435607772;230.998644374153;230.998644374153;257.026660641663;265.16041572526;60.4609127880705;57.478535924085;56.394035246272;249.977406235879;251.875282422052;260.009037505648];\r\ny = [356.149242377445;298.33521343792;53.36679594417;153.87816272061;369.497443166114;469.878773890057;714.171003910829;944.386831248959;830.085141105366;1039.08233557753;1470.37291088954;1505.27783828066;2164.26154151238;2113.32967065118;2710.06186465197;1055.41161286966;155.09074891013;765.66528069907;361.929344910872;1606.94977682562;1578.79697146034;2132.31168341422;2284.0019895516;2124.57128738942;2779.01348148774;4003.99860861424;3094.02581865822;3748.44200554603;4014.83711358974;2029.53768932436;2158.77402009707;2402.45508067111;1568.74193370111;813.671340379116;4077.64777784641;4665.39122971844;2062.33603266505;320.97774107871;716.310096974383;736.410419788883;1535.02358528902;1916.33155292304;2506.59770421349;3088.99342342664;3409.47052570325;2682.85182066728;3054.45584788382;5787.48858120914;2555.32546398489;339.784205170881;109.672406674747;3673.83707132802;3759.98595610633;6766.39998439567];\r\nA = [x.^0 x];\r\nalpha = 10;\r\nc = [5.15542113869052;15.0827828176993];\r\nc2 = ridgeRegression(A,alpha,y);\r\ndc = c - c2;\r\nassert(norm(dc) \u003c eps(norm(c))*1000);\r\n%% Test 4\r\nx = [36.8730230456394;39.5842747401717;43.380027112517;45.5490284681428;47.7180298237686;51.2426570266606;54.4961590600994;54.4961590600994;46.0912788070492;42.295526434704;46.0912788070493;57.2074107546317;87.3023045639404;93.2670582919114;97.3339358337099;97.0628106642567;107.907817442386;117.668323542702;126.615454134659;122.277451423407;115.77044735653;120.379575237235;114.008133755084;126.073203795752;128.513330320831;108.043380027112;144.509715318572;147.220967013104;145.051965657479;141.79846362404;144.509715318572;154.134658834162;145.594215996385;142.20515137822;165.250790781744;188.025305015816;174.875734297334;178.535924084953;182.196113872571;197.650248531405;197.107998192499;196.972435607772;193.44780840488;196.972435607772;230.998644374153;230.998644374153;257.026660641663;265.16041572526;60.4609127880705;57.478535924085;56.394035246272;249.977406235879;251.875282422052;260.009037505648];\r\ny = [356.149242377445;298.33521343792;53.36679594417;153.87816272061;369.497443166114;469.878773890057;714.171003910829;944.386831248959;830.085141105366;1039.08233557753;1470.37291088954;1505.27783828066;2164.26154151238;2113.32967065118;2710.06186465197;1055.41161286966;155.09074891013;765.66528069907;361.929344910872;1606.94977682562;1578.79697146034;2132.31168341422;2284.0019895516;2124.57128738942;2779.01348148774;4003.99860861424;3094.02581865822;3748.44200554603;4014.83711358974;2029.53768932436;2158.77402009707;2402.45508067111;1568.74193370111;813.671340379116;4077.64777784641;4665.39122971844;2062.33603266505;320.97774107871;716.310096974383;736.410419788883;1535.02358528902;1916.33155292304;2506.59770421349;3088.99342342664;3409.47052570325;2682.85182066728;3054.45584788382;5787.48858120914;2555.32546398489;339.784205170881;109.672406674747;3673.83707132802;3759.98595610633;6766.39998439567];\r\nA = [x.^0 x];\r\nalpha = 100;\r\nc = [0.146854633219172;14.986428814777];\r\nc2 = ridgeRegression(A,alpha,y);\r\ndc = c - c2;\r\nassert(norm(dc) \u003c eps(norm(c))*1000);\r\n%% Test 5\r\n% This one is rank deficient without regularization.\r\nx = [36.8730230456394;39.5842747401717;43.380027112517;45.5490284681428;47.7180298237686;51.2426570266606;54.4961590600994;54.4961590600994;46.0912788070492;42.295526434704;46.0912788070493;57.2074107546317;87.3023045639404;93.2670582919114;97.3339358337099;97.0628106642567;107.907817442386;117.668323542702;126.615454134659;122.277451423407;115.77044735653;120.379575237235;114.008133755084;126.073203795752;128.513330320831;108.043380027112;144.509715318572;147.220967013104;145.051965657479;141.79846362404;144.509715318572;154.134658834162;145.594215996385;142.20515137822;165.250790781744;188.025305015816;174.875734297334;178.535924084953;182.196113872571;197.650248531405;197.107998192499;196.972435607772;193.44780840488;196.972435607772;230.998644374153;230.998644374153;257.026660641663;265.16041572526;60.4609127880705;57.478535924085;56.394035246272;249.977406235879;251.875282422052;260.009037505648];\r\ny = [356.149242377445;298.33521343792;53.36679594417;153.87816272061;369.497443166114;469.878773890057;714.171003910829;944.386831248959;830.085141105366;1039.08233557753;1470.37291088954;1505.27783828066;2164.26154151238;2113.32967065118;2710.06186465197;1055.41161286966;155.09074891013;765.66528069907;361.929344910872;1606.94977682562;1578.79697146034;2132.31168341422;2284.0019895516;2124.57128738942;2779.01348148774;4003.99860861424;3094.02581865822;3748.44200554603;4014.83711358974;2029.53768932436;2158.77402009707;2402.45508067111;1568.74193370111;813.671340379116;4077.64777784641;4665.39122971844;2062.33603266505;320.97774107871;716.310096974383;736.410419788883;1535.02358528902;1916.33155292304;2506.59770421349;3088.99342342664;3409.47052570325;2682.85182066728;3054.45584788382;5787.48858120914;2555.32546398489;339.784205170881;109.672406674747;3673.83707132802;3759.98595610633;6766.39998439567];\r\nA = x.^(0:6);\r\nc = A\\y;\r\nalpha = 0;\r\nc2 = ridgeRegression(A,alpha,y);\r\ndc = c - c2;\r\nassert(norm(dc) \u003c eps(norm(c))*1000);\r\n%% Test 6\r\nx = [36.8730230456394;39.5842747401717;43.380027112517;45.5490284681428;47.7180298237686;51.2426570266606;54.4961590600994;54.4961590600994;46.0912788070492;42.295526434704;46.0912788070493;57.2074107546317;87.3023045639404;93.2670582919114;97.3339358337099;97.0628106642567;107.907817442386;117.668323542702;126.615454134659;122.277451423407;115.77044735653;120.379575237235;114.008133755084;126.073203795752;128.513330320831;108.043380027112;144.509715318572;147.220967013104;145.051965657479;141.79846362404;144.509715318572;154.134658834162;145.594215996385;142.20515137822;165.250790781744;188.025305015816;174.875734297334;178.535924084953;182.196113872571;197.650248531405;197.107998192499;196.972435607772;193.44780840488;196.972435607772;230.998644374153;230.998644374153;257.026660641663;265.16041572526;60.4609127880705;57.478535924085;56.394035246272;249.977406235879;251.875282422052;260.009037505648];\r\ny = [356.149242377445;298.33521343792;53.36679594417;153.87816272061;369.497443166114;469.878773890057;714.171003910829;944.386831248959;830.085141105366;1039.08233557753;1470.37291088954;1505.27783828066;2164.26154151238;2113.32967065118;2710.06186465197;1055.41161286966;155.09074891013;765.66528069907;361.929344910872;1606.94977682562;1578.79697146034;2132.31168341422;2284.0019895516;2124.57128738942;2779.01348148774;4003.99860861424;3094.02581865822;3748.44200554603;4014.83711358974;2029.53768932436;2158.77402009707;2402.45508067111;1568.74193370111;813.671340379116;4077.64777784641;4665.39122971844;2062.33603266505;320.97774107871;716.310096974383;736.410419788883;1535.02358528902;1916.33155292304;2506.59770421349;3088.99342342664;3409.47052570325;2682.85182066728;3054.45584788382;5787.48858120914;2555.32546398489;339.784205170881;109.672406674747;3673.83707132802;3759.98595610633;6766.39998439567];\r\nA = x.^(0:6);\r\nalpha = 10;\r\nc = [-1.48348345971319;-21.370159200147;1.50455732468686;-0.0214851248485215;0.000148821639521563;-5.20003346155603e-07;7.26127822714741e-10];\r\nc2 = ridgeRegression(A,alpha,y);\r\ndc = c - c2;\r\nassert(norm(dc) \u003c eps(norm(c))*1000);\r\n%% Test 7\r\nx = [36.8730230456394;39.5842747401717;43.380027112517;45.5490284681428;47.7180298237686;51.2426570266606;54.4961590600994;54.4961590600994;46.0912788070492;42.295526434704;46.0912788070493;57.2074107546317;87.3023045639404;93.2670582919114;97.3339358337099;97.0628106642567;107.907817442386;117.668323542702;126.615454134659;122.277451423407;115.77044735653;120.379575237235;114.008133755084;126.073203795752;128.513330320831;108.043380027112;144.509715318572;147.220967013104;145.051965657479;141.79846362404;144.509715318572;154.134658834162;145.594215996385;142.20515137822;165.250790781744;188.025305015816;174.875734297334;178.535924084953;182.196113872571;197.650248531405;197.107998192499;196.972435607772;193.44780840488;196.972435607772;230.998644374153;230.998644374153;257.026660641663;265.16041572526;60.4609127880705;57.478535924085;56.394035246272;249.977406235879;251.875282422052;260.009037505648];\r\ny = [356.149242377445;298.33521343792;53.36679594417;153.87816272061;369.497443166114;469.878773890057;714.171003910829;944.386831248959;830.085141105366;1039.08233557753;1470.37291088954;1505.27783828066;2164.26154151238;2113.32967065118;2710.06186465197;1055.41161286966;155.09074891013;765.66528069907;361.929344910872;1606.94977682562;1578.79697146034;2132.31168341422;2284.0019895516;2124.57128738942;2779.01348148774;4003.99860861424;3094.02581865822;3748.44200554603;4014.83711358974;2029.53768932436;2158.77402009707;2402.45508067111;1568.74193370111;813.671340379116;4077.64777784641;4665.39122971844;2062.33603266505;320.97774107871;716.310096974383;736.410419788883;1535.02358528902;1916.33155292304;2506.59770421349;3088.99342342664;3409.47052570325;2682.85182066728;3054.45584788382;5787.48858120914;2555.32546398489;339.784205170881;109.672406674747;3673.83707132802;3759.98595610633;6766.39998439567];\r\nA = x.^(0:6);\r\nalpha = 10000;\r\nc = [3.07150764626882e-05;0.0011811811626465;0.0297325806037763;0.00644572962571577;-7.30850526187996e-05;2.69506809802866e-07;-3.12356553672693e-10];\r\nc2 = ridgeRegression(A,alpha,y);\r\ndc = c - c2;\r\nassert(norm(dc) \u003c eps(norm(c))*1000);","published":true,"deleted":false,"likes_count":0,"comments_count":2,"created_by":9579,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":4,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2018-08-27T03:50:10.000Z","updated_at":"2018-09-20T12:02:32.000Z","published_at":"2018-08-27T03:55:52.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/image\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/media/image1.png\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/image\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/media/image2.png\"}],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eIn data fitting, regularization is a technique to stabilize an ill-posed problem.\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://en.wikipedia.org/wiki/Tikhonov_regularization\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eRidge Regression (aka Tikhonov regularizaton)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e adds the 2-norm of the coefficient vector to the least squares problem. The cost function looks like this:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eJ=1/2*norm(A*x-b,2)^2+norm(alpha*x,2)^2 (MATLAB equation if image doesn't display)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:customXml w:element=\\\"image\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"height\\\" w:val=\\\"-1\\\"/\u003e\u003cw:attr w:name=\\\"width\\\" w:val=\\\"-1\\\"/\u003e\u003cw:attr w:name=\\\"relationshipId\\\" w:val=\\\"rId1\\\"/\u003e\u003c/w:customXmlPr\u003e\u003c/w:customXml\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ewhere\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ex\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e is the coefficient vector,\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eb\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e corresponds to observations,\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eA\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e comes from evaluating terms of an equation, alpha corresponds to a chosen scalar weight value, and\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eJ\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e is the cost. The minimization of this cost function is ridge regression. When alpha is zero and the least squares problem is ill-conditioned, this problem is unstable meaning that small changes in\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eb\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e cause large changes in\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ex\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e. Choosing alpha appropriately for a given problem stabilizes the problem causing small changes in\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eb\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e causes a small change in\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ex\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis Cody problem is about solving the Ridge Regression problem. Implement the solution to the ridge regression problem. This is best done by solving a dual problem. Minimizes a different cost function yields the solution that solves the Ridge Regression problem:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eJ = 1/2*norm([A;alpha*eye(n)]*x-[b;zeros(1,n)],2)^2 (MATLAB equation if image doesn't display)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:customXml w:element=\\\"image\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"height\\\" w:val=\\\"-1\\\"/\u003e\u003cw:attr w:name=\\\"width\\\" w:val=\\\"-1\\\"/\u003e\u003cw:attr w:name=\\\"relationshipId\\\" w:val=\\\"rId2\\\"/\u003e\u003c/w:customXmlPr\u003e\u003c/w:customXml\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eTherefore, write a function that minimum of the dual problem for a given A, alpha, and b.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"},{\"partUri\":\"/media/image1.png\",\"contentType\":\"image/png\",\"content\":\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAALQAAAAgCAIAAAA0WMUwAAAJ1ElEQVR42u1bh1cT2Rfe/2eVkNBESkSKkSoIiyydhF4UBGkCSokCBkRBXFylKNIEEUQBgXVREF1RBFEpolGkCYpl3eKe3d/3y+gwmRSSQBAx59zjeVOYefPed7/73Xvjd//9N79i9u+/r//+++VKvlFjS7HvVgYTr149vXq1ydPT7cCBZM2ia8CxYG/ePI+Lizx+PNfQUC89fa9m0TXgkGJGRgYZGRpwaMAhzYyNN2RkpKztBf34cfbw4YPh4YHOzva1tae/oplDDubk8DFzJye7xsbKLwKONa45CgoEU1PDGHR1terqap8/X/61zDw/P3tmZhSDjo5GFotx6VL1CoPDkM9f4+BA6PTxcSPGlpab/P29v5aZGxjokrM1MzMJDfVfaXBkZCRJJbSYmIjOzksnT+Yrkvs0NFR8wUW8e7czP/8QhSoO/fZbB3l4+nQRPO/zcuvgu5R9fkJC1OTkSGzsrmWfeU9PW2FhLnmI8HfvXhd5WFJS+Ouvl4gxOC8xMYYODlxG1PH393Fzc/bxcd+7N2Z5wwqfLwUcf/wxtWWLOZZ19+7wRR/S1nZBR0f7zZtn6tv+33+fyMzcHxYWkJy8R/JqU1N1cLAfeQgPq6s7I3lbdXWpiYnh5OSQsm+3teUMD9/eutVy2b/r3LkybC55iF1ubq6TvO3MmSI222h6elQ6c2RlpWlrry8qylMDcyRLBQeHA3D8FB0dvihtWFiw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KUvr7OoUNpkuVzJGPR0WGrv7UtSmW51MYbFQFKtezhjTKKYL3qKZ/TmENMc3yZlj1c2dPTlUQxnBIJ5+zsE4nyedGijbfVYKKuLJfKHFTNsfSWPRAzMtKrjq5sTc3p8PAgcXDUKdGyV4chYCG56uu7ThxmZu5DtgwyVK1lvzrA8Q237Jf9Z5UIW+Qh1JyJyUZqcUbxlv3qCCvfdstefQZhZWioX1paSCvLCoX337+fmJ0dW/3gQHwkWpekoqLpPsVb9jKKSYNwJ/yrhh8xTRKSk6zBwy2VbtmryTCVHTucsrPT1vbPSBVv2a82W7xlrz5kIDlsaqpZ68hQomW/qkyhlr2aLDs79cqV+s+S/qexsb41CQ6lWvaryhRq2avDBAI+Vq2hoZKw7dvtqTV/jX27/+MtLy+TxWIwmVqkOTs7aJZeA45PrZN3715QbSktU42tmP0PtjfDeE6klHYAAAAASUVORK5CYII=\"},{\"partUri\":\"/media/image2.png\",\"contentType\":\"image/png\",\"content\":\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIgAAAAmCAIAAACQzkSbAAAKeklEQVR42u1aB1cUyRb2B+nA4AyijII8fSCIoiAmJCeHIEgakg4gKiAYcAF1QOISFBOYFsGAEh5rAAzooOgiIKIirLjJ3X2fU0u/prvpaaBn8J3DOffMqa6pDtVf3Xu/+3XN+/vvj0azL1/ew4x5x/9fm2eEe/zxx7v373tqaiqdnOyrqgrnXjqnvXjRXlJy7M6dH4wHTHf3/djYnfn52RLJ/O+/z5/DgG0tLfUaTfa5c2UuLmvd3Fx//31ontHu/euvgyYmCyoq5oDhsHXrVldVnURDq71narogMzPVqMDglpWVBYz+d+9ewNAYHn4Fdyb24cPLmd9xbGyAuuCbN89EnxGuSV3/8+c3/IMxI2rwx48/oWd09PXQ0HM4B9rW1opdu6LR+OWXNwrF4piYMOMBg1vqPIYJTGCgV2CgNxqxsRELF5paWMhhu3fHCA8CxcV5nH8hn5GryeVmrq5Oos/I2dkRVya3QBQinQMDT+/evYkl//btc/rgu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4ezJkzbkRtTVwrWy5uY6a2tLqlIrLT2+aJFsdLT39Oli+h6Mzs5mnWARolcrE9djWMAo2B7DBmY6WpnhrKvrR9DTgYFnLIliUq1sZKRXoViMgp/qQaLSCROlQUE+RLQfTzAH0H/2bJlerUzc5M/QymxslqKT3oPkT6mC/FoZiHVv72Oys8l4wKDkTkqKo1AhHx/1amUaTTb84OrVanonelByHTq0n5FgECEHB7uFa2ViAMPUyhwdbdHJAIYhPHJqZSiw4EBgaw4O/05NTTQSMJ8/v1EqfcAOiZgGNrJpk7MQrQyHMpkZnTjA4BlYlRQlHU8wlshDPF8wDbZ9aUIoi44ORaqbyOAl1dXFerUyzJTw5tbWekwQ9a8xgMECX7LEnG4JCVFCtDKsIPjBxJ0x/fCYkpLjDGkV82d8DpiVfWWNjZdlMimlf5eVaRSKRYytE5xaGc4iERsLzspKoVKFGZuVTUkr02rvWVpa4JcctrVdB/VEcYrK4NKl0w8e/MMIsrL2Aq3JEoyR95XhveNeCBJ4bBubZTk5mUK0MoQygl939wPMpago95sCJgJseM+eBFhd3Tnyb0PDBTe3jSEhAaGhgZgJEn55eQEoaViY8suX9yBmul1w2zAGZWx8fOTETzX/IVfz8NhsoOTv6bmV3KKrq40quQoLc5RK3+Bgv+vXa6jBV66cISNXr7bj0cqionaAIs1CHcM2EAHU/DrHP4E3SKyoKG/mV759+yp1Qf5vz9OzlJR46votLfX8g/Pzj1KDyT7hY8cORkaG0jcMXbhQgXVGPurPPjBzRqypqQ7EjHzkHhzUzgHzTdjQ0HNEORQVqGb6+rpOnSqcA+abMJQvIGZy+VdDo7OzaQ6Yb8J+/rlvdPQ1Zej5L4MnGSvuavADAAAAAElFTkSuQmCC\"}]}"}],"term":"tag:\"ridge regression\"","current_player_id":null,"fields":[{"name":"page","type":"integer","callback":null,"default":1,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":null,"prepend":true},{"name":"per_page","type":"integer","callback":null,"default":50,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":null,"prepend":true},{"name":"sort","type":"string","callback":null,"default":null,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":null,"prepend":true},{"name":"body","type":"text","callback":null,"default":"*:*","directive":null,"facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":false},{"name":"group","type":"string","callback":null,"default":null,"directive":"group","facet":true,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"difficulty_rating_bin","type":"string","callback":null,"default":null,"directive":"difficulty_rating_bin","facet":true,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"id","type":"integer","callback":null,"default":null,"directive":"id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"tag","type":"string","callback":null,"default":null,"directive":"tag","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"product","type":"string","callback":null,"default":null,"directive":"product","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"created_at","type":"timeframe","callback":{},"default":null,"directive":"created_at","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"profile_id","type":"integer","callback":null,"default":null,"directive":"author_id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"created_by","type":"string","callback":null,"default":null,"directive":"author","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"player_id","type":"integer","callback":null,"default":null,"directive":"solver_id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"player","type":"string","callback":null,"default":null,"directive":"solver","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"solvers_count","type":"integer","callback":null,"default":null,"directive":"solvers_count","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"comments_count","type":"integer","callback":null,"default":null,"directive":"comments_count","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"likes_count","type":"integer","callback":null,"default":null,"directive":"likes_count","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"leader_id","type":"integer","callback":null,"default":null,"directive":"leader_id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"leading_solution","type":"integer","callback":null,"default":null,"directive":"leading_solution","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true}],"filters":[{"name":"asset_type","type":"string","callback":null,"default":null,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":"\"cody:problem\"","prepend":true},{"name":"profile_id","type":"integer","callback":{},"default":null,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":"author_id","static":null,"prepend":true}],"query":{"params":{"per_page":50,"term":"tag:\"ridge regression\"","current_player":null,"sort":"map(difficulty_value,0,0,999) asc"},"parser":"MathWorks::Search::Solr::QueryParser","directives":{"term":{"directives":{"tag":[["tag:\"ridge regression\"","","\"","ridge regression","\""]]}}},"facets":{"#\u003cMathWorks::Search::Field:0x00007faf1529bf50\u003e":null,"#\u003cMathWorks::Search::Field:0x00007faf1529beb0\u003e":null},"filters":{"#\u003cMathWorks::Search::Field:0x00007faf1529b5f0\u003e":"\"cody:problem\""},"fields":{"#\u003cMathWorks::Search::Field:0x00007faf1529c1d0\u003e":1,"#\u003cMathWorks::Search::Field:0x00007faf1529c130\u003e":50,"#\u003cMathWorks::Search::Field:0x00007faf1529c090\u003e":"map(difficulty_value,0,0,999) asc","#\u003cMathWorks::Search::Field:0x00007faf1529bff0\u003e":"tag:\"ridge regression\""},"user_query":{"#\u003cMathWorks::Search::Field:0x00007faf1529bff0\u003e":"tag:\"ridge regression\""},"queried_facets":{}},"query_backend":{"connection":{"configuration":{"index_url":"http://index-op-v2/solr/","query_url":"http://search-op-v2/solr/","direct_access_index_urls":["http://index-op-v2/solr/"],"direct_access_query_urls":["http://search-op-v2/solr/"],"timeout":10,"vhost":"search","exchange":"search.topic","heartbeat":30,"pre_index_mode":false,"host":"rabbitmq-eks","port":5672,"username":"cody-search","password":"78X075ddcV44","virtual_host":"search","indexer":"amqp","http_logging":"true","core":"cody"},"query_connection":{"uri":"http://search-op-v2/solr/cody/","proxy":null,"connection":{"parallel_manager":null,"headers":{"User-Agent":"Faraday v1.0.1"},"params":{},"options":{"params_encoder":"Faraday::FlatParamsEncoder","proxy":null,"bind":null,"timeout":null,"open_timeout":null,"read_timeout":null,"write_timeout":null,"boundary":null,"oauth":null,"context":null,"on_data":null},"ssl":{"verify":true,"ca_file":null,"ca_path":null,"verify_mode":null,"cert_store":null,"client_cert":null,"client_key":null,"certificate":null,"private_key":null,"verify_depth":null,"version":null,"min_version":null,"max_version":null},"default_parallel_manager":null,"builder":{"adapter":{"name":"Faraday::Adapter::NetHttp","args":[],"block":null},"handlers":[{"name":"Faraday::Response::RaiseError","args":[],"block":null}],"app":{"app":{"ssl_cert_store":{"verify_callback":null,"error":null,"error_string":null,"chain":null,"time":null},"app":{},"connection_options":{},"config_block":null}}},"url_prefix":"http://search-op-v2/solr/cody/","manual_proxy":false,"proxy":null},"update_format":"RSolr::JSON::Generator","update_path":"update","options":{"url":"http://search-op-v2/solr/cody"}}},"query":{"params":{"per_page":50,"term":"tag:\"ridge regression\"","current_player":null,"sort":"map(difficulty_value,0,0,999) asc"},"parser":"MathWorks::Search::Solr::QueryParser","directives":{"term":{"directives":{"tag":[["tag:\"ridge regression\"","","\"","ridge regression","\""]]}}},"facets":{"#\u003cMathWorks::Search::Field:0x00007faf1529bf50\u003e":null,"#\u003cMathWorks::Search::Field:0x00007faf1529beb0\u003e":null},"filters":{"#\u003cMathWorks::Search::Field:0x00007faf1529b5f0\u003e":"\"cody:problem\""},"fields":{"#\u003cMathWorks::Search::Field:0x00007faf1529c1d0\u003e":1,"#\u003cMathWorks::Search::Field:0x00007faf1529c130\u003e":50,"#\u003cMathWorks::Search::Field:0x00007faf1529c090\u003e":"map(difficulty_value,0,0,999) asc","#\u003cMathWorks::Search::Field:0x00007faf1529bff0\u003e":"tag:\"ridge regression\""},"user_query":{"#\u003cMathWorks::Search::Field:0x00007faf1529bff0\u003e":"tag:\"ridge regression\""},"queried_facets":{}},"options":{"fields":["id","difficulty_rating"]},"join":" "},"results":[{"id":44734,"difficulty_rating":"unrated"}]}}