所以我开始为model.fit函数构建一个新的Thread。我的问题开始了: 是否可以在不提供数据的情况下学习 示例代码:
def game(model, X, Y):
pred = model.predict(X)[0]
return np.mean(np.abs(Y-pred))
model = Sequential()
model.add(Dense(40, input_shape=(2,)))
model.add(Dense(1, activation='linear'))
model.compile(loss="mse", optimizer="adam")
X = np.array([[3,6], [8,9], [4,5], [1,8], [20,15]])
Y = np.array([[10],[18],[10],[10], [36]])
for i in range(1,500):
testData = np.array([[0 ,0]])
loss = game (model, X, Y)
pred = model.predict(testData)[0][0]
_y = np.array([pred+loss])
model.fit(testData, _y, batch_size=1)