书里对训练数据和测试数据做z-score归一化的时候,测试数据用的训练数据的均值和标准差,我以为书写错了,其实后面还有一句话是这样的:注意,用于测试数据的均值和标准差都是在训练集上计算得到的,在工作流程中,你不能使用在测试集上得到的任何结果,即使是像数据标准化这么简单的事情也不行。
意思是测试集是十分未知的,里面的信息都是不可用的。
我觉得这种思想十分重要的呀~
向模型添加层时,常常不知道input_shape怎么定义,keras文档中是这样写的:Use the keyword argument input_shape (tuple of integers, does not include the samples axis) when using this layer as the first layer in a model.第一层网络的input_shape不需要定义批量轴(samples,或成为样本轴,样本维度)。
常见的数据张量的shape:
向量数据:2D张量,shape为(samples, features)
时间序列数据或序列数据:3D张量,shape为(samples, timesteps, features)
图像:4D张量,shape为(samples, height, width, channels)或(samples, channels, height, width)
视频:5D张量,shape为(samples, frames, height, width, channel)