Cody

Solution 1617233

Submitted on 27 Aug 2018 by Jason Nicholson
  • Size: 36
  • This is the leading solution.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Pass
x = [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]; y = [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]; A = [x.^0 x]; alpha = 0; c = [50.5072813195826;14.809837633449]; c2 = ridgeRegression(A,alpha,y); dc = c - c2; assert(norm(dc) < eps(norm(c))*1000);

2   Pass
x = [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]; y = [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]; A = [x.^0 x]; alpha = 1; c = [46.3633165923753;14.8348826094771]; c2 = ridgeRegression(A,alpha,y); dc = c - c2; assert(norm(dc) < eps(norm(c))*1000);

3   Pass
x = [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]; y = [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]; A = [x.^0 x]; alpha = 10; c = [5.15542113869052;15.0827828176993]; c2 = ridgeRegression(A,alpha,y); dc = c - c2; assert(norm(dc) < eps(norm(c))*1000);

4   Pass
x = [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]; y = [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]; A = [x.^0 x]; alpha = 100; c = [0.146854633219172;14.986428814777]; c2 = ridgeRegression(A,alpha,y); dc = c - c2; assert(norm(dc) < eps(norm(c))*1000);

5   Pass
% This one is rank deficient without regularization. x = [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]; y = [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]; A = x.^(0:6); c = A\y; alpha = 0; c2 = ridgeRegression(A,alpha,y); dc = c - c2; assert(norm(dc) < eps(norm(c))*1000);

[Warning: Rank deficient, rank = 6, tol = 8.421537e+00.] [> In ScoringEngineTestPoint5 (line 5) In solutionTest (line 13) In matlab.unittest.internal.executeCodeBlock (line 11) In matlab.unittest.internal.ScriptTestCaseProvider/evaluateTestSection (line 134) In matlab.unittest.internal.ScriptTestCaseProvider/runTestSection (line 128) In matlab.unittest.internal.ScriptTestCaseProvider>@(testCase)provider.runTestSection(testCase) (line 94) In matlab.unittest.FunctionTestCase/test (line 98) In matlab.unittest.TestRunner/evaluateMethodCore (line 841) In matlab.unittest.TestRunner/evaluateMethod (line 1141) In matlab.unittest.TestRunner/invokeTestContentOperatorMethod_ (line 889) In matlab.unittest.plugins.TestRunnerPlugin/evaluateMethod (line 679) In scoringengine.OutputPlugin/evaluateMethod In matlab.unittest.plugins.TestRunnerPlugin/invokeTestContentOperatorMethod_ (line 710) In matlab.unittest.plugins.TestRunnerPlugin/evaluateMethod (line 679) In scoringengine.FiguresPlugin/evaluateMethod In matlab.unittest.plugins.TestRunnerPlugin/invokeTestContentOperatorMethod_ (line 710) In matlab.unittest.TestRunner/evaluateMethodOnPlugins (line 745) In matlab.unittest.TestRunner/evaluateMethodsOnTestContent (line 783) In matlab.unittest.TestRunner/runTestMethod (line 1137) In matlab.unittest.TestRunner/invokeTestContentOperatorMethod_ (line 889) In matlab.unittest.plugins.TestRunnerPlugin/runTestMethod (line 633) In scoringengine.OutputPlugin/runTestMethod In matlab.unittest.plugins.TestRunnerPlugin/invokeTestContentOperatorMethod_ (line 710) In matlab.unittest.plugins.TestRunnerPlugin/runTestMethod (line 633) In scoringengine.FiguresPlugin/runTestMethod In matlab.unittest.plugins.TestRunnerPlugin/invokeTestContentOperatorMethod_ (line 710) In matlab.unittest.TestRunner/evaluateMethodOnPlugins (line 745) In matlab.unittest.TestRunner/runTest (line 1084) In matlab.unittest.TestRunner/repeatTest (line 471) In matlab.unittest.TestRunner/runSharedTestCase (line 427) In matlab.unittest.TestRunner/runTestClass (line 994) In matlab.unittest.TestRunner/invokeTestContentOperatorMethod_ (line 889) In matlab.unittest.TestRunner/evaluateMethodOnPlugins (line 745) In matlab.unittest.TestRunner/runTestSuite (line 931) In matlab.unittest.TestRunner/invokeTestContentOperatorMethod_ (line 889) In matlab.unittest.plugins.TestRunnerPlugin/runTestSuite (line 250) In scoringengine.OutputPlugin/runTestSuite In matlab.unittest.plugins.TestRunnerPlugin/invokeTestContentOperatorMethod_ (line 710) In matlab.unittest.plugins.TestRunnerPlugin/runTestSuite (line 250) In scoringengine.FiguresPlugin/runTestSuite In matlab.unittest.plugins.TestRunnerPlugin/invokeTestContentOperatorMethod_ (line 710) In matlab.unittest.plugins.TestRunnerPlugin/runTestSuite (line 250) In matlab.unittest.plugins.DiagnosticsRecordingPlugin/runTestSuite (line 184) In matlab.unittest.plugins.TestRunnerPlugin/invokeTestContentOperatorMethod_ (line 710) In matlab.unittest.TestRunner/evaluateMethodOnPlugins (line 745) In matlab.unittest.TestRunner/run (line 295) In scoringengine.verifyCode In scoringengine.verifyCode In connector.internal.fevalMatlab In connector.internal.fevalJSON ] [Warning: Rank deficient, rank = 6, tol = 9.513218e+00.] [> In ridgeRegression (line 3) In ScoringEngineTestPoint5 (line 7) In solutionTest (line 13) In matlab.unittest.internal.executeCodeBlock (line 11) In matlab.unittest.internal.ScriptTestCaseProvider/evaluateTestSection (line 134) In matlab.unittest.internal.ScriptTestCaseProvider/runTestSection (line 128) In matlab.unittest.internal.ScriptTestCaseProvider>@(testCase)provider.runTestSection(testCase) (line 94) In matlab.unittest.FunctionTestCase/test (line 98) In matlab.unittest.TestRunner/evaluateMethodCore (line 841) In matlab.unittest.TestRunner/evaluateMethod (line 1141) In matlab.unittest.TestRunner/invokeTestContentOperatorMethod_ (line 889) In matlab.unittest.plugins.TestRunnerPlugin/evaluateMethod (line 679) In scoringengine.OutputPlugin/evaluateMethod In matlab.unittest.plugins.TestRunnerPlugin/invokeTestContentOperatorMethod_ (line 710) In matlab.unittest.plugins.TestRunnerPlugin/evaluateMethod (line 679) In scoringengine.FiguresPlugin/evaluateMethod In matlab.unittest.plugins.TestRunnerPlugin/invokeTestContentOperatorMethod_ (line 710) In matlab.unittest.TestRunner/evaluateMethodOnPlugins (line 745) In matlab.unittest.TestRunner/evaluateMethodsOnTestContent (line 783) In matlab.unittest.TestRunner/runTestMethod (line 1137) In matlab.unittest.TestRunner/invokeTestContentOperatorMethod_ (line 889) In matlab.unittest.plugins.TestRunnerPlugin/runTestMethod (line 633) In scoringengine.OutputPlugin/runTestMethod In matlab.unittest.plugins.TestRunnerPlugin/invokeTestContentOperatorMethod_ (line 710) In matlab.unittest.plugins.TestRunnerPlugin/runTestMethod (line 633) In scoringengine.FiguresPlugin/runTestMethod In matlab.unittest.plugins.TestRunnerPlugin/invokeTestContentOperatorMethod_ (line 710) In matlab.unittest.TestRunner/evaluateMethodOnPlugins (line 745) In matlab.unittest.TestRunner/runTest (line 1084) In matlab.unittest.TestRunner/repeatTest (line 471) In matlab.unittest.TestRunner/runSharedTestCase (line 427) In matlab.unittest.TestRunner/runTestClass (line 994) In matlab.unittest.TestRunner/invokeTestContentOperatorMethod_ (line 889) In matlab.unittest.TestRunner/evaluateMethodOnPlugins (line 745) In matlab.unittest.TestRunner/runTestSuite (line 931) In matlab.unittest.TestRunner/invokeTestContentOperatorMethod_ (line 889) In matlab.unittest.plugins.TestRunnerPlugin/runTestSuite (line 250) In scoringengine.OutputPlugin/runTestSuite In matlab.unittest.plugins.TestRunnerPlugin/invokeTestContentOperatorMethod_ (line 710) In matlab.unittest.plugins.TestRunnerPlugin/runTestSuite (line 250) In scoringengine.FiguresPlugin/runTestSuite In matlab.unittest.plugins.TestRunnerPlugin/invokeTestContentOperatorMethod_ (line 710) In matlab.unittest.plugins.TestRunnerPlugin/runTestSuite (line 250) In matlab.unittest.plugins.DiagnosticsRecordingPlugin/runTestSuite (line 184) In matlab.unittest.plugins.TestRunnerPlugin/invokeTestContentOperatorMethod_ (line 710) In matlab.unittest.TestRunner/evaluateMethodOnPlugins (line 745) In matlab.unittest.TestRunner/run (line 295) In scoringengine.verifyCode In scoringengine.verifyCode In connector.internal.fevalMatlab In connector.internal.fevalJSON ]

6   Pass
x = [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]; y = [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]; A = x.^(0:6); alpha = 10; c = [-1.48348345971319;-21.370159200147;1.50455732468686;-0.0214851248485215;0.000148821639521563;-5.20003346155603e-07;7.26127822714741e-10]; c2 = ridgeRegression(A,alpha,y); dc = c - c2; assert(norm(dc) < eps(norm(c))*1000);

7   Pass
x = [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]; y = [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]; A = x.^(0:6); alpha = 10000; c = [3.07150764626882e-05;0.0011811811626465;0.0297325806037763;0.00644572962571577;-7.30850526187996e-05;2.69506809802866e-07;-3.12356553672693e-10]; c2 = ridgeRegression(A,alpha,y); dc = c - c2; assert(norm(dc) < eps(norm(c))*1000);