我有一个批处理生成器,它给出了(500, 1, 12)形状的数据(即对应于(batch size, time steps, features)的数据)。
def batch_generator(batch_size, gen_x,gen_y):
batch_features = np.zeros((batch_size,1, 12))
batch_labels = np.zeros((batch_size,9))
while True:
for i in range(batch_size):
batch_features[i]
我有一个时间序列数据集,它有10000个样本和50个特性,我想使用ConvLSTM进行预测,因为我使用TensorFlow来实现,但是我得到了以下错误:
Input 0 of layer "conv_lstm1d_10" is incompatible with the layer: expected ndim=4, found ndim=3. Full shape received: (None, 1, 10000)
我所做的模型如下
model = tf.keras.models.Sequential(
[
tf.keras.layers.ConvL
我有一个问题,我想用多个时间序列来预测一个时间序列。我的输入是(batch_size, time_steps, features),输出应该是(1, time_steps, features)
我不知道如何平均超过N。
下面是一个虚拟的例子。首先,虚拟数据,其中的输出是200个时间序列的线性函数:
import numpy as np
time = 100
N = 2000
dat = np.zeros((N, time))
for i in range(time):
dat[i,:] = np.sin(list(range(time)))*np.random.normal(size
是否有一个机器学习模型(类似于LSTM或1D-CNN),以两个可变长度的时间序列作为输入,并输出二进制分类(对/假,时间序列是否具有相同的标签)?
因此,数据如下所示
date value label
2020-01-01 2 0 # first input time series
2020-01-02 1 0 # first input time series
2020-01-03 1 0 # first input time series
2020-01-01 3 1 # second input tim
keras.layers.RNN
输入形状三维张量(batch_size,timesteps,input_dim)。
输出形状
if return_state:张量列表。第一个张量是输出。剩下的张量是最后的状态,每个状态都有形状(batch_size,单位)。
如果return_sequences:三维张量与形状(batch_size,时间步骤,单位)。否则,二维张量与形状(batch_size,单位)。
1.我对时间步骤的概念感到困惑。
2.我对如何处理三轴输入的过程感到困惑。
简化代码
import keras
from keras.applications.inception_r
我是Keras的新手,我被这个问题卡住了。我的输入数据集不只是一个Pandas Dataframe,而是一个列表。我尝试用Dense来实现,但我收到了这个错误:
When checking model input: the list of numpy arrays that you are passing to your model is not the size the model expected. Expected to see 1 array(s) but instead got the following list of 546 arrays: ......
Keras是否能够接收作
首先,我对神经网络和Keras非常陌生。
我试图用Keras创建一个简单的神经网络,其中输入是一个时间序列,输出是另一个相同长度的时间序列(一维向量)。
我制作了虚拟代码,使用Conv1D层创建随机输入和输出时间序列。然后,Conv1D层输出6个不同的时间序列(因为我有6个过滤器),下一个层我定义了将所有6个输出添加到一个输出到整个网络中。
import numpy as np
import tensorflow as tf
from tensorflow.python.keras.models import Model
from tensorflow.python.keras.layers
我试图使用带有TensorFlow后端的Keras系列地堆叠一些RNN。我可以用一个SimpleRNN层创建一个模型,但是当我尝试添加第二个SimpleRNN层时,我无法确定适当的输入大小。
from keras import models
from keras.layers.recurrent import SimpleRNN
from keras.layers import Activation
model = models.Sequential()
hidden_units = 256
skeleton_dimensions = 3 * 16 # 3 dimensions for
我正在尝试对一些时间序列集运行RNN/LSTM网络。值得一提的是,时间序列正在被分类。我有大约600个不同的时间序列,每个序列都有930个带有特征的时间步长。我已经将我的数据组织成一个numpy 3D数组,它的结构如下:
X = [666 observations/series, 930 timesteps in each observation, 15 features]
Y = [666 observations/series, 930 timesteps in each observation, 2 features]
对于训练和验证数据,我将数据分成70/30。所以Train_X =4
我正在做一个虚拟的例子来理解LSTM是如何使用Keras工作的。我在重塑数据输入和输出的方式上有问题。
ValueError:输入0与层循环不兼容:需要的是ndim=3,找到的是ndim=2
import random
import numpy as np
from keras.layers import Input, LSTM, Dense
from keras.layers.wrappers import TimeDistributed
from keras.models import Model
def gen_number():
return np.random.choic