Computational-Content-Analysis-2020 / frequently-asked-questions-spring

Questions or doubts about organisation/code for Spring 2020 running of Computational Content Analysis.
0 stars 0 forks source link

Question about HW3 #28

Open tianyueniu opened 4 years ago

tianyueniu commented 4 years ago

Dear TAs,

I have a question about hw3. When I try to run the logistic regression part, I am unable to run the line 'print(logistic_l1.score(np.stack(test_data_df['vect'], axis=0), test_data_df['category']))' without raising an error. In my understanding, it is caused by the fact that test_data_df['vect'] actually has different dimension than the previous train_data_df['vect'], because the todense() function created different dense matrices. In that case, is the given code correct? How should I change it to make it work?

Thank you so much!

bhargavvader commented 4 years ago

Hello @tianyueniu , ideally just running the same todense() functions on both train and test. But I don't see this error when I run the notebook on my machine: I have now uploaded a new version of HW3 with all the cells run until Section 3, and it runs fine... could you maybe try and pull the latest HW, try it again, and tell me if you get the same error?

tianyueniu commented 4 years ago

Thank you so much @bhargavvader The updated notebook is working fine now!