submitWithConfiguration not working in matlab R2019b
Mostra commenti meno recenti
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
Guillaume
il 22 Set 2019
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.
Umang Patel
il 22 Set 2019
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.
Umang Patel
il 22 Set 2019
Bruno Luong
il 22 Set 2019
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.
@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.
Umang Patel
il 22 Set 2019
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).
Umang Patel
il 22 Set 2019
Umang Patel
il 22 Set 2019
Spostato: Rik
il 13 Ott 2022
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.
Umang Patel
il 22 Set 2019
Mehrdad Abdi
il 23 Set 2019
Spostato: Rik
il 13 Ott 2022
Nirmala Jyothy Bakka
il 19 Mag 2021
Spostato: Rik
il 13 Ott 2022
I am also getting the same problem
Ghulam Ashraf
il 2 Lug 2021
i am also getting this problem
i have also same problem .can anyone help me out
Priya Priya
il 18 Set 2021
Spostato: Rik
il 13 Ott 2022
have also same problem.
Himanshu Rajaura
il 7 Feb 2022
Spostato: Rik
il 13 Ott 2022
have same problem
Risposta accettata
Più risposte (6)
Tom Mosher
il 22 Feb 2020
Modificato: Tom Mosher
il 22 Feb 2020
14 voti
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
Muhammad Faheem
il 3 Apr 2020
Modificato: Muhammad Faheem
il 3 Apr 2020
Sir, I am still facing the issue. I downloaded the zip file, and same problem occurs to me. Please help
loubna ben allal
il 9 Apr 2020
Me too, I still have the same problem
Zulkifil Mallah
il 11 Apr 2020
Same issue here also
Parth Rastogi
il 11 Apr 2020
Sir I am still facing the same problem and my deadlines are coming closer
Robin Mailhot
il 13 Apr 2020
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 !
Sarwan Kumar
il 11 Lug 2020
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!
Widelyne Rempart
il 9 Nov 2020
Havin the same issue
Tom Mosher
il 9 Nov 2020
I recommend you commend on the course Discussion Forum.
Tom Mosher
il 9 Nov 2020
Or, read my reply on this Forum from Feb 22, 2020.
Alexander Claudino Daffara
il 21 Ago 2021
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
Amirali Malekani Nezhad
il 22 Ott 2021
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.
Tom Mosher
il 22 Ott 2021
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.
Guillaume
il 22 Set 2019
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
Rahul Kumar Bauri
il 2 Mag 2020
thanks it worked for me :)
dhana lakshmi
il 29 Mag 2020
how did this submitwithconfiguration code problem got resolved
Harshad Koshti
il 21 Lug 2020
it's not wrorking
Krish Chatterjee
il 25 Ago 2020
Thank you so much! It worked for me too. :)
zi Qin
il 23 Ott 2020
Thanks!you are right.
Cesare Ressa
il 4 Feb 2020
4 voti
There's an updated folder here: https://www.coursera.org/learn/machine-learning/supplement/rANSM/access-matlab-online-and-upload-the-exercise-files
4 Commenti
Micha premkumar Thomai
il 12 Apr 2020
Thank you CR
Amol Vivek Kulkarni
il 14 Gen 2021
Thank you so much!!!
Amirali Malekani Nezhad
il 22 Ott 2021
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.
Amirali Malekani Nezhad
il 22 Ott 2021
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
il 2 Mag 2020
3 voti
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
Kazem Edmond
il 30 Ago 2020
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.
Tom Mosher
il 31 Ago 2020
I recommend you use the correct scripts in the first place.
- Tom, ML course mentor
Tom Mosher
il 31 Ago 2020
Cesare posted the link above.
Tom Mosher
il 21 Ago 2021
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.
Amirali Malekani Nezhad
il 22 Ott 2021
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
Amirali Malekani Nezhad
il 22 Ott 2021
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
il 22 Ott 2021
Modificato: Tom Mosher
il 22 Ott 2021
Please post your question on the Coursera "Machine Learning" course forum.
Natalie Scherrer
il 26 Ott 2021
I have the same problem
Tom Mosher
il 26 Ott 2021
I have the same recommendation.
Tom Mosher
il 31 Ago 2020
0 voti
I request that the OP of this thread please close it to further comments.
The question has been answered multiple times.
4 Commenti
Walter Roberson
il 31 Ago 2020
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.
Tom Mosher
il 31 Ago 2020
If the question is closed, would it still be available to read? Since the answers have already been provided, that would be sufficient.
Swarrangi P
il 9 Ott 2020
Even after following all the steps im not able to submit it.
Tom Mosher
il 9 Ott 2020
If you have problems with the course assignments, please post on the course Discussion Forum - not here.
kapil vaishnav
il 16 Ago 2021
0 voti
Submission failed: unexpected error: Unrecognized field name "assignmentSlug".
how to solve this?
3 Commenti
Mili Kian
il 21 Gen 2022
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.
Shreyas
il 13 Ott 2022
I have the same problem, is there any fix ?
Categorie
Scopri di più su Startup and Shutdown in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!