Как удалить элементы в nd.array? - PullRequest
0 голосов
/ 23 мая 2019

Я новичок в CNN (текст)

У меня 2 ndarray с 3 размерами.

Я хочу изменить элементы train_input.shape[1] = 137 на 100.

Однако, когда я ставлю 100 вместо элементов train_input.shape[1] = 137, возникает ошибка.

Как работать?

from sklearn.model_selection import train_test_split


test_data_size = count_test
train_data_size = count_train
print(train_data_size,'',test_data_size)


train_input = title_vector_arr[0:train_data_size]
train_label = ctr_class_arr[0:train_data_size]
test_input = title_vector_arr[train_data_size:]
test_label = ctr_class_arr[train_data_size:]
train_input = np.array(train_input)
train_input = train_input.reshape(train_input.shape[0], #6307
                                 train_input.shape[1], #137 
                                 VECTOR_SIZE) #300


test_input = np.array(test_input)
test_input = test_input.reshape(test_input.shape[0], #1000
                                 test_input.shape[1], #137
                                 VECTOR_SIZE) #300
train_input = np.array(train_input)
train_input = train_input.reshape(train_input.shape[0],100, VECTOR_SIZE)
test_input = np.array(test_input)
test_input = test_input.reshape(test_input.shape[0],100, VECTOR_SIZE)
---------------------------------------------------------------------------
MemoryError                               Traceback (most recent call last)
<ipython-input-63-d4d85efe9179> in <module>
----> 1 train_input = np.array(train_input)
      2 train_input = train_input.reshape(train_input.shape[0],100, VECTOR_SIZE)
      3 test_input = np.array(test_input)
      4 test_input = test_input.reshape(test_input.shape[0],100, VECTOR_SIZE)

MemoryError:
...