Beta
Weird matrix multiplication
Loading description...
Fundamentals
NumPy
Matrix
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
*****
mark a call to my function, then I print A, B and output:Thanks for the feedback, I will checke everything again tomorrow :)
(note: I meant "double assertions", like in the above, there asre two calls with the same inputs)
I fixed both issues: there are no more double calls in random tests as well as there are no more mistakes there (caused by generating 0-shape matrices).
Also I have changed the description and the solution: now if warrior tries to pass wrong- or 0-shaped matrices, function should return None.
Almost good! Still
23 problems, though:Test.it
decorator for the random tests instead of theTest.describe
oneI encounter that error:
Unexpected exception raised
Seems to me your B input is not valid ;)
Hi!
test.assert_equals(weird_mul(A, C), None, 'Should return None in case of 1d input')
Again, if the output is 2d numpy array assertion throws an error
all good!
Thanks for your feedback :)
the assertions are still done the wrong way: you're using
assert_equals
exactly in the manner ofexpect
!so, absolutely not that:
but that instead:
I have used decorators, fixed the input from A = [2] to A = [[2]], but...
I can't use
test.assert_equals(weird_mul(A, B), AB)
I've got an error:
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
Mmmmh... :/
Seems related to the fact I know almost shit to numpy. The assertion worked in the trainer, on my side. I return a basic
np.array([...])
instance.It works with 1d arrays, but not with 2d arrays.
you didn't add the new sample tests to the full test suite
and I believe you should change the way you test for the edge cases:
an empty numpy array should pass (EDIT: errr... Or are you actually expecting
[[]]
? x) -> told you, I know shit to numpty x) ).Note: why the hell are there more than 3500 tests!??? Moreover, it seems you do a lot of tests in the same output, that's weird.
And I still get that:
Unexpected exception raised
well ok, ignore the message above, I'm resolving that part: with the 'almost correct" code, the assertion works. But that means that users will have A LOT of problems trying to achieve the task, since they'll get tones of error messages as long as they don't do the "correct" stuff. And that means you'll have a lot of issues raised here...
see the new one at the top, now. ;)
Not enough fixed/sample tests:
and your
Check resulting shape
test fails without saying anything about what's encountered and moreover what is expected.This comment has been hidden.
I have done more examples and tried to described 'edge_classes' example in the description
A=[2]
? Shouldn't it beA=[[2]]
?Like the following:
Hi,
Well... don't EVER use
Test.expect
if you do no provide a meaningful error message:'Array does not have correct value'
without telling what is the expected output, without saying what are the input either (that part isn't mandatory) is not meaningful.All the same, the way you do the checks is plainly wrong. Try this:
Meaning that most of the time, the tests won't even run if the solution isn't correct.
CCL: do the checks in a "normal manner": use
test.assert_equals
.proof:
And what am I supposed to do with the edge cases if I don't know what you expect?
Thanks for your comment! This is my first Kata, so I will try to change everything accordingly.
gift for you:
I have tried new python test framework, but the decorators (@describe) are not working. I receive an error message "name 'describe is not found"
Thanks for your feed back again. I have fixed all the issues.
see above about the decorators (they work pretty fine. ;) )