我是Python新手。我按照这个网站作为指导来进行一些未来的预测。完成所有操作后,图表没有显示,并且出现以下错误:2020-10-09 08:27:09.619051: W tensorflow/stream_executor/platform/default/dso_loader.cc:59] Could not load dynamic library 'cudart64_101.dll'; dlerror: cudart64_101.dll not found2020-10-09 08:27:09.620905: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.这是我写的代码:import pandas as pdimport numpy as npimport tensorflow as tfimport kerasfrom keras.preprocessing.sequence import TimeseriesGeneratorfrom keras.models import Sequentialfrom keras.layers import LSTM, Denseimport plotly.graph_objects as godf = pd.read_excel('T:/Python/NRN-Netze_Python/Stromverbrauch2Jahren.xlsx')print(df.info())df['Datum'] = pd.to_datetime(df['Datum'])df.set_axis(df['Datum'], inplace = True)df.drop(columns = ['Datum_u_Uhrzeit', 'Stunden', 'Minuten', 'Uhrzeit'], inplace = True)value = df['Werte'].valuesvalue = value.reshape((-1, 1))split_percent = 0.80split = int(split_percent * len(value))value_train = value[:split]value_test = value[split:]date_train = df['Datum'][:split]date_test = df['Datum'][split:]print('')print(len(value_train))print(len(value_test))look_back = 15train_generator = TimeseriesGenerator(value_train, value_train, length = look_back, batch_size = 20)test_generator = TimeseriesGenerator(value_test, value_test, length = look_back, batch_size = 1)model = Sequential()model.add(LSTM(10, activation = 'relu', input_shape = (look_back, 1)))model.add(Dense(1))model.compile(optimizer = 'adam', loss = 'mse')num_epochs = 25model.fit(train_generator, epochs = num_epochs, verbose = 1)prediction = model.predict(test_generator)value_train = value_train.reshape((-1))value_test = value_test.reshape((-1))prediction = prediction.reshape((-1))trace1 = go.Scatter( x = date_train, y = value_train, mode = 'lines', name = 'Original')
添加回答
举报
0/150
提交
取消