+ 1

Binary disorder

Why my code for method 2 doesn't pass all test Cases? There is no different between method 1, 2, 3. Could you please explain me? https://code.sololearn.com/c1ckvyF1NM54/?ref=app

11th May 2023, 3:47 AM
Oliver Pasaribu
30 Respuestas
+ 3
Yes. You right. Correct, no need print(y_true_arr), print(y_pred_arr), y_pred_arr=y_pred_arr.reshape(2,2) and Y_true = y_true_arr.reshape(2,2). I just want to show you the steps.
11th May 2023, 6:59 AM
Oliver Pasaribu
11th May 2023, 1:15 PM
Ashish Soni
+ 2
Interesting, Bob Li. First look at the problem carefuly: there are 3 lines. 1st line or row n,p . n and p represent dimension of matrice, 2,2 or 3,3 in test Cases. 2nd row is a sequence of Binary input combination for list y_true, and 3rd lines is a sequence of Binary input combination for list y_pred. Both y_true and y_pred have equal length, it can be 4, 5,6,7,..n Binary digit delimited by space. So, when we are going to iterate through all list elements (1D list) we simply count from 0-th to (len(y_true)-1)-th element in the list.
11th May 2023, 2:56 PM
Oliver Pasaribu
+ 2
Bob Li. Yes, you right.
12th May 2023, 10:27 PM
Oliver Pasaribu
+ 1
I can't find anything called binary disorder on here, care to share the assignment?
11th May 2023, 4:49 AM
Orin Cook
Orin Cook - avatar
+ 1
Data Science, part classification.
11th May 2023, 4:52 AM
Oliver Pasaribu
+ 1
Not seeing "data science," maybe an app vs website issue? (I'm on app)
11th May 2023, 4:57 AM
Orin Cook
Orin Cook - avatar
+ 1
Confusion matrix. Maybe you're printing too many things? Your solution is so long
11th May 2023, 6:07 AM
Bob_Li
Bob_Li - avatar
+ 1
@Oliver Pasaribu you are assuming the inputs are only len 4. The question only said both inputs are of the same length. if it was longer or shorter than 4, reshape(2,2) would not work. Your code will throw an error at this point. also, you don't need to reshape your data at this point.
11th May 2023, 2:19 PM
Bob_Li
Bob_Li - avatar
+ 1
you are overcomplicating it😁
11th May 2023, 3:14 PM
Bob_Li
Bob_Li - avatar
+ 1
PAUL SANDEEP VAIBHAV he is taking the time to understand what's happening in the code. Which is a good thing. Oliver Pasaribu Understanding the basics is good, as long as you advance from that and not try to code everything from basic principle.
12th May 2023, 10:25 AM
Bob_Li
Bob_Li - avatar
+ 1
Oliver Pasaribu I mean there are more advanced Python libraries and methods you can and should learn about. Think of solving a problem this way: You have a problem. In your current way, you create functions and procedures to solve it using basic np.methods. You are able to solve it, but only after great effort and trial and error. But if you read up and learn other libraries, you might be able to solve the problem in 1 or 2 lines of code. You are doing more with less effort. Did you look at the code using scikit I posted in the comment under your code? The problem can be solved in a code contained inside the print function. It is like having advanced weapons instead of sticks and stones. Would you rather work harder or work smarter?
12th May 2023, 3:00 PM
Bob_Li
Bob_Li - avatar
+ 1
Yup
1st Aug 2023, 12:09 PM
Haider Husain
Haider Husain - avatar
0
??? Sololearn course Data Science. Please look at CAREFULY.
11th May 2023, 6:02 AM
Oliver Pasaribu
0
listen man it definitely 100% doesn't exist in my app, but if you'd really rather just keep repeating yourself than c/p the instructions--which you should be doing anyway when asking for help--I'll gladly stop wasting my time
11th May 2023, 6:17 AM
Orin Cook
Orin Cook - avatar
0
Orin Cook you don't have Python for Data Science? It's an old course and it's also in my app. Try clicking the link. https://www.sololearn.com/Course/data-science/?ref=app
11th May 2023, 6:20 AM
Bob_Li
Bob_Li - avatar
0
I don't know. But you can get it from other sololearn members. You can see what course they have taken. Maybe some course are not available, but you can follow them by open the course that you are interested to learn.
11th May 2023, 6:22 AM
Oliver Pasaribu
0
There might be anything buried in community lessons somewhere, given how disorganized and unsearchable that mess is, but not in the main courses no. If it's an old course, it might've been replaced in a recent purge, and only visible if you had already started it before.
11th May 2023, 6:24 AM
Orin Cook
Orin Cook - avatar
0
Oliver Pasaribu I just used from sklearn.metrics import confusion_matrix and did a flip and transpose.
11th May 2023, 6:27 AM
Bob_Li
Bob_Li - avatar
0
@Bob_Li : yes confusing matrix, can be imported from sklearn. But I try to perform manual calculation to populate each possible combination of y_true (actual) and y_pred(predicting). Since the dimension of confusing matrix is 2x2, or think it if we reshape to single Row 4 columns matrice, then it Will be a 4 possible combinations of 00, 01, 10, 11. But be CAREFUL when chose the position index when populate or accumulate.
11th May 2023, 6:28 AM
Oliver Pasaribu