Hello there,
I have completed the missing code, but upon submission, I am getting the error
There was an error grading your submission. Details:
B must be a column vector.
Can anyone help me please?
{moderator edit - solution code removed}
Hello there,
I have completed the missing code, but upon submission, I am getting the error
There was an error grading your submission. Details:
B must be a column vector.
Can anyone help me please?
{moderator edit - solution code removed}
There is no B shown in the code you show. That is just an input value to this function. Are you sure you didn’t modify B.
Also note that we’re not supposed to just publish solution source code. It’s ok to show the error output you get as a way for us to see what is happening. Please show us the error trace you’re actually getting.
Hello @Harish_Ramkumar
Could you share a screenshot of the error you got rather than sharing codes!!!
Or screenshot of the submission grader output where it mentions why you failed the grader.
Regards
DP
Hello @paulinpaloalto
Thanks for your reply. Actually, there is no error with the code. The tests are passed for all 2 exercises. Upon submission, I am getting the validation.
Can you please help me? I am not sure where I am wrong.
Please find the attached screenshots.
Thanks!
Hello @Deepti_Prasad,
Thanks for your reply. Actually, there is no error with the code. The tests are passed for all 3 exercises. Upon submission, I am getting the validation.
Can you please help me? I am not sure where I am wrong.
Please find the attached screenshots.
Thanks!
Please DM those two grade cell codes. Click on my name and then message
Are you sure that you didn’t rename your notebook? If you are working in a copy of the notebook and hit “Submit”, it submits the “official” one: the one opened by the “Launch Lab” link.
If that’s not the problem, the other general point to make is that passing the tests in the notebook does not guarantee your code is fully correct: you could have “non-generality” problems. E.g. referencing global variables from the notebook or “hard-coding” something in your solution that happens to match the values used in the notebook test cases. Deepti will be able to see that type of bug if you share the code with her privately.
@mentors:
There appears to be a typo in the grader feedback.
From my grader report:
There is no “reduced_row_echelon_form()” function in the current version of the notebook, but the grader claims there is (even when I’m using the current version of the course).
I’ll submit an issue for it.
The student also has an error in their code, but that’s the subject of this thread.
That means there is an error in your code. Passing the tests in the notebook does not prove your code is perfect.
Hello @Harish_Ramkumar
Issues with assignment.
You have either edited an obsolete copy of the assignment and/or edited the grader cell. I see you adding grader cell completely by yourself, in which the below code line for if statement is not completely right
If pivot_candidate is zero, it cannot be a pivot for this row.
So the first step you need to take is to look at the rows below it to check if there is a non-zero element in the same column.
The usage of np.isclose is a good practice when comparing two floats.
YOU HAD TO RECALL SAME WAY ROWS JUST THE WAY YOU RECALLED FOR PIVOT CANDIDATE
Then for the below statement
If pivot_candidate is already non-zero, then it is the pivot for this row
YOU HAVE USED else continue which is again incorrect, kindly remove that.
PLEASE REMOVE THE BELOW CODES
def augmented_matrix(A, B):
if B.ndim == 1:
B = B.reshape(-1, 1) # Reshape B into a column vector if it’s a 1D array
elif B.shape[1] != 1 or B.ndim > 2:
raise ValueError(“B must be a column vector.”) # Ensure B is not a multi-dimensional array other than a 2D column vector
if A.shape[0] != B.shape[0]:
raise ValueError(“A and B must have the same number of rows.”)
return np.hstack([A, B])
def swap_rows(M, i, j):
if i == j:
return M
M[[i, j]] = M[[j, i]]
return M
def get_index_first_non_zero_value_from_column(M, start_row, column):
for i in range(start_row, len(M)):
if not np.isclose(M[i, column], 0):
return i
return None
Its better get a fresh copy of assignment and re do the assignment and write codes only where it is asked to do so, between ###START AND END CODE HERE####
Do not edit/add/delete any other part of the codes.
Let me know while doing new copy assignment, if you are encounter same issue.
Regards
DP
Thanks a lot @Deepti_Prasad , @TMosh @paulinpaloalto
I have successfully corrected my code and passed the Assignment.
Note that the issue I reported earlier (i.e. incorrect function name in the grader output) has been fixed.