Closed rmh1480 closed 4 years ago
You should change line 39 of main.py file to bow_train, bow_test, y_train, y_test = train_test_split(bow_data, y)
Same error after changing line 39 to: bow_train, bow_test, y_train, y_test = train_test_split(bow_data, y)
Traceback (most recent call last):
File "./main.py", line 67, in
You might also need to change the knn_classifier.py line 25
doc_to_train = [method(doc, x, C) for x in X_train.T]
->
doc_to_train = [method(doc, x, C) for x in X_train]
By the way, hott(p, q, C, threshold=None)
has a problem, so you can use the def hoftt(p, q, C)
model first.
Hi all,
Thanks for pointing out the bugs. I've revised the code. All methods seem to run correctly now. Please let me know if you encounter any further issues.
Best, Mikhail
Thanks Mikhail for fixing this issue, it is working now.
Best, Raja
Hi,
After running main.py, I get the following error:
Traceback (most recent call last): File "./main.py", line 67, in
test_error = knn(X_train, X_test, y_train, y_test, methods[method], C, n_neighbors=7)
File "HOTT/knn_classifier.py", line 25, in knn
doc_to_train = [method(doc, x, C) for x in X_train.T]
File "HOTT/knn_classifier.py", line 25, in
doc_to_train = [method(doc, x, C) for x in X_train.T]
File "HOTT/hott.py", line 11, in hott
C_reduced = C[id_p][:, id_q]
IndexError: boolean index did not match indexed array along dimension 1; dimension is 70 but corresponding boolean dimension is 552
Any pointers on how to resolve this issue are appreciated. Best, Raja