Cody

Solution 1669048

Submitted on 8 Nov 2018
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

This solution is outdated. To rescore this solution, sign in.

Test Suite

Test Status Code Input and Output
1   Fail
assessFunctionPresence({'fminsearch', 'optimset'}, 'FileName','predictor.m', 'Feedback','You must use the specified methodology')

Error in solution Line: 8 Column: 15 Incorrect use of '=' operator. To assign a value to a variable, use '='. To compare values for equality, use '=='.

2   Fail
% Adapted from a comment at https://www.mathworks.com/matlabcentral/cody/problems/44343 . assert(~any(cellfun(@(x)ismember(max([0,str2num(x)]),[2012,2019:2023,3000]),regexp(fileread('predictor.m'),'[\d\.\+\-\*\/\(\) \[\]\,\;]+','match'))), 'Please don''t hard-code your ''solution''.') assert(~any(cellfun(@(x)ismember(max([0,str2num(x)]),[2012,2019:2023,3000]),regexp(fileread('predictor.m'),'\d+','match'))), 'Please do not hard-code your ''solution''.')

Error in solution Line: 8 Column: 15 Incorrect use of '=' operator. To assign a value to a variable, use '='. To compare values for equality, use '=='.

3   Fail
futureDate = '22-Jan-2019'; predictedRuntime_correct = round(0.935043294718475, 4); assert(isequal(predictor(futureDate, data), predictedRuntime_correct)) futureDate = '23-Jan-2019'; predictedRuntime_correct = round(0.934448955935569, 4); assert(isequal(predictor(futureDate, data), predictedRuntime_correct)) futureDate = '24-Jan-2019'; predictedRuntime_correct = round(0.933855075296061, 4); assert(isequal(predictor(futureDate, data), predictedRuntime_correct))

Error in solution Line: 8 Column: 15 Incorrect use of '=' operator. To assign a value to a variable, use '='. To compare values for equality, use '=='.

4   Fail
futureDate = '09-Jan-2020'; predictedRuntime_correct = round(0.751755426901932, 4); assert(isequal(predictor(futureDate, data), predictedRuntime_correct)) futureDate = '13-Jan-2020'; predictedRuntime_correct = round(0.749945312632780, 4); assert(isequal(predictor(futureDate, data), predictedRuntime_correct))

Error in solution Line: 8 Column: 15 Incorrect use of '=' operator. To assign a value to a variable, use '='. To compare values for equality, use '=='.

5   Fail
futureDate = '06-Jan-2021'; predictedRuntime_correct = round(0.608254613313523, 4); assert(isequal(predictor(futureDate, data), predictedRuntime_correct)) futureDate = '11-Jan-2021'; predictedRuntime_correct = round(0.606545074994730, 4); assert(isequal(predictor(futureDate, data), predictedRuntime_correct))

Error in solution Line: 8 Column: 15 Incorrect use of '=' operator. To assign a value to a variable, use '='. To compare values for equality, use '=='.

6   Fail
futureDate = '06-Feb-2022'; predictedRuntime_correct = round(0.491354117473879, 4); assert(isequal(predictor(futureDate, data), predictedRuntime_correct)) futureDate = '10-Feb-2022'; predictedRuntime_correct = round(0.490345992043568, 4); assert(isequal(predictor(futureDate, data), predictedRuntime_correct))

Error in solution Line: 8 Column: 15 Incorrect use of '=' operator. To assign a value to a variable, use '='. To compare values for equality, use '=='.

7   Fail
futureDate = '06-Nov-2023'; predictedRuntime_correct = round(0.364155581026111, 4); assert(isequal(predictor(futureDate, data), predictedRuntime_correct)) futureDate = '21-Nov-2023'; predictedRuntime_correct = round(0.361853937995679, 4); assert(isequal(predictor(futureDate, data), predictedRuntime_correct)) futureDate = '25-Nov-2023'; predictedRuntime_correct = round(0.361244649648014, 4); assert(isequal(predictor(futureDate, data), predictedRuntime_correct)) futureDate = '27-Nov-2023'; predictedRuntime_correct = round(0.360940709522436, 4); assert(isequal(predictor(futureDate, data), predictedRuntime_correct))

Error in solution Line: 8 Column: 15 Incorrect use of '=' operator. To assign a value to a variable, use '='. To compare values for equality, use '=='.

8   Fail
futureDate = '01-Jan-3000'; predictedRuntime_correct = round(0.164021404839, 4); assert(isequal(predictor(futureDate, data), predictedRuntime_correct))

Error in solution Line: 8 Column: 15 Incorrect use of '=' operator. To assign a value to a variable, use '='. To compare values for equality, use '=='.

9   Fail
% Assure no 'workarounds' that avoid appropriate use of optimset. % (Added 29 May 2018.) futureDate = {'19-Dec-2019'; '04-Oct-2020'; '06-Nov-2020'; '20-Nov-2020'; '07-Dec-2020'; '09-Dec-2020'; '11-Dec-2020'; '25-Feb-2021'; '04-Mar-2021'; '18-Apr-2021'; '19-May-2021'; '23-Jul-2021'}; pRuntime_c_unrounded = {0.761350673860113 0.641651747331991 0.629650497697623 0.624650604424140 0.618651428148657 0.617950799242008 0.617251250072375 0.591452258418511 0.589151203003048 0.574651625923890 0.564951737257372 0.545350739105932}; for j = 1 : length(futureDate) assert(isequal(predictor(futureDate{j}, data), round(pRuntime_c_unrounded{j}, 4))) end;

Error in solution Line: 8 Column: 15 Incorrect use of '=' operator. To assign a value to a variable, use '='. To compare values for equality, use '=='.