如何为LSTM塑造多个次温度数据

我有30个不同时间序列的数据帧,这些数据帧具有相同的特征大小(6),但不同的时间序列长度(> 500000)。每个数据帧都有一个必须预测的ID。这应该是一个回归问题。即使我没有ID 5的时间序列(总共1500个ID),网络也应该输出接近真实ID的ID。

我希望神经网络学习一个ID的时间序列,然后继续下一个ID。 为了进行预测,我想输入一个较小的时间,神经网络应该输出一个ID。

seed = 11
np.random.seed(seed)

import_new_Data = True
if import_new_Data:
    csv_files = glob.glob('/home/lta-user/PycharmProjects/regression/Testdaten_2/*.csv')
    list_data = []
    label_list = []

    sum = 0
    ##import the datasets and concat them to one dataset
    for path in csv_files:
        dta = dta.read_sets(path)
        list_data.append(dta)

    df = pd.concat(list_data,ignore_index=True)  # concat the data to one DataFrame



labels = df.pop(df.columns[len(df.columns)-1])
labels = labels.values
df = df.values


#the data is normalized in a range from 0 to 1
scaler = MinmaxScaler(feature_range=(-1,1))
df = scaler.fit_transform(df)

df = df.reshape(1,df.shape[0],df.shape[1])


normed_train_data,normed_test_data,train_labels,test_labels = model_selection.train_test_split(df,labels,train_size=0.75,test_size=0.25,random_state=seed)


#----------------------------------------------------------------------------------------------------------------------
#building the model
#----------------------------------------------------------------------------------------------------------------------

def build_model():
  model = keras.Sequential([
    #Creating a fully connected layer
    #1. Hidden-Layer: Fully connected with ReLu as activation function
    layers.LSTM(12,activation='relu',input_shape = (?,?,?),return_sequences=True),#Output-Layer: Fully connected with an linear activation function
    layers.Dense(1,kernel_initializer='normal',activation='linear')
  ])

  #Choosing the Adam-Optimizer with an learning rate of 0.001
  optimizer = tf.keras.optimizers.Adam(0.001)

  model.compile(loss='mean_squared_error',optimizer=optimizer,metrics=['mean_absolute_error','mean_squared_error'])
  return model

#create network
model = build_model()

model.summary()        #prints a description of the model

##----------------------------------------------------------------------------------------------------------------------
tangdandang 回答:如何为LSTM塑造多个次温度数据

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3166445.html

大家都在问