0

我有一个这种形状的数据库: (1400000, 44)

输出第 44 列。

所有数字都是浮点数,介于 0 和 1 之间。我使用了如下所示的 Tensorflow,但损失函数为非且 acc 为零。

# Create network with Keras
import tensorflow as tf
from keras.models import Sequential
from keras.layers import Dense
import numpy as np

dataset=np.loadtxt("Dataset5.txt")


s=dataset.size
tr_size=int( 0.7*s) 

X = dataset[0:tr_size,0:43]

Y = dataset[0:tr_size,43]

# create model
model = Sequential()
model.add(Dense(64, input_dim=43, init='uniform', activation='relu'))
model.add(Dense(16, init='uniform', activation='relu'))
model.add(Dense(4, init='uniform', activation='sigmoid'))
model.add(Dense(1, init='uniform', activation='relu'))
# Compile model

model.compile(loss='mean_squared_error', optimizer='adam', metrics=['accuracy'])
# Fit the model
model.fit(X, Y, epochs=150, batch_size=1000,  verbose=2)
# calculate predictions
predictions = model.predict(X)
4

0 回答 0