在做CNN文本分类中用于数据预处理,在获得两个经过one_hot处理过的二分类数据集,两种数据以矩阵形式连接,在Tensorflow中:
import numpy as np
引入模块后使用,将矩阵连接,使axis为0(默认也为0)
y = np.concatenate([good, bad], 0)
axis=0时:
good = np.array([[1, 2], [3, 4]])
bad = np.array([5, 6]])
连接后:[[1, 2], [3, 4], [5, 6]]