不兼容的行尺寸

时间:2019-08-23 03:21:47

标签: python-3.x hstack

i am getting incompatible row dimensions, while i am trying to put feature under hstack function. The dimensions of, tfidf and average word 2 vector of a test data matrix  of an 'essay' feature, is (3300,300).The dimensions of one hot encoding of test of a datamatrix of 'school state' feature is (3300, 51).The dimensions of one hot encoding of test of a datamatrix of 'teacher prefix' feature is (3300, 4).The dimensions of one hot encoding of test of a datamatrix of 'project grade category' feature is (3300, 4).The dimensions of normalization of numerical value of a test  datamatrix of 'price' feature is (3300, 1).
when i am trying to put all features under hstack() function and after assigining this function to a variable, when i am printing shape of that variable, i am getting error, due to incompatibility of row dimensions.

i am writing code on jupyter platform.



       x_te4 = hstack((x_test_state_ohe,x_test_teacher_ohe,x_test_grade_ohe,x_test_price_norm,tfidf_w2v_vectors_X_test_essay)).tocsr()

print(x_te4.shape,y_te.shape)

ValueError                                
----> 3 x_te4 = hstack((x_test_state_ohe,x_test_teacher_ohe,x_test_grade_ohe,x_test_price_norm,tfidf_w2v_vectors_X_test_essay)).tocsr()


ValueError: blocks[0,:] has incompatible row dimensions. Got blocks[0,4].shape[0] == 5511, expected 3300.

我在此代码上遇到错误

0 个答案:

没有答案