submitWithConfiguration not working in matlab R2019b

Beforehand on previous versions of matlab my following code was working fine. However, after upgrading to latlab R2019b, i get the following error in the submitWithConfiguration function in which it says that 'parts function is not defined.
Here is my code
function submit()
addpath('./lib');
conf.assignmentSlug = 'logistic-regression';
conf.itemName = 'Logistic Regression';
conf.partArrays = { ...
{ ...
'1', ...
{ 'sigmoid.m' }, ...
'Sigmoid Function', ...
}, ...
{ ...
'2', ...
{ 'costFunction.m' }, ...
'Logistic Regression Cost', ...
}, ...
{ ...
'3', ...
{ 'costFunction.m' }, ...
'Logistic Regression Gradient', ...
}, ...
{ ...
'4', ...
{ 'predict.m' }, ...
'Predict', ...
}, ...
{ ...
'5', ...
{ 'costFunctionReg.m' }, ...
'Regularized Logistic Regression Cost', ...
}, ...
{ ...
'6', ...
{ 'costFunctionReg.m' }, ...
'Regularized Logistic Regression Gradient', ...
}, ...
};
conf.output = @output;
submitWithConfiguration(conf);
end
function out = output(partId, auxstring)
% Random Test Cases
X = [ones(20,1) (exp(1) * sin(1:1:20))' (exp(0.5) * cos(1:1:20))'];
y = sin(X(:,1) + X(:,2)) > 0;
if partId == '1'
out = sprintf('%0.5f ', sigmoid(X));
elseif partId == '2'
out = sprintf('%0.5f ', costFunction([0.25 0.5 -0.5]', X, y));
elseif partId == '3'
[cost, grad] = costFunction([0.25 0.5 -0.5]', X, y);
out = sprintf('%0.5f ', grad);
elseif partId == '4'
out = sprintf('%0.5f ', predict([0.25 0.5 -0.5]', X));
elseif partId == '5'
out = sprintf('%0.5f ', costFunctionReg([0.25 0.5 -0.5]', X, y, 0.1));
elseif partId == '6'
[cost, grad] = costFunctionReg([0.25 0.5 -0.5]', X, y, 0.1);
out = sprintf('%0.5f ', grad);
end
end
Following is the error i get
Unrecognized function or variable 'parts'.
Error in submitWithConfiguration (line 4)
parts = parts(conf);
Error in submit (line 40)
submitWithConfiguration(conf);
Please give me some suggestions as for how to solve this. Thanks for your time!

18 Commenti

You haven't shown the code for that submitWithConfiguration function.
There is a parts function in some matlab toolbox but since it doesn't work with structure inputs it's unlikely that it's the same parts function you're using. Therefore, that missing function is probably one you wrote.
A
which parts -all
in the old version of matlab may help you understand where that function is located.
Here is the code for submitWithConfiguration function but I do not have the code for 'parts' function as the code is for a course on coursera and it is used to submit the code on the website. They have provided this set of codes for submission to run which i just used to run beforehand but on this new version i am unable to.
function submitWithConfiguration(conf)
addpath('./lib/jsonlab');
parts = parts(conf);
fprintf('== Submitting solutions | %s...\n', conf.itemName);
tokenFile = 'token.mat';
if exist(tokenFile, 'file')
load(tokenFile);
[email token] = promptToken(email, token, tokenFile);
else
[email token] = promptToken('', '', tokenFile);
end
if isempty(token)
fprintf('!! Submission Cancelled\n');
return
end
try
response = submitParts(conf, email, token, parts);
catch
e = lasterror();
fprintf('\n!! Submission failed: %s\n', e.message);
fprintf('\n\nFunction: %s\nFileName: %s\nLineNumber: %d\n', ...
e.stack(1,1).name, e.stack(1,1).file, e.stack(1,1).line);
fprintf('\nPlease correct your code and resubmit.\n');
return
end
if isfield(response, 'errorMessage')
fprintf('!! Submission failed: %s\n', response.errorMessage);
elseif isfield(response, 'errorCode')
fprintf('!! Submission failed: %s\n', response.message);
else
showFeedback(parts, response);
save(tokenFile, 'email', 'token');
end
end
function [email token] = promptToken(email, existingToken, tokenFile)
if (~isempty(email) && ~isempty(existingToken))
prompt = sprintf( ...
'Use token from last successful submission (%s)? (Y/n): ', ...
email);
reenter = input(prompt, 's');
if (isempty(reenter) || reenter(1) == 'Y' || reenter(1) == 'y')
token = existingToken;
return;
else
delete(tokenFile);
end
end
email = input('Login (email address): ', 's');
token = input('Token: ', 's');
end
function isValid = isValidPartOptionIndex(partOptions, i)
isValid = (~isempty(i)) && (1 <= i) && (i <= numel(partOptions));
end
function response = submitParts(conf, email, token, parts)
body = makePostBody(conf, email, token, parts);
submissionUrl = submissionUrl();
responseBody = getResponse(submissionUrl, body);
jsonResponse = validateResponse(responseBody);
response = loadjson(jsonResponse);
end
function body = makePostBody(conf, email, token, parts)
bodyStruct.assignmentSlug = conf.assignmentSlug;
bodyStruct.submitterEmail = email;
bodyStruct.secret = token;
bodyStruct.parts = makePartsStruct(conf, parts);
opt.Compact = 1;
body = savejson('', bodyStruct, opt);
end
function partsStruct = makePartsStruct(conf, parts)
for part = parts
partId = part{:}.id;
fieldName = makeValidFieldName(partId);
outputStruct.output = conf.output(partId);
partsStruct.(fieldName) = outputStruct;
end
end
function [parts] = parts(conf)
parts = {};
for partArray = conf.partArrays
part.id = partArray{:}{1};
part.sourceFiles = partArray{:}{2};
part.name = partArray{:}{3};
parts{end + 1} = part;
end
end
function showFeedback(parts, response)
fprintf('== \n');
fprintf('== %43s | %9s | %-s\n', 'Part Name', 'Score', 'Feedback');
fprintf('== %43s | %9s | %-s\n', '---------', '-----', '--------');
for part = parts
score = '';
partFeedback = '';
partFeedback = response.partFeedbacks.(makeValidFieldName(part{:}.id));
partEvaluation = response.partEvaluations.(makeValidFieldName(part{:}.id));
score = sprintf('%d / %3d', partEvaluation.score, partEvaluation.maxScore);
fprintf('== %43s | %9s | %-s\n', part{:}.name, score, partFeedback);
end
evaluation = response.evaluation;
totalScore = sprintf('%d / %d', evaluation.score, evaluation.maxScore);
fprintf('== --------------------------------\n');
fprintf('== %43s | %9s | %-s\n', '', totalScore, '');
fprintf('== \n');
end
% use urlread or curl to send submit results to the grader and get a response
function response = getResponse(url, body)
% try using urlread() and a secure connection
params = {'jsonBody', body};
[response, success] = urlread(url, 'post', params);
if (success == 0)
% urlread didn't work, try curl & the peer certificate patch
if ispc
% testing note: use 'jsonBody =' for a test case
json_command = sprintf('echo jsonBody=%s | curl -k -X POST -d @- %s', body, url);
else
% it's linux/OS X, so use the other form
json_command = sprintf('echo ''jsonBody=%s'' | curl -k -X POST -d @- %s', body, url);
end
% get the response body for the peer certificate patch method
[code, response] = system(json_command);
% test the success code
if (code ~= 0)
fprintf('[error] submission with curl() was not successful\n');
end
end
end
% validate the grader's response
function response = validateResponse(resp)
% test if the response is json or an HTML page
isJson = length(resp) > 0 && resp(1) == '{';
isHtml = findstr(lower(resp), '<html');
if (isJson)
response = resp;
elseif (isHtml)
% the response is html, so it's probably an error message
printHTMLContents(resp);
error('Grader response is an HTML message');
else
error('Grader sent no response');
end
end
% parse a HTML response and print it's contents
function printHTMLContents(response)
strippedResponse = regexprep(response, '<[^>]+>', ' ');
strippedResponse = regexprep(strippedResponse, '[\t ]+', ' ');
fprintf(strippedResponse);
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Service configuration
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function submissionUrl = submissionUrl()
submissionUrl = 'https://www-origin.coursera.org/api/onDemandProgrammingImmediateFormSubmissions.v1';
end
Mehrdad Abdi
Mehrdad Abdi il 22 Set 2019
Spostato: Rik il 13 Ott 2022
I have the same problem in Matlab Online:
>> submit
Warning: Function Warning: Name is nonexistent or not a directory: /MATLAB Drive/machine-learning-ex1/machine-learning-ex1/./lib
> In path (line 109)
In addpath (line 86)
In addpath (line 47)
In submit (line 2)
Warning: Function Warning: Name is nonexistent or not a directory: /MATLAB Drive/machine-learning-ex1/machine-learning-ex1/./lib/jsonlab
> In path (line 109)
In addpath (line 86)
In addpath (line 47)
In submitWithConfiguration (line 2)
In submit (line 45)
'parts' requires one of the following:
Navigation Toolbox
Robotics System Toolbox
Sensor Fusion and Tracking Toolbox
Error in submitWithConfiguration (line 4)
parts = parts(conf);
Error in submit (line 45)
submitWithConfiguration(conf);
>> which parts -all
'parts' not found.
I think the problem is that the function 'parts' is defined after the part in which it is used but i can not put it on the top as the function i am using 'submitWithConfiguration' is the same name as file and that has to be on top.
No if PARTS is subfunction, meaning declared in the same MFILE as the caller, it should be found.
What is the purpose of "addpath('./lib');" ?
You should not call addpath() inside the function like this. If you want to addpath, you should do it once when at the opening of your program and might be need to call rehash() right after path are added.
Guillaume
Guillaume il 22 Set 2019
Spostato: Rik il 13 Ott 2022
@Mehrdad Abdi, how is that an answer to the question? Please use comment on this question instead of clicking answer this question unless you are actually providing a solution.
@Umang Patel, as I wrote in my first comment to you, the parts function that comes with matlab (in the toolboxes) is not the parts function you are using. Matlab's parts function does not accept a structure as input. You are passing a structure to parts.
addpath is used to use function of another directory. However, in some languages like c++, a function should atleast be define before it is used and also when i point the pointer to the line '[parts] = parts(conf)' , matlab editor says that parts function might be used before it is defined. So i think in the new version of matlab, they have modified it to be like the case of c++ i mentioned earlier. Also adding path does not mean that the function can not find other functions defined in the same file.
Bruno Luong
Bruno Luong il 22 Set 2019
Modificato: Bruno Luong il 22 Set 2019
But ADDPATH takes time because it will parse the directory and kick a JIT.
This is one more terrible way of programming (put addpath on top of a function).
So i should put it before the function's definition?
Umang Patel
Umang Patel il 22 Set 2019
Spostato: Rik il 13 Ott 2022
Yes sorry i will delete that comment.
Bruno Luong
Bruno Luong il 22 Set 2019
Modificato: Bruno Luong il 22 Set 2019
Call Addpath somewhere from your TOP function (the one that call from command windows), only once, followed by REHASH.
Ohh I see what you are saying. It will process the addpath command everytime whereas it is not necessary to do so everytime and doing it only will suffice.
Mehrdad Abdi
Mehrdad Abdi il 23 Set 2019
Spostato: Rik il 13 Ott 2022
@Guillaume Oh sorry, I didn't know I can comment. I tought it's like Github issue tracking.
Nirmala Jyothy Bakka
Nirmala Jyothy Bakka il 19 Mag 2021
Spostato: Rik il 13 Ott 2022
I am also getting the same problem
i am also getting this problem
Rik
Rik il 8 Lug 2021
Spostato: Rik il 13 Ott 2022
Comment posted as flag by Chandini pradhan:
i have also same problem .can anyone help me out
Priya Priya
Priya Priya il 18 Set 2021
Spostato: Rik il 13 Ott 2022
have also same problem.
Himanshu Rajaura
Himanshu Rajaura il 7 Feb 2022
Spostato: Rik il 13 Ott 2022
have same problem

Accedi per commentare.

 Risposta accettata

Bruno Luong
Bruno Luong il 22 Set 2019
Modificato: Bruno Luong il 19 Lug 2020
The problem is in the statement
parts = parts(conf);
In MATLAB 2019B, you cannot use the same name of variable and function, because the JIT will consider the PARTS as variable and overshadow your function.
This change is new for R2019B, please read the Release Note for more information.
In anycase use the same name for VARIABLE and FUNCTION is evidently a terrible way of programming (I see the same happens inside the body of PARTS function).
EDIT: Workaround If you are allowed to edit and make change of function submitWithConfiguration, change the LHS of line 4, AND successive instants of "parts" after this line to "part_variable".
part_variable = parts(conf); % Keep the "parts" on RHS
% ... also successive instant of "parts" to "part_variable" without double quote

18 Commenti

Thanks for the help. That solved the problem.
You have to modify the name of 'submissionUrl' function also as the output variable of that function has the same name as of itself.
In my opinion, the best course of action would be to go back to coursera and ask them to fix their submission code. It shouldn't be down to you to fix their poorly written code.
this is the submitWithConfiguration.m file code corrected. search "fun" and you will see the points where you need to make the changes in the code. the file is universal. i used it for submitting ex6 and now it works for ex7 as well.
function submitWithConfiguration(conf)
addpath('./lib/jsonlab');
partsfun = parts(conf);
fprintf('== Submitting solutions | %s...\n', conf.itemName);
tokenFile = 'token.mat';
if exist(tokenFile, 'file')
load(tokenFile);
[email token] = promptToken(email, token, tokenFile);
else
[email token] = promptToken('', '', tokenFile);
end
if isempty(token)
fprintf('!! Submission Cancelled\n');
return
end
try
response = submitParts(conf, email, token, partsfun);
catch
e = lasterror();
fprintf('\n!! Submission failed: %s\n', e.message);
fprintf('\n\nFunction: %s\nFileName: %s\nLineNumber: %d\n', ...
e.stack(1,1).name, e.stack(1,1).file, e.stack(1,1).line);
fprintf('\nPlease correct your code and resubmit.\n');
return
end
if isfield(response, 'errorMessage')
fprintf('!! Submission failed: %s\n', response.errorMessage);
elseif isfield(response, 'errorCode')
fprintf('!! Submission failed: %s\n', response.message);
else
showFeedback(partsfun, response);
save(tokenFile, 'email', 'token');
end
end
function [email token] = promptToken(email, existingToken, tokenFile)
if (~isempty(email) && ~isempty(existingToken))
prompt = sprintf( ...
'Use token from last successful submission (%s)? (Y/n): ', ...
email);
reenter = input(prompt, 's');
if (isempty(reenter) || reenter(1) == 'Y' || reenter(1) == 'y')
token = existingToken;
return;
else
delete(tokenFile);
end
end
email = input('Login (email address): ', 's');
token = input('Token: ', 's');
end
function isValid = isValidPartOptionIndex(partOptions, i)
isValid = (~isempty(i)) && (1 <= i) && (i <= numel(partOptions));
end
function response = submitParts(conf, email, token, partsfun)
body = makePostBody(conf, email, token, partsfun);
submissionUrlfun = submissionUrl();
responseBody = getResponse(submissionUrlfun, body);
jsonResponse = validateResponse(responseBody);
response = loadjson(jsonResponse);
end
function body = makePostBody(conf, email, token, partsfun)
bodyStruct.assignmentSlug = conf.assignmentSlug;
bodyStruct.submitterEmail = email;
bodyStruct.secret = token;
bodyStruct.parts = makePartsStruct(conf, partsfun);
opt.Compact = 1;
body = savejson('', bodyStruct, opt);
end
function partsStruct = makePartsStruct(conf, partsfun)
for part = partsfun
partId = part{:}.id;
fieldName = makeValidFieldName(partId);
outputStruct.output = conf.output(partId);
partsStruct.(fieldName) = outputStruct;
end
end
function [parts] = parts(conf)
parts = {};
for partArray = conf.partArrays
part.id = partArray{:}{1};
part.sourceFiles = partArray{:}{2};
part.name = partArray{:}{3};
parts{end + 1} = part;
end
end
function showFeedback(partsfun, response)
fprintf('== \n');
fprintf('== %43s | %9s | %-s\n', 'Part Name', 'Score', 'Feedback');
fprintf('== %43s | %9s | %-s\n', '---------', '-----', '--------');
for part = partsfun
score = '';
partFeedback = '';
partFeedback = response.partFeedbacks.(makeValidFieldName(part{:}.id));
partEvaluation = response.partEvaluations.(makeValidFieldName(part{:}.id));
score = sprintf('%d / %3d', partEvaluation.score, partEvaluation.maxScore);
fprintf('== %43s | %9s | %-s\n', part{:}.name, score, partFeedback);
end
evaluation = response.evaluation;
totalScore = sprintf('%d / %d', evaluation.score, evaluation.maxScore);
fprintf('== --------------------------------\n');
fprintf('== %43s | %9s | %-s\n', '', totalScore, '');
fprintf('== \n');
end
% use urlread or curl to send submit results to the grader and get a response
function response = getResponse(url, body)
% try using urlread() and a secure connection
params = {'jsonBody', body};
[response, success] = urlread(url, 'post', params);
if (success == 0)
% urlread didn't work, try curl & the peer certificate patch
if ispc
% testing note: use 'jsonBody =' for a test case
json_command = sprintf('echo jsonBody=%s | curl -k -X POST -d @- %s', body, url);
else
% it's linux/OS X, so use the other form
json_command = sprintf('echo ''jsonBody=%s'' | curl -k -X POST -d @- %s', body, url);
end
% get the response body for the peer certificate patch method
[code, response] = system(json_command);
% test the success code
if (code ~= 0)
fprintf('[error] submission with curl() was not successful\n');
end
end
end
% validate the grader's response
function response = validateResponse(resp)
% test if the response is json or an HTML page
isJson = length(resp) > 0 && resp(1) == '{';
isHtml = findstr(lower(resp), '<html');
if (isJson)
response = resp;
elseif (isHtml)
% the response is html, so it's probably an error message
printHTMLContents(resp);
error('Grader response is an HTML message');
else
error('Grader sent no response');
end
end
% parse a HTML response and print it's contents
function printHTMLContents(response)
strippedResponse = regexprep(response, '<[^>]+>', ' ');
strippedResponse = regexprep(strippedResponse, '[\t ]+', ' ');
fprintf(strippedResponse);
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Service configuration
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function submissionUrl = submissionUrl()
submissionUrl = 'https://www-origin.coursera.org/api/onDemandProgrammingImmediateFormSubmissions.v1';
end
Thank you so much
Ioannis Kiratzis for the solution .
even the above code is not working.@Bipin singh how it worked to u.
Thank you it is very reasonable
Thank you very much
"It's not working" might be an acceptable description of a problem when you tow your car to a mechanic, because the mechanic would have the car right there to be able to test and plug diagnostic monitors into. It is, however, not an acceptable description of a problem with a computer program, as we cannot see your screen from here and we do not have an account on that system to test with.
Tom Mosher
Tom Mosher il 31 Ago 2020
Modificato: Tom Mosher il 31 Ago 2020
Between "it doesn't work" and "I have exactly the same problem", that covers about 50% of the posts on the Machine Learning course forum.
Thank you so much
Ioannis Kiratzis for the solution .
Thank you! It fixed the issue, finally.
Thanks it woked
'parts' requires one of the following:
Automated Driving Toolbox
Navigation Toolbox
Robotics System Toolbox
Sensor Fusion and Tracking Toolbox
UAV Toolbox
Error in submitWithConfiguration (line 4)
parts = parts(conf);
Error in submit (line 45)
submitWithConfiguration(conf);
makeValidFieldName
Not enough input arguments.
Error in makeValidFieldName (line 7)
pos=regexp(str,'^[^A-Za-z]','once');
submitWithConfiguration
Warning: Function Warning: Name is nonexistent or not a directory: /MATLAB Drive/machine-learning-ex1/machine-learning-ex1/ex1/lib/./lib/jsonlab
> In path (line 109)
In addpath (line 86)
In addpath (line 49)
In submitWithConfiguration (line 2)
Not enough input arguments.
Error in submitWithConfiguration (line 4)
partsfun = parts(conf);
i am still geting this error
Comment posted as flag by Chandini pradhan:
part_variable = parts(conf); this is also not working .showing the same problem

Accedi per commentare.

Più risposte (6)

Tom Mosher
Tom Mosher il 22 Feb 2020
Modificato: Tom Mosher il 22 Feb 2020
I am a mentor for the Coursera "Machine Learning" course. I'm posting here in hopes that students of the course will stop using this thread.
  • Students should not modify their submit functions.
  • The course materials have been updated to address this issue.
  • There are separate programming exercise zip files for Octave and MATLAB Online. If you download the correct zip file, you won't have this problem.
If you are using MATLAB Online and see this "parts" = parts(conf)" error, it means you installed the wrong zip file.
  • The zip file for use with MATLAB Online is available via the Week 2 course materials page that has the MATLAB Online setup instructions. This zip file also includes the 'mlx' companion scripts that include the exercise instructions.
  • The zip file you find on the "Programming Assignments" page is only for use with Octave - or with older desktop MATLAB versions that don't support mlx files.

12 Commenti

Sir, I am still facing the issue. I downloaded the zip file, and same problem occurs to me. Please help
Me too, I still have the same problem
Same issue here also
Sir I am still facing the same problem and my deadlines are coming closer
Thank you Tom ! To everyone saying it doesnt work, you need to go to week 2, environnement setup instruction, reading, acces matlab online tutorial..., downloaded the updated exercices. The follow the instructions. Worked for me and I hope it will for you !
Hello Tom and other fellows,
I downloaded the updated zip file from the "Week 2 - Environment Setup Instructions - Reading: Access the MATLAB Online Trial and Exercise Files for MATLAB users" but still facing the same error. To assure you that I have downloaded the zip files from right page, I have pasted the link that page below.
Below mentioned is the error that I am receiving again and again.
>>submit
Warning: Function Warning: Name is nonexistent or not a directory: /MATLAB Drive/machine-learning-ex1/./lib
> In path (line 109)
In addpath (line 86)
In addpath (line 47)
In submit (line 2)
Warning: Function Warning: Name is nonexistent or not a directory: /MATLAB Drive/machine-learning-ex1/./lib/jsonlab
> In path (line 109)
In addpath (line 86)
In addpath (line 47)
In submitWithConfiguration (line 2)
In submit (line 45)
'parts' requires one of the following:
Automated Driving Toolbox
Navigation Toolbox
Robotics System Toolbox
Sensor Fusion and Tracking Toolbox
Error in submitWithConfiguration (line 4)
parts = parts(conf);
Error in submit (line 45)
submitWithConfiguration(conf);
Please help!
Havin the same issue
I recommend you commend on the course Discussion Forum.
Or, read my reply on this Forum from Feb 22, 2020.
I clicked the link to download the updated sets for submit.m and submitWithConfiguration.m, then replaced those two files in my assignment folder and it worked. Thanks Tom
It's not working. The 2021 submit files are not working sir. I tried Octave. I tried Matlab, I tried github versions, I tried your versions, None of them work and all fail in the submission part. I really don't know what else to try, none of your versions work.
The MATLAB scripts work with MATLAB Online.
The Octave scripts work with Octave and with MATLAB r2019a and earlier.
Hundreds of thousands of students have used these programming assignments without problems.
Please post your questions about the course on the Coursera "Machine Learning" forum.

Accedi per commentare.

What you're seeing is a documented change of behaviour in R2019b, regarding poorly written code as is the case here.
Matlab no longer accepts the same name being used for both a variable and a local function. See identifiers cannot be used for two purposes inside a function.
The simplest fix is to rename the parts function to partsfun or similar and do the same where it is called, so on line 4:
parts = partsfun(conf);
and on line 77:
function parts = partsfun(conf)
If that code was provided to you by your tutor, you're entitled to complain to them. They shouldn't give you code that has so many mlint warnings.
Even that parts function is poorly written:
function parts = partsfun(conf)
parts = num2cell(cell2struct(vertcat(conf.partArrays{:}), {'id', 'sourcefiles', 'name'}, 2))';
end
would produce the same output.

5 Commenti

thanks it worked for me :)
how did this submitwithconfiguration code problem got resolved
it's not wrorking
Thank you so much! It worked for me too. :)
Thanks!you are right.

Accedi per commentare.

4 Commenti

I am using your own submission files sir. The UPDATED ones as you say. It DOES NOT work. It keeps giving errors. I have tried everything and quite frankly am out of ideas and really need help because I wish to complete the course but can't submit any of my assignments. Please assist me ASAP.
my email is sirmalek2018@gmail.com
Please email me or comment here asap.
Here is what I get
Running warmUpExercise ...
5x5 Identity Matrix:
ans =
Diagonal Matrix
1 0 0 0 0
0 1 0 0 0
0 0 1 0 0
0 0 0 1 0
0 0 0 0 1
Program paused. Press enter to continue.
Plotting Data ...
Program paused. Press enter to continue.
Testing the cost function ...
With theta = [0 ; 0]
Cost computed = 32.072734
Expected cost value (approx) 32.07
With theta = [-1 ; 2]
Cost computed = 54.242455
Expected cost value (approx) 54.24
Program paused. Press enter to continue.
Running Gradient Descent ...
Theta found by gradient descent:
-3.630291
1.166362
Expected theta values (approx)
-3.6303
1.1664
warning: legend: ignoring extra labels.
warning: called from
legend>parse_opts at line 817 column 9
legend at line 206 column 8
ex1 at line 88 column 1
For population = 35,000, we predict a profit of 4519.767868
For population = 70,000, we predict a profit of 45342.450129
Program paused. Press enter to continue.
Visualizing J(theta_0, theta_1) ...
>>
>> submit
warning: load_path: lib\jsonlab: No such file or directory
warning: load-path: update failed for 'lib\jsonlab', removing from path
warning: load_path: lib\jsonlab: No such file or directory
warning: called from
submit at line 2 column 3
warning: load-path: update failed for 'lib\jsonlab', removing from path
warning: called from
submit at line 2 column 3
warning: addpath: ./lib/jsonlab: No such file or directory
warning: called from
submitWithConfiguration at line 2 column 3
submit at line 45 column 3
warning: load_path: lib\jsonlab: No such file or directory
warning: called from
submitWithConfiguration at line 2 column 3
submit at line 45 column 3
warning: load-path: update failed for 'lib\jsonlab', removing from path
warning: called from
submitWithConfiguration at line 2 column 3
submit at line 45 column 3
== Submitting solutions | Linear Regression with Multiple Variables...
Login (email address): *******@gmail.com
Token: *******
warning: load_path: lib\jsonlab: No such file or directory
warning: called from
submitWithConfiguration>makePartsStruct at line 85 column 15
submitWithConfiguration>makePostBody at line 76 column 20
submitWithConfiguration>submitParts at line 65 column 8
submitWithConfiguration at line 22 column 14
submit at line 45 column 3
warning: load-path: update failed for 'lib\jsonlab', removing from path
warning: called from
submitWithConfiguration>makePartsStruct at line 85 column 15
submitWithConfiguration>makePostBody at line 76 column 20
submitWithConfiguration>submitParts at line 65 column 8
submitWithConfiguration at line 22 column 14
submit at line 45 column 3
warning: load_path: lib\jsonlab: No such file or directory
warning: called from
submitWithConfiguration>makePartsStruct at line 85 column 15
submitWithConfiguration>makePostBody at line 76 column 20
submitWithConfiguration>submitParts at line 65 column 8
submitWithConfiguration at line 22 column 14
submit at line 45 column 3
warning: load-path: update failed for 'lib\jsonlab', removing from path
warning: called from
submitWithConfiguration>makePartsStruct at line 85 column 15
submitWithConfiguration>makePostBody at line 76 column 20
submitWithConfiguration>submitParts at line 65 column 8
submitWithConfiguration at line 22 column 14
submit at line 45 column 3
!! Submission failed: 'makeValidFieldName' undefined near line 85, column 85
Function: submitWithConfiguration>makePartsStruct
FileName: C:\Users\elmm\Desktop\Andrew Ng Machine Learning Assignments\NOO\lib\submitWithConf
iguration.m
LineNumber: 85
Please correct your code and resubmit.
>>

Accedi per commentare.

I am a mentor for Andrew Ng's Machine Learning course.
The recommended fix for this issue is to use the correct set of programming exercise scripts.
There are two sets:
  • One for Octave (it's in the "Programming Assignment" page).
  • The other is for MATLAB 2019b and later - like MATLAB Online. It has the fix required for this "parts = parts(conf)" issue. The MATLAB version of the programming exercise scripts is on the page in Week 2 with the MATLAB Online setup instructions.
***** Other benefits of using the right set of scripts *****
If you get the MATLAB version of the programming exercise scripts, you also get the ".mlx" helper script file, with the built-in instructions and fancy Notebooks-like interface. That is not provided with the Octave version of the scripts.
You also get all eight programming exercises in one swipe- with Octave, you have to repeat the download-and-extract business eight times during the course.
********
So, please use the right programming exercise scrips - and stop modifying the submit functions. Many students break things when trying that. It's a bad day for everyone.
Thank you.

9 Commenti

If you're trying to update your existing scripts, then be sure to replace both submit.m and also the "lib" directory, which contains files used by submit.m. Replacing submit.m alone will not improve anything.
I recommend you use the correct scripts in the first place.
  • Tom, ML course mentor
Cesare posted the link above.
Note that new programming exercise zip files were published few weeks ago. They involve changes to the submit scripts - not the programming assignments.
The new scripts are called
  • ex?-octave.zip for each of the eight Octave scripts.
  • ex1-ex8-matlab.zip for the integrated package of all eight exercises for MATLAB Online.
I am using your own submission files sir. The UPDATED ones as you say. It DOES NOT work. It keeps giving errors. I have tried everything and quite frankly am out of ideas and really need help because I wish to complete the course but can't submit any of my assignments. Please assist me ASAP.
my email is sirmalek2018@gmail.com
Please email me or comment here asap
Here is what I get
Running warmUpExercise ...
5x5 Identity Matrix:
ans =
Diagonal Matrix
1 0 0 0 0
0 1 0 0 0
0 0 1 0 0
0 0 0 1 0
0 0 0 0 1
Program paused. Press enter to continue.
Plotting Data ...
Program paused. Press enter to continue.
Testing the cost function ...
With theta = [0 ; 0]
Cost computed = 32.072734
Expected cost value (approx) 32.07
With theta = [-1 ; 2]
Cost computed = 54.242455
Expected cost value (approx) 54.24
Program paused. Press enter to continue.
Running Gradient Descent ...
Theta found by gradient descent:
-3.630291
1.166362
Expected theta values (approx)
-3.6303
1.1664
warning: legend: ignoring extra labels.
warning: called from
legend>parse_opts at line 817 column 9
legend at line 206 column 8
ex1 at line 88 column 1
For population = 35,000, we predict a profit of 4519.767868
For population = 70,000, we predict a profit of 45342.450129
Program paused. Press enter to continue.
Visualizing J(theta_0, theta_1) ...
>>
>> submit
warning: load_path: lib\jsonlab: No such file or directory
warning: load-path: update failed for 'lib\jsonlab', removing from path
warning: load_path: lib\jsonlab: No such file or directory
warning: called from
submit at line 2 column 3
warning: load-path: update failed for 'lib\jsonlab', removing from path
warning: called from
submit at line 2 column 3
warning: addpath: ./lib/jsonlab: No such file or directory
warning: called from
submitWithConfiguration at line 2 column 3
submit at line 45 column 3
warning: load_path: lib\jsonlab: No such file or directory
warning: called from
submitWithConfiguration at line 2 column 3
submit at line 45 column 3
warning: load-path: update failed for 'lib\jsonlab', removing from path
warning: called from
submitWithConfiguration at line 2 column 3
submit at line 45 column 3
== Submitting solutions | Linear Regression with Multiple Variables...
Login (email address): *******@gmail.com
Token: *******
warning: load_path: lib\jsonlab: No such file or directory
warning: called from
submitWithConfiguration>makePartsStruct at line 85 column 15
submitWithConfiguration>makePostBody at line 76 column 20
submitWithConfiguration>submitParts at line 65 column 8
submitWithConfiguration at line 22 column 14
submit at line 45 column 3
warning: load-path: update failed for 'lib\jsonlab', removing from path
warning: called from
submitWithConfiguration>makePartsStruct at line 85 column 15
submitWithConfiguration>makePostBody at line 76 column 20
submitWithConfiguration>submitParts at line 65 column 8
submitWithConfiguration at line 22 column 14
submit at line 45 column 3
warning: load_path: lib\jsonlab: No such file or directory
warning: called from
submitWithConfiguration>makePartsStruct at line 85 column 15
submitWithConfiguration>makePostBody at line 76 column 20
submitWithConfiguration>submitParts at line 65 column 8
submitWithConfiguration at line 22 column 14
submit at line 45 column 3
warning: load-path: update failed for 'lib\jsonlab', removing from path
warning: called from
submitWithConfiguration>makePartsStruct at line 85 column 15
submitWithConfiguration>makePostBody at line 76 column 20
submitWithConfiguration>submitParts at line 65 column 8
submitWithConfiguration at line 22 column 14
submit at line 45 column 3
!! Submission failed: 'makeValidFieldName' undefined near line 85, column 85
Function: submitWithConfiguration>makePartsStruct
FileName: C:\Users\elmm\Desktop\Andrew Ng Machine Learning Assignments\NOO\lib\submitWithConf
iguration.m
LineNumber: 85
Please correct your code and resubmit.
>>
Tom Mosher
Tom Mosher il 22 Ott 2021
Modificato: Tom Mosher il 22 Ott 2021
Please post your question on the Coursera "Machine Learning" course forum.
I have the same problem
I have the same recommendation.

Accedi per commentare.

I request that the OP of this thread please close it to further comments.
The question has been answered multiple times.

4 Commenti

There is no current ability to close a Question to further responses, except by closing the entire Question. However people are still encountering the problem, so it should not be closed.
If the question is closed, would it still be available to read? Since the answers have already been provided, that would be sufficient.
Even after following all the steps im not able to submit it.
If you have problems with the course assignments, please post on the course Discussion Forum - not here.

Accedi per commentare.

Submission failed: unexpected error: Unrecognized field name "assignmentSlug".
how to solve this?

3 Commenti

hi
me too, i have the same problem??
here is my error
please help me?????
!! Submission failed: Unrecognized field name "assignmentSlug".
Function: makePostBody
FileName: /MATLAB Drive/submitWithConfiguration.m
LineNumber: 74
Please correct your code and resubmit.
I have the same problem, is there any fix ?
@Shreyas Have you read the second answer in this thread?

Accedi per commentare.

Categorie

Richiesto:

il 22 Set 2019

Spostato:

Rik
il 13 Ott 2022

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by