Keras的Dense
层需要指定input_dim
或者input_shape
。那么我应该填什么值呢?
我的输入是一个100万行,只有3列的矩阵。输出是1600个类别。
我应该填哪个值呢?
输入数据的维度为
(1000000, 3)
2
,因为它是一个二维矩阵
Keras的Dense
层需要指定input_dim
或者input_shape
。那么我应该填什么值呢?
我的输入是一个100万行,只有3列的矩阵。输出是1600个类别。
我应该填哪个值呢?
输入数据的维度为(1000000, 3)
2
,因为它是一个二维矩阵
input_dim
是特征的维度数量,你的情况下只有3个。相应的符号表示为 input_shape
,它是实际的维度形状,为 (3,)
x.shape
(1000000, 3)
y.shape
((1000000, 1600)
# as first layer in a sequential model:
model = Sequential()
model.add(Dense(32, input_shape=x.shape[1])) # Input layer
# now the model will take as input arrays of shape (*, 3)
# and output arrays of shape (*, 32)
...
...
model.add(Dense(y.shape[1],activation='softmax')) # Output layer
y.shape[1]= 1600,这是输出的数量,也就是你所处理的分类数目,因为你在进行分类任务。
X = dataset.iloc[:, 3:13]
X
参数包含所有行和第3列到第12列(含)以及第13列(不含)。我们还将提供一个X0
参数给神经网络,总共有。
input layers becomes 10+1 = 11.
Dense(input_dim = 11, activation = 'relu', kernel_initializer = 'he_uniform')
(3,)
пЉМеИЩзїіеЇ¶жХ∞дЄЇ1
гАВдЊЛе¶ВпЉЪa = numpy.array([1,2,3])
вЖТa.shape == (3,)
пЉМa.ndim == 1
гАВ - endolith