我想创建一个完全适合我的样本的神经网络,但是在某些时候学习过程会停止。像adam或sgd这样的不同优化器也不起作用。
Cybenko证明了标题中的声明对于任何sigmoidal函数都是正确的,因为我想使用sigmoid或tanh。我还想保留一个隐藏层。
我可以使用哪些调整?这是我的设置(python3)和结果:
features = np.linspace(-0.5,.5,2000).reshape(2000,1)
target = np.sin(12*features)
hn = 100
nn = models.Sequential()
#Only one hidden layer
nn.add(layers.Dense(units=hn, activation='sigmoid',
input_shape=(features.shape[1],)))
nn.add(layers.Dense(units=1, activation='linear'))
# Compile neural network
nn.compile(loss='mse',
optimizer='RMSprop',
metrics=['mse'])
nn.fit(features,
target,
epochs=200,
verbose=2,
batch_size=5)