Movatterモバイル変換


[0]ホーム

URL:


CN116822722A - Water level prediction methods, systems, devices, electronic equipment and media - Google Patents

Water level prediction methods, systems, devices, electronic equipment and media
Download PDF

Info

Publication number
CN116822722A
CN116822722ACN202310672834.6ACN202310672834ACN116822722ACN 116822722 ACN116822722 ACN 116822722ACN 202310672834 ACN202310672834 ACN 202310672834ACN 116822722 ACN116822722 ACN 116822722A
Authority
CN
China
Prior art keywords
water level
data
preliminary
predicted
impact
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310672834.6A
Other languages
Chinese (zh)
Inventor
吕海峰
冀肖榆
黄宏本
袁玉萍
李连芬
涂井先
卢雪燕
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Wuzhou University
Original Assignee
Wuzhou University
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Wuzhou UniversityfiledCriticalWuzhou University
Priority to CN202310672834.6ApriorityCriticalpatent/CN116822722A/en
Publication of CN116822722ApublicationCriticalpatent/CN116822722A/en
Pendinglegal-statusCriticalCurrent

Links

Classifications

Landscapes

Abstract

The embodiment of the application provides a water level prediction method, a system, a device, electronic equipment and a medium, and belongs to the technical field of artificial intelligence. The method comprises the following steps: acquiring sample influence data of a water level station to be predicted; the sample influence data comprise sample historical water level data of a water level station to be predicted and sample warehouse-out flow of a preset ship lock; preprocessing sample influence data to obtain preliminary influence data; constructing preliminary water level influence data and preliminary water level data according to the preliminary influence data; inputting the preliminary water level influence data into a preset original water level prediction model to perform water level prediction to obtain predicted water level data; model training is carried out on the original water level prediction model according to the predicted water level data and the preliminary water level data, and a target water level prediction model is obtained; acquiring target water level influence data of a water level station to be predicted; and carrying out water level prediction on the target water level influence data according to the target water level prediction model. The embodiment of the application can improve the accuracy of water level prediction.

Description

Translated fromChinese
水位预测方法、系统、装置、电子设备及介质Water level prediction methods, systems, devices, electronic equipment and media

技术领域Technical field

本申请涉及人工智能技术领域,尤其涉及一种水位预测方法、系统、装置、电子设备及介质。This application relates to the field of artificial intelligence technology, and in particular to a water level prediction method, system, device, electronic equipment and medium.

背景技术Background technique

目前,水位预测对流域安全和水资源合理调度具有重要意义。相关技术中,通过机器学习、数据挖掘和深度学习等方式进行水位预测,但相关技术中的水位预测方法针对单因素时间序列处理,即只考虑将水位作为输入变量。当待预测流域存在波动性、季节性等特点时,上述方法会影响水位预测的准确性。因此,如何提供一种水位预测方法,以提高水位预测的准确性成了亟待解决的技术问题。At present, water level prediction is of great significance to watershed safety and rational allocation of water resources. In related technologies, water level prediction is performed through methods such as machine learning, data mining, and deep learning. However, the water level prediction methods in related technologies deal with single-factor time series, that is, only water level is considered as an input variable. When the watershed to be predicted has characteristics such as volatility and seasonality, the above method will affect the accuracy of water level prediction. Therefore, how to provide a water level prediction method to improve the accuracy of water level prediction has become an urgent technical problem to be solved.

发明内容Contents of the invention

本申请实施例的主要目的在于提出一种水位预测方法、系统、装置、电子设备及介质,旨在提高水位预测的准确性。The main purpose of the embodiments of this application is to propose a water level prediction method, system, device, electronic device and medium, aiming to improve the accuracy of water level prediction.

为实现上述目的,本申请实施例的第一方面提出了一种水位预测方法,所述方法包括:In order to achieve the above purpose, the first aspect of the embodiment of the present application proposes a water level prediction method, which method includes:

获取待预测水位站的样本影响数据;其中,所述样本影响数据包括所述待预测水位站的样本历史水位数据、预设船闸的样本出库流量;Obtain the sample impact data of the water level station to be predicted; wherein the sample impact data includes the sample historical water level data of the water level station to be predicted and the sample outflow flow of the preset ship lock;

对所述样本影响数据进行预处理,得到初步影响数据;Preprocess the sample impact data to obtain preliminary impact data;

根据所述初步影响数据构建初步水位影响数据和初步水位数据;Construct preliminary water level impact data and preliminary water level data based on the preliminary impact data;

将所述初步水位影响数据输入至预设的原始水位预测模型进行水位预测,得到预测水位数据;Input the preliminary water level impact data into the preset original water level prediction model to perform water level prediction to obtain predicted water level data;

根据所述预测水位数据和所述初步水位数据对所述原始水位预测模型进行模型训练,得到目标水位预测模型;Perform model training on the original water level prediction model according to the predicted water level data and the preliminary water level data to obtain a target water level prediction model;

获取所述待预测水位站的目标水位影响数据;其中,所述目标水位影响数据包括所述待预测水位站的目标历史水位数据、所述预设船闸的目标出库流量;Obtain the target water level impact data of the water level station to be predicted; wherein the target water level impact data includes the target historical water level data of the water level station to be predicted and the target outflow flow of the preset ship lock;

根据所述目标水位预测模型对所述目标水位影响数据进行水位预测。Water level prediction is performed on the target water level impact data according to the target water level prediction model.

在一些实施例,所述对所述样本影响数据进行预处理,得到初步影响数据,包括:In some embodiments, preprocessing the sample impact data to obtain preliminary impact data includes:

对所述样本影响数据进行缺失数据处理,得到完整影响数据;Perform missing data processing on the sample impact data to obtain complete impact data;

获取所述完整影响数据的采样时间、所述预设船闸与所述待测水位站之间的水流耗时;The sampling time to obtain the complete impact data and the water flow time between the preset ship lock and the water level station to be measured;

根据所述采样时间、所述水流耗时对所述完整影响数据进行时间对齐处理,得到对齐影响数据;Perform time alignment processing on the complete impact data according to the sampling time and the water flow time consumption to obtain aligned impact data;

对所述对齐影响数据进行归一化处理,得到初步影响数据。The alignment impact data is normalized to obtain preliminary impact data.

在一些实施例,所述根据所述初步影响数据构建初步水位影响数据和初步水位数据,包括:In some embodiments, constructing preliminary water level impact data and preliminary water level data based on the preliminary impact data includes:

根据预设的参考采样时间对初步影响数据进行数据划分,得到第一影响数据和第二影响数据;Divide the preliminary impact data according to the preset reference sampling time to obtain the first impact data and the second impact data;

根据预设的采样时长对所述第一影响数据进行数据筛选,得到所述初步水位影响数据;Perform data screening on the first impact data according to the preset sampling duration to obtain the preliminary water level impact data;

根据预设的预测时间间隔对所述第二影响数据进行数据筛选,得到所述初步水位数据。The second impact data is filtered according to a preset prediction time interval to obtain the preliminary water level data.

在一些实施例,所述原始水位预测模型包括第一水位预测组件和第二水位预测组件,所述将所述初步水位影响数据输入至预设的原始水位预测模型进行水位预测,得到预测水位数据,包括:In some embodiments, the original water level prediction model includes a first water level prediction component and a second water level prediction component. The preliminary water level impact data is input into a preset original water level prediction model to perform water level prediction to obtain predicted water level data. ,include:

根据预设权值对所述初步水位影响数据进行权重处理,得到加权影响数据;Perform weight processing on the preliminary water level impact data according to the preset weight value to obtain weighted impact data;

根据所述第一水位预测组件对所述加权影响数据进行水位预测,得到第一水位数据;Perform water level prediction on the weighted influence data according to the first water level prediction component to obtain first water level data;

根据所述第二水位预测组件对所述初步水位影响数据进行水位预测,得到第二水位数据;Perform water level prediction on the preliminary water level impact data according to the second water level prediction component to obtain second water level data;

根据所述第一水位数据和所述第二水位数据得到所述预测水位数据。The predicted water level data is obtained according to the first water level data and the second water level data.

在一些实施例,所述第一水位预测组件包括卷积层、循环注意力层、循环跳跃层和全连接层,所述根据所述第一水位预测组件对所述加权影响数据进行水位预测,得到第一水位数据,包括:In some embodiments, the first water level prediction component includes a convolutional layer, a cyclic attention layer, a cyclic skip layer and a fully connected layer, and the water level prediction is performed on the weighted influence data according to the first water level prediction component, Get the first water level data, including:

根据所述卷积层对所述加权影响数据进行特征提取,得到水位影响向量;Perform feature extraction on the weighted influence data according to the convolution layer to obtain a water level influence vector;

根据所述循环注意力层对所述水位影响向量进行循环权重处理和注意力处理,得到加权影响向量;Perform cyclic weight processing and attention processing on the water level influence vector according to the cyclic attention layer to obtain a weighted influence vector;

根据所述循环跳跃层对所述水位影响向量进行跳跃特征提取,得到隐藏影响向量;Perform jump feature extraction on the water level influence vector according to the cyclic jump layer to obtain a hidden influence vector;

根据所述全连接层对所述加权影响向量、所述隐藏影响向量进行向量映射,得到所述第一水位数据。Vector mapping is performed on the weighted influence vector and the hidden influence vector according to the fully connected layer to obtain the first water level data.

在一些实施例,所述根据所述预测水位数据和所述初步水位数据对所述原始水位预测模型进行模型训练,得到目标水位预测模型,包括:In some embodiments, performing model training on the original water level prediction model based on the predicted water level data and the preliminary water level data to obtain a target water level prediction model includes:

根据所述预测水位数据和所述初步水位数据对所述原始水位预测模型进行模型训练,直至所述原始水位预测模型收敛,得到初步水位预测模型;Perform model training on the original water level prediction model according to the predicted water level data and the preliminary water level data until the original water level prediction model converges to obtain a preliminary water level prediction model;

对所述初步水位预测模型进行模型评估处理,得到模型评估结果;Perform model evaluation processing on the preliminary water level prediction model to obtain model evaluation results;

若所述模型评估结果满足预设评估条件,将所述初步水位预测模型作为所述目标水位预测模型。If the model evaluation result meets the preset evaluation conditions, the preliminary water level prediction model is used as the target water level prediction model.

为实现上述目的,本申请实施例的第二方面提出了一种水位预测系统,所述系统包括:In order to achieve the above object, the second aspect of the embodiment of the present application proposes a water level prediction system, which includes:

数据交换装置,所述数据交换装置包括数据交换模块、主控模块、接口模块,其中,所述数据交换模块分别与所述待预测水位站的数据采集装置、所述预设船闸的数据采集装置通信连接,用于获取样本影响数据;所述主控模块用于对所述样本影响数据进行数据冲突处理和/或数据同步处理;Data exchange device. The data exchange device includes a data exchange module, a main control module, and an interface module. The data exchange module is respectively connected with the data acquisition device of the water level station to be predicted and the data acquisition device of the preset ship lock. Communication connection, used to obtain sample impact data; the main control module is used to perform data conflict processing and/or data synchronization processing on the sample impact data;

水位预测装置,所述水位预测装置用于与所述接口模块通信连接,用于执行如第一方面所述的方法。A water level prediction device, the water level prediction device is used to communicate with the interface module and is used to execute the method as described in the first aspect.

为实现上述目的,本申请实施例的第三方面提出了一种水位预测装置,所述装置包括:In order to achieve the above object, the third aspect of the embodiment of the present application proposes a water level prediction device, which includes:

第一数据获取模块,用于获取待预测水位站的样本影响数据;其中,所述样本影响数据包括所述待预测水位站的样本历史水位数据、预设船闸的样本出库流量;The first data acquisition module is used to obtain the sample impact data of the water level station to be predicted; wherein the sample impact data includes the sample historical water level data of the water level station to be predicted and the sample outflow flow of the preset ship lock;

预处理模块,用于对所述样本影响数据进行预处理,得到初步影响数据;A preprocessing module, used to preprocess the sample impact data to obtain preliminary impact data;

数据构建模块,用于根据所述初步影响数据构建初步水位影响数据和初步水位数据;A data construction module, configured to construct preliminary water level impact data and preliminary water level data based on the preliminary impact data;

第一水位预测模块,用于将所述初步水位影响数据输入至预设的原始水位预测模型进行水位预测,得到预测水位数据;The first water level prediction module is used to input the preliminary water level impact data into the preset original water level prediction model to perform water level prediction and obtain predicted water level data;

模型训练模块,用于根据所述预测水位数据和所述初步水位数据对所述原始水位预测模型进行模型训练,得到目标水位预测模型;A model training module, configured to perform model training on the original water level prediction model based on the predicted water level data and the preliminary water level data to obtain a target water level prediction model;

第二数据获取模块,用于获取所述待预测水位站的目标水位影响数据;其中,所述目标水位影响数据包括所述待预测水位站的目标历史水位数据、所述预设船闸的目标出库流量;The second data acquisition module is used to obtain the target water level impact data of the water level station to be predicted; wherein the target water level impact data includes the target historical water level data of the water level station to be predicted, and the target exit of the preset ship lock. Library flow;

第二水位预测模块,用于根据所述目标水位预测模型对所述目标水位数据进行水位预测。The second water level prediction module is used to predict the water level on the target water level data according to the target water level prediction model.

为实现上述目的,本申请实施例的第四方面提出了一种电子设备,所述电子设备包括存储器和处理器,所述存储器存储有计算机程序,所述处理器执行所述计算机程序时实现上述第一方面所述的方法。In order to achieve the above object, a fourth aspect of the embodiment of the present application proposes an electronic device. The electronic device includes a memory and a processor. The memory stores a computer program. When the processor executes the computer program, the above is implemented. The method described in the first aspect.

为实现上述目的,本申请实施例的第五方面提出了一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,所述计算机程序被处理器执行时实现上述第一方面所述的方法。In order to achieve the above object, the fifth aspect of the embodiment of the present application proposes a computer-readable storage medium. The computer-readable storage medium stores a computer program. When the computer program is executed by a processor, the above-mentioned first aspect is implemented. method described.

本申请提出的水位预测方法、系统、装置、电子设备及介质,其通过待预测水位站的样本历史水位数据、预设船闸的样本出库流量对原始预测模型进行模型训练。由此可知,本申请实施例在进行水位预测时,将样本历史水位数据和样本出库流量作为水位预测的影响因子,减少了相关技术中只考虑将水位作为输入变量对水位预测准确性造成影响的情况。因此,当根据训练得到的目标水位预测模型对待预测水位站进行水位预测时,能够提高水位预测的准确性。The water level prediction method, system, device, electronic equipment and medium proposed in this application performs model training on the original prediction model through sample historical water level data of the water level station to be predicted and sample outflow flow of the preset ship lock. It can be seen from this that when performing water level prediction, the embodiment of the present application uses sample historical water level data and sample outflow flow as influencing factors for water level prediction, which reduces the impact on the accuracy of water level prediction that only considers water level as an input variable in related technologies. Case. Therefore, when water level prediction is performed for the water level station to be predicted based on the trained target water level prediction model, the accuracy of the water level prediction can be improved.

附图说明Description of the drawings

图1是本申请实施例提供的水位预测方法的流程图;Figure 1 is a flow chart of the water level prediction method provided by the embodiment of the present application;

图2是图1中的步骤S102的流程图;Figure 2 is a flow chart of step S102 in Figure 1;

图3是本申请实施例船闸站点水流耗时示意图;Figure 3 is a schematic diagram of the water flow time at the ship lock site according to the embodiment of the present application;

图4是本申请实施例采样时间示意图;Figure 4 is a schematic diagram of the sampling time according to the embodiment of the present application;

图5是图1中的步骤S103的流程图;Figure 5 is a flow chart of step S103 in Figure 1;

图6是本申请实施例初步水位影响数据和初步水位数据的示意图;Figure 6 is a schematic diagram of preliminary water level impact data and preliminary water level data according to the embodiment of the present application;

图7是图1中的步骤S104的流程图;Figure 7 is a flow chart of step S104 in Figure 1;

图8是图7中的步骤S702的流程图;Figure 8 is a flow chart of step S702 in Figure 7;

图9是本申请实施例数据处理过程示意图;Figure 9 is a schematic diagram of the data processing process according to the embodiment of the present application;

图10是图1中的步骤S105的流程图;Figure 10 is a flow chart of step S105 in Figure 1;

图11是本申请实施例提供的水位预测系统的结构示意图;Figure 11 is a schematic structural diagram of the water level prediction system provided by the embodiment of the present application;

图12是本申请实施例数据交互装置的结构示意图;Figure 12 is a schematic structural diagram of a data interaction device according to an embodiment of the present application;

图13是本申请实施例提供的水位预测装置的结构示意图;Figure 13 is a schematic structural diagram of a water level prediction device provided by an embodiment of the present application;

图14是本申请实施例提供的电子设备的硬件结构示意图。Figure 14 is a schematic diagram of the hardware structure of an electronic device provided by an embodiment of the present application.

具体实施方式Detailed ways

为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细说明。应当理解,此处所描述的具体实施例仅用以解释本申请,并不用于限定本申请。In order to make the purpose, technical solutions and advantages of the present application more clear, the present application will be further described in detail below with reference to the drawings and embodiments. It should be understood that the specific embodiments described here are only used to explain the present application and are not used to limit the present application.

需要说明的是,虽然在装置示意图中进行了功能模块划分,在流程图中示出了逻辑顺序,但是在某些情况下,可以以不同于装置中的模块划分,或流程图中的顺序执行所示出或描述的步骤。说明书和权利要求书及上述附图中的术语“第一”、“第二”等是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。It should be noted that although the functional modules are divided in the device schematic diagram and the logical sequence is shown in the flow chart, in some cases, the modules can be divided into different modules in the device or the order in the flow chart can be executed. The steps shown or described. The terms "first", "second", etc. in the description, claims, and above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific sequence or sequence.

除非另有定义,本文所使用的所有的技术和科学术语与属于本申请的技术领域的技术人员通常理解的含义相同。本文中所使用的术语只是为了描述本申请实施例的目的,不是旨在限制本申请。Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the technical field to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of the present application and are not intended to limit the present application.

首先,对本申请中涉及的若干名词进行解析:First, let’s analyze some terms involved in this application:

人工智能(artificial intelligence,AI):是研究、开发用于模拟、延伸和扩展人的智能的理论、方法、技术及应用系统的一门新的技术科学;人工智能是计算机科学的一个分支,人工智能企图了解智能的实质,并生产出一种新的能以人类智能相似的方式做出反应的智能机器,该领域的研究包括机器人、语言识别、图像识别、自然语言处理和专家系统等。人工智能可以对人的意识、思维的信息过程的模拟。人工智能还是利用数字计算机或者数字计算机控制的机器模拟、延伸和扩展人的智能,感知环境、获取知识并使用知识获得最佳结果的理论、方法、技术及应用系统。Artificial intelligence (AI): It is a new technical science that studies and develops theories, methods, technologies and application systems for simulating, extending and expanding human intelligence; artificial intelligence is a branch of computer science, artificial intelligence Intelligence attempts to understand the essence of intelligence and produce a new intelligent machine that can respond in a manner similar to human intelligence. Research in this field includes robotics, language recognition, image recognition, natural language processing, and expert systems. Artificial intelligence can simulate the information process of human consciousness and thinking. Artificial intelligence is also a theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.

精准的水位预测对于流域安全及水资源的合理调度具有重要意义。考虑到流域的水位存在波动性、季节性等众多特点,且影响水位的因素较多,如各个支流的流量、潮汐和降雨量等。多因素作用使得水位规律难以预判,水位预测的难度不言而喻。随着大数据、人工智能等技术的发展,对于水位长时段预测问题,相关技术中存在利用机器学习、数据挖掘以及深度学习进行预测的方法,改进现有水位预测方法和模型的方法。具体地,包括如下两方面:一方面是对水位预测模型构建的时间序列、机器学习、深度学习算法;另一方面是用于提升模型泛化能力的特征抽取算法及模型,且在水位预测方面,主要侧重于单因素时间序列处理,即只考虑将水位作为输入变量。Accurate water level prediction is of great significance to watershed safety and rational dispatch of water resources. Considering that the water level in the basin has many characteristics such as fluctuation and seasonality, and there are many factors that affect the water level, such as the flow, tide and rainfall of each tributary, etc. The action of multiple factors makes it difficult to predict water level patterns, and the difficulty of water level prediction is self-evident. With the development of big data, artificial intelligence and other technologies, for the problem of long-term water level prediction, there are related technologies that use machine learning, data mining and deep learning for prediction, and methods to improve existing water level prediction methods and models. Specifically, it includes the following two aspects: on the one hand, it is the time series, machine learning, and deep learning algorithms for building water level prediction models; on the other hand, it is the feature extraction algorithm and model used to improve the generalization ability of the model, and in terms of water level prediction , mainly focuses on single-factor time series processing, that is, only water level is considered as an input variable.

相关技术中,主要基于以下几种时间序列学习算法进行水位预测领域的模型研究:In related technologies, model research in the field of water level prediction is mainly based on the following time series learning algorithms:

一种是应用十分广泛的时间序列预测模型——基于差分自回归移动平均模型(Autoregressive Integrated Moving Average model,ARIMA)时间序列的水位预测。其核心为非平稳时间序列向平稳时间序列转变,接着以因变量对其误差随机项和滞后值建立回归模型。该模型在处理线性的水文数据时有良好的表现,但该模型仅以水位数据作为输入,忽略其他因素对水位的影响权重。One is a very widely used time series forecast model - water level forecast based on differential autoregressive moving average model (Autoregressive Integrated Moving Average model, ARIMA) time series. Its core is to transform a non-stationary time series into a stationary time series, and then use the dependent variable to establish a regression model for its error random terms and lag values. This model has good performance when processing linear hydrological data, but this model only uses water level data as input and ignores the influence weight of other factors on water level.

另一种是基于神经网络模型的水位预测。常用的神经网络水位预测模型包括有递归神经网络(Recurrent Neural Network,RNN)、卷积神经网络(Convolutional NeuralNetwork,CNN)和人工神经网络(Artificial Neural Network,ANN)。其中ANN也被称为前馈神经网络,一般由输入层、隐藏层和输出层构成,是一个多数神经元互相连接构成且具有适应性的运算模型。每一层由多个激活函数组成的神经元构成,而且神经元间的连接包括对当前信号输出的权重。ANN具有可以学习非线性函数的优点,但也存在容易丢失空间特征的缺点。相关技术中利用ANN构建对某流域平均水位的预测模型,获得了较好预测效果,但不适用于多步预测,尤其在水位关系是非线性条件下其预测误差存在较大波动。在众多智能模型中,卷积神经网络凭借其在图像识别、故障诊断领域的良好表现使其在水位预测领域拥有了巨大的发展潜能,该模型能够从大量数据中学习映射变量和响应变量之间复杂的函数关系,不依靠主观经验设置关键阈值和模型框架。相关技术中将CNN应用于水位时间序列模型的预测,依靠模型的特征提取能力获取长时间序列下的水位预测结果。相比其他模型,卷积神经网络的深层结构有效地提高了预测性能。此外,基于时序建模的深度神经网络方法还包括长短期记忆网络(Long Short-Term Memory,LSTM)。水位影响因子特征的筛选以优化LSTM在水位预测中的准确度,但实验显示,特征筛选阶段引入的误差会在网络传递中被放大,导致最终预测结果的误差偏大。相关技术中利用EMD-LSTM模型将水文数据进行模态分解并单独进行特征预测,接着重组及叠加每个预测以获得水位预测值,但由于LSTM数据传递不能并行计算,对多特征数据敏感度不高,且LSTM无法有效捕捉空间特征或非时间因素对水位产生的影响。为了弥补单一模型的缺陷,相关技术采用CNN-LSTM联合模型实现水位预测,首先利用CNN捕捉输入数据的特征,以缓解LSTM的弱点,该模型在预测精度和时效性均比单一的LSTM模型有明显改善,但上述方法在处理高维数据和复杂模型时仍存在梯度消失、局部最优解等问题。The other is water level prediction based on neural network model. Commonly used neural network water level prediction models include Recurrent Neural Network (RNN), Convolutional Neural Network (CNN) and Artificial Neural Network (ANN). Among them, ANN is also called a feedforward neural network. It is generally composed of an input layer, a hidden layer and an output layer. It is an adaptive computing model composed of a majority of neurons connected to each other. Each layer is composed of neurons composed of multiple activation functions, and the connections between neurons include the weight of the current signal output. ANN has the advantage of being able to learn nonlinear functions, but it also has the disadvantage of easily losing spatial features. In related technology, ANN is used to construct a prediction model for the average water level of a certain watershed, and good prediction results are obtained, but it is not suitable for multi-step prediction, especially when the water level relationship is non-linear, the prediction error has large fluctuations. Among many intelligent models, convolutional neural networks have great development potential in the field of water level prediction due to their good performance in the fields of image recognition and fault diagnosis. This model can learn from a large amount of data between mapping variables and response variables. Complex functional relationships do not rely on subjective experience to set key thresholds and model frameworks. In related technologies, CNN is applied to the prediction of water level time series models, and the water level prediction results in long-term series are obtained by relying on the feature extraction capabilities of the model. Compared with other models, the deep structure of convolutional neural networks effectively improves prediction performance. In addition, deep neural network methods based on time series modeling also include long short-term memory networks (Long Short-Term Memory, LSTM). The water level influencing factor features are screened to optimize the accuracy of LSTM in water level prediction. However, experiments show that the error introduced in the feature screening stage will be amplified during network transmission, resulting in a larger error in the final prediction result. In related technologies, the EMD-LSTM model is used to conduct modal decomposition of hydrological data and perform feature prediction separately, and then reorganize and superimpose each prediction to obtain the water level prediction value. However, since LSTM data transmission cannot be calculated in parallel, it is not sensitive to multi-feature data. High, and LSTM cannot effectively capture the impact of spatial characteristics or non-temporal factors on water levels. In order to make up for the shortcomings of a single model, related technologies use a CNN-LSTM joint model to achieve water level prediction. First, CNN is used to capture the characteristics of the input data to alleviate the weaknesses of LSTM. This model is significantly better than the single LSTM model in terms of prediction accuracy and timeliness. Improved, but the above methods still have problems such as gradient disappearance and local optimal solutions when dealing with high-dimensional data and complex models.

水位站的水位预测模型尤其是在枯水期依然存在经验性模型偏多、模型智能化不足、预报精准度不够等问题。在实际情况中,上下游的水电站的流量及水位相互作用,联合调度发电计划等因素增加了水位预测的难度,复杂的水文条件给水位预测带来了不确定性。以缓解流域船舶滞航问题为目的,预测船舶在枯水期及汛水期何时水位点适合通航,本申请对流域相关站点水位、流量等数据进行采集后通过构建一种新的深度神经网络水位预测模型,即基于CNN-RNN-Attention融合AR模型的多因素水位预测模型,命名为CRANet模型,选取准确性更好的预测模型,为更好地保障船舶能够正常安全通航。The water level prediction model of water level stations, especially during the dry season, still has problems such as too many empirical models, insufficient model intelligence, and insufficient forecast accuracy. In actual situations, the interaction between the flow and water levels of upstream and downstream hydropower stations, joint dispatching power generation plans and other factors increase the difficulty of water level prediction, and complex hydrological conditions bring uncertainty to water level prediction. In order to alleviate the problem of ship stagnation in the basin and predict when the water level of ships is suitable for navigation in the dry season and flood season, this application collects water level, flow and other data from relevant stations in the basin and constructs a new deep neural network water level prediction. The model is a multi-factor water level prediction model based on CNN-RNN-Attention fusion AR model, named CRANet model, and a prediction model with better accuracy is selected to better ensure that ships can navigate normally and safely.

基于此,本申请实施例提供了一种水位预测方法、系统、装置、电子设备及介质,旨在提高水位预测的准确性。Based on this, embodiments of the present application provide a water level prediction method, system, device, electronic device, and medium, aiming to improve the accuracy of water level prediction.

本申请实施例提供的水位预测方法、系统、装置、电子设备及介质,具体通过如下实施例进行说明,首先描述本申请实施例中的水位预测方法。The water level prediction method, system, device, electronic equipment and medium provided by the embodiments of the present application are specifically explained through the following embodiments. First, the water level prediction method in the embodiment of the present application is described.

本申请实施例可以基于人工智能技术对相关的数据进行获取和处理。其中,人工智能(Artificial Intelligence,AI)是利用数字计算机或者数字计算机控制的机器模拟、延伸和扩展人的智能,感知环境、获取知识并使用知识获得最佳结果的理论、方法、技术及应用系统。The embodiments of this application can obtain and process relevant data based on artificial intelligence technology. Among them, artificial intelligence (AI) is the theory, method, technology and application system that uses digital computers or digital computer-controlled machines to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results. .

人工智能基础技术一般包括如传感器、专用人工智能芯片、云计算、分布式存储、大数据处理技术、操作/交互系统、机电一体化等技术。人工智能软件技术主要包括计算机视觉技术、机器人技术、生物识别技术、语音处理技术、自然语言处理技术以及机器学习/深度学习等几大方向。Basic artificial intelligence technologies generally include technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technology, operation/interaction systems, mechatronics and other technologies. Artificial intelligence software technology mainly includes computer vision technology, robotics technology, biometric technology, speech processing technology, natural language processing technology, and machine learning/deep learning.

本申请实施例提供的水位预测方法,涉及水位预测领域和人工智能技术领域。本申请实施例提供的水位预测方法可应用于终端中,也可应用于服务器端中,还可以是运行于终端或服务器端中的软件。在一些实施例中,终端可以是智能手机、平板电脑、笔记本电脑、台式计算机等;服务器端可以配置成独立的物理服务器,也可以配置成多个物理服务器构成的服务器集群或者分布式系统,还可以配置成提供云服务、云数据库、云计算、云函数、云存储、网络服务、云通信、中间件服务、域名服务、安全服务、CDN以及大数据和人工智能平台等基础云计算服务的云服务器;软件可以是实现水位预测方法的应用等,但并不局限于以上形式。The water level prediction method provided by the embodiment of this application relates to the field of water level prediction and the field of artificial intelligence technology. The water level prediction method provided by the embodiment of the present application can be applied in a terminal or a server, or can be software running in a terminal or a server. In some embodiments, the terminal can be a smartphone, a tablet, a laptop, a desktop computer, etc.; the server can be configured as an independent physical server, or as a server cluster or distributed system composed of multiple physical servers. A cloud that can be configured to provide basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. Server; software can be used to implement applications of water level prediction methods, etc., but is not limited to the above forms.

本申请可用于众多通用或专用的计算机系统环境或配置中。例如:个人计算机、服务器计算机、手持设备或便携式设备、平板型设备、多处理器系统、基于微处理器的系统、置顶盒、可编程的消费电子设备、网络PC、小型计算机、大型计算机、包括以上任何系统或设备的分布式计算环境等等。本申请可以在由计算机执行的计算机可执行指令的一般上下文中描述,例如程序模块。一般地,程序模块包括执行特定任务或实现特定抽象数据类型的例程、程序、对象、组件、数据结构等等。也可以在分布式计算环境中实践本申请,在这些分布式计算环境中,由通过通信网络而被连接的远程处理设备来执行任务。在分布式计算环境中,程序模块可以位于包括存储设备在内的本地和远程计算机存储介质中。The application may be used in a variety of general or special purpose computer system environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronics devices, network PCs, minicomputers, mainframe computers, including Distributed computing environment for any of the above systems or devices, etc. The application may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present application may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media including storage devices.

图1是本申请实施例提供的水位预测方法的一个可选的流程图,图1中的方法可以包括但不限于包括步骤S101至步骤S107。Figure 1 is an optional flow chart of the water level prediction method provided by the embodiment of the present application. The method in Figure 1 may include, but is not limited to, steps S101 to S107.

步骤S101,获取待预测水位站的样本影响数据;其中,样本影响数据包括待预测水位站的样本历史水位数据、预设船闸的样本出库流量;Step S101, obtain sample impact data of the water level station to be predicted; wherein the sample impact data includes sample historical water level data of the water level station to be predicted and sample outflow flow of the preset ship lock;

步骤S102,对样本影响数据进行预处理,得到初步影响数据;Step S102, preprocess the sample impact data to obtain preliminary impact data;

步骤S103,根据初步影响数据构建初步水位影响数据和初步水位数据;Step S103, construct preliminary water level impact data and preliminary water level data based on the preliminary impact data;

步骤S104,将初步水位影响数据输入至预设的原始水位预测模型进行水位预测,得到预测水位数据;Step S104, input the preliminary water level impact data into the preset original water level prediction model to perform water level prediction, and obtain predicted water level data;

步骤S105,根据预测水位数据和初步水位数据对原始水位预测模型进行模型训练,得到目标水位预测模型;Step S105, perform model training on the original water level prediction model based on the predicted water level data and preliminary water level data to obtain the target water level prediction model;

步骤S106,获取待预测水位站的目标水位影响数据;其中,目标水位影响数据包括待预测水位站的目标历史水位数据、预设船闸的目标出库流量;Step S106: Obtain the target water level impact data of the water level station to be predicted; wherein the target water level impact data includes the target historical water level data of the water level station to be predicted and the target outflow flow of the preset ship lock;

步骤S107,根据目标水位预测模型对目标水位影响数据进行水位预测。Step S107, perform water level prediction on the target water level impact data according to the target water level prediction model.

本申请实施例所示意的步骤S101至步骤S107,通过待预测水位站的样本历史水位数据、预设船闸的样本出库流量对原始预测模型进行模型训练。由此可知,本申请实施例在进行水位预测时,将样本历史水位数据和样本出库流量作为水位预测的影响因子,减少了相关技术中只考虑将水位作为输入变量对水位预测准确性造成影响的情况。因此,当根据训练得到的目标水位预测模型对待预测水位站进行水位预测时,能够提高水位预测的准确性。Steps S101 to S107 shown in the embodiment of this application are to perform model training on the original prediction model through sample historical water level data of the water level station to be predicted and sample outflow flow of the preset ship lock. It can be seen from this that when performing water level prediction, the embodiment of the present application uses sample historical water level data and sample outflow flow as influencing factors for water level prediction, which reduces the impact on the accuracy of water level prediction that only considers water level as an input variable in related technologies. Case. Therefore, when water level prediction is performed for the water level station to be predicted based on the trained target water level prediction model, the accuracy of the water level prediction can be improved.

在一些实施例的步骤S101中,根据相关数据交换平台的接口获取待预测水位站的样本影响数据,数据交换平台将在下文展开说明。待预测水位站是在待预测流域的水位站,以该待预测水位站的水位作为待预测流域水位的参考。样本影响数据是指对待预测水位站水位产生影响的数据,包括待预测水位站的样本历史水位数据、预设船闸的样本出库流量。其中,预设船闸是指位于待预测水位站上游的船闸站点。In step S101 of some embodiments, the sample impact data of the water level station to be predicted is obtained according to the interface of the relevant data exchange platform. The data exchange platform will be described below. The water level station to be predicted is a water level station in the basin to be predicted, and the water level of the water level station to be predicted is used as a reference for the water level in the basin to be predicted. The sample impact data refers to the data that affects the water level of the water level station to be predicted, including the sample historical water level data of the water level station to be predicted and the sample outflow flow of the preset ship lock. Among them, the preset ship lock refers to the ship lock station located upstream of the water level station to be predicted.

在一些实施例的步骤S102中,为了保证样本影响数据的质量和准确性,使样本影响数据更适合模型的训练,对样本影响数据进行预处理,得到初步影响数据。In step S102 of some embodiments, in order to ensure the quality and accuracy of the sample impact data and make the sample impact data more suitable for model training, the sample impact data is preprocessed to obtain preliminary impact data.

参照图2,在一些实施例中,步骤S102包括但不限于包括步骤S201至步骤S204。Referring to FIG. 2 , in some embodiments, step S102 includes, but is not limited to, steps S201 to S204.

步骤S201,对样本影响数据进行缺失数据处理,得到完整影响数据;Step S201, perform missing data processing on the sample impact data to obtain complete impact data;

步骤S202,获取完整影响数据的采样时间、预设船闸与待测水位站之间的水流耗时;Step S202, obtain the sampling time of the complete impact data and the water flow time between the preset ship lock and the water level station to be measured;

步骤S203,根据采样时间、水流耗时对完整影响数据进行时间对齐处理,得到对齐影响数据;Step S203: Perform time alignment processing on the complete impact data according to the sampling time and water flow time to obtain aligned impact data;

步骤S204,对对齐影响数据进行归一化处理,得到初步影响数据。Step S204: Normalize the alignment impact data to obtain preliminary impact data.

在一些实施例的步骤S201中,由于数据在采样时可能会存在缺失的情况,所以需要对样本影响数据进行缺失数据处理,以保证样本影响数据的完整性。具体地,根据相邻两个采样时刻的数据的平均值对缺失值进行填补。将填补完缺失值的样本影响数据作为完整影响数据。以样本历史水位数据为例,假设每间隔一小时进行一次数据采样,若2020年7月9日2时的水位数据缺失,则对2020年7月9日1时的水位数据和2020年7月9日3时的水位数据进行均值计算,将计算得到的均值作为2020年7月9日2时的水位数据。可以理解的是,除使用均值的方式进行缺失数据处理以为,还可以使用中位数、众数、插值法等,对此本申请实施例不作具体限定。In step S201 of some embodiments, since data may be missing during sampling, missing data processing needs to be performed on the sample impact data to ensure the integrity of the sample impact data. Specifically, missing values are filled based on the average of the data from two adjacent sampling moments. The sample impact data with missing values filled in is regarded as the complete impact data. Taking the sample historical water level data as an example, assuming that data sampling is performed every hour, if the water level data at 2:00 on July 9, 2020 is missing, then the water level data at 1:00 on July 9, 2020 and July 2020 The water level data at 3:00 on the 9th was averaged, and the calculated average was used as the water level data at 2:00 on July 9, 2020. It can be understood that, in addition to using the mean to process missing data, the median, mode, interpolation method, etc. can also be used, which is not specifically limited in the embodiments of the present application.

在一些实施例的步骤S202至步骤S203中,获取完整影响数据的采样时间,由于完整影响数据包括完整的水位数据和完整的出库流量,因此采样时间包括水位数据的水位采样时间、出库流量的流量采样时间。此外,还需获取预设船闸与待测水位站之间的水流耗时,水流耗时是指预设船闸处的出库流量到达待测水位站的耗时。以预设船闸包括A船闸站点、B船闸站点、C船闸站点、D船闸站点为例,获取得到如图3和图4所示的数据。可以理解的是,图4所示的采样时间仅为示例性的。水位数据的单位为m,出库流量的单位为m3/s。由图3可知,A船闸站点的出库流量到达待预测水位站需耗时两小时。因此,2020年7月9日2时待预测水位站的水位数据是受2020年7月9日0时A船闸站点至D船闸站点出库流量的影响。将2020年7月9日0时A船闸站点至D船闸站点出库流量与2020年7月9日2时待预测水位站的水位数据对齐。参照上述举例的方法,对完整影响数据进行时间对齐处理,得到对齐影响数据。In steps S202 to S203 in some embodiments, the sampling time of the complete impact data is obtained. Since the complete impact data includes complete water level data and complete outbound flow rate, the sampling time includes the water level sampling time of the water level data and the outbound flow rate. flow sampling time. In addition, it is also necessary to obtain the water flow time between the preset ship lock and the water level station to be measured. The water flow time consuming refers to the time it takes for the outbound flow at the preset ship lock to reach the water level station to be measured. Taking the preset ship lock including ship lock site A, ship lock site B, ship lock site C, and ship lock D as an example, the data shown in Figures 3 and 4 are obtained. It can be understood that the sampling times shown in Figure 4 are only exemplary. The unit of water level data is m, and the unit of outflow flow is m3 /s. As can be seen from Figure 3, it takes two hours for the outbound flow at ship lock site A to reach the water level station to be predicted. Therefore, the water level data of the water level station to be predicted at 2:00 on July 9, 2020 is affected by the outflow from ship lock station A to D ship lock station at 0:00 on July 9, 2020. Align the outflow from ship lock site A to ship lock site D at 0:00 on July 9, 2020 with the water level data of the water level station to be predicted at 2:00 on July 9, 2020. Referring to the above example method, perform time alignment processing on the complete impact data to obtain aligned impact data.

在一些实施例的步骤S204中,由于对齐影响数据存在不同的单位,如出库流量的单位为m3/s、水位数据的单位为m,数量级差异较大。因此,需要对对齐影响数据进行归一化处理,得到初步影响数据。归一化后的数据(即初步影响数据)有助于原始水位预测模型更好发现每个数据之间的联系,提高模型训练的收敛速度,减少模型的训练时间。具体地,不限于根据如下式(1)对对齐影响数据进行归一化处理。In step S204 of some embodiments, since the alignment impact data has different units, such as the unit of outbound flow rate is m3 /s and the unit of water level data is m, the order of magnitude difference is large. Therefore, it is necessary to normalize the alignment impact data to obtain preliminary impact data. The normalized data (i.e., preliminary impact data) helps the original water level prediction model to better discover the connection between each data, improve the convergence speed of model training, and reduce the training time of the model. Specifically, it is not limited to normalizing the alignment impact data according to the following equation (1).

式(1)中,对齐影响数据x按照最小值中心化后,再按极差(max-min)缩放,数据移动了最小值个单位,初步影响数据x*被收敛至区间[0,1]之间。In formula (1), after the alignment impact data x is centered according to the minimum value, and then scaled according to the range (max-min), the data is moved by the minimum value unit, and the initial impact data x* is converged to the interval [0,1] between.

在一些实施例的步骤S103中,可以理解的是,对于待预测水位站某时刻的水位,既与某时刻之前一定时间范围内的水位数据有关,也与某时刻之前一定时间范围内的出库流量有关。因此,可以对初步影响数据进行数据划分,以构建得到模型的输入变量(即初步水位影响数据,包括某时刻之前一定时间范围内的水位数据和出库流量)和对应的实际情况下的因变量(即初步水位数据,包括在某时刻之后,且与某时刻间隔预设时间间隔的水位数据)。In step S103 of some embodiments, it can be understood that the water level of the water level station to be predicted at a certain time is not only related to the water level data within a certain time range before the certain time, but also related to the water level data within a certain time range before the certain time. Traffic related. Therefore, the preliminary impact data can be divided into data to construct the input variables of the model (i.e., the preliminary water level impact data, including water level data and outflow flow within a certain time range before a certain moment) and the corresponding dependent variables under actual conditions. (That is, preliminary water level data includes water level data after a certain time and at a preset time interval from a certain time).

参照图5,在一些实施例中,步骤S103包括但不限于包括步骤S501至步骤S503。Referring to FIG. 5 , in some embodiments, step S103 includes, but is not limited to, steps S501 to S503.

步骤S501,根据预设的参考采样时间对初步影响数据进行数据划分,得到第一影响数据和第二影响数据;Step S501, divide the preliminary influence data according to the preset reference sampling time to obtain the first influence data and the second influence data;

步骤S502,根据预设的采样时长对第一影响数据进行数据筛选,得到初步水位影响数据;Step S502: Filter the first impact data according to the preset sampling duration to obtain preliminary water level impact data;

步骤S503,根据预设的预测时间间隔对第二影响数据进行数据筛选,得到初步水位数据。Step S503: Filter the second impact data according to the preset prediction time interval to obtain preliminary water level data.

在一些实施例的步骤S501中,根据预设的参考采样时间对初步影响数据进行数据划分,将采样时间为参考采样时间的初步影响数据,以及采样时间在参考采样时间之前的初步影响数据作为第一影响数据。将采样时间在参考采样时间之后的初步影响数据作为第二影响数据。In step S501 of some embodiments, the preliminary impact data is divided according to the preset reference sampling time, and the preliminary impact data whose sampling time is the reference sampling time and the preliminary impact data whose sampling time is before the reference sampling time are used as the third One affects the data. The preliminary impact data with a sampling time after the reference sampling time is used as the second impact data.

在一些实施例的步骤S502中,参照图6,根据采样时长和参考采样时间确定采样时间范围,例如,假设参考采样时间为t时刻、采样时长为q,则采样时间范围为[t-q+1,t]。将采样时间在采样时间范围内的第一影响数据作为初步水位影响数据。也就是说,获取t时刻之前q个时刻的第一影响数据,将这些第一影响数据作为初步水位影响数据。In step S502 of some embodiments, referring to Figure 6, the sampling time range is determined based on the sampling duration and the reference sampling time. For example, assuming that the reference sampling time is time t and the sampling duration is q, the sampling time range is [t-q+ 1,t]. The first impact data within the sampling time range will be used as preliminary water level impact data. That is to say, the first impact data of q moments before time t are obtained, and these first impact data are used as preliminary water level impact data.

在一些实施例的步骤S503中,参照图6,根据预测时间间隔和参考采样时间确定预测时间,根据预测时间从第二影响数据中筛选出对应的水位数据,将筛选出的水位数据作为初步水位数据。例如,假设预测时间间隔为m,则从第二影响数据中筛选出采样时间为t+m时刻的水位数据作为初步水位数据。In step S503 of some embodiments, referring to Figure 6, the prediction time is determined according to the prediction time interval and the reference sampling time, the corresponding water level data is filtered out from the second impact data according to the prediction time, and the filtered water level data is used as the preliminary water level. data. For example, assuming that the prediction time interval is m, the water level data at the sampling time t+m is filtered out from the second influence data as the preliminary water level data.

在一些具体的实施例中,可以取值q=48,m=12,也就是说可以根据当前时刻之前的48个时刻的水位数据、出库流量,预测当前时刻之后第12个时刻待预测水位站的水位数据。In some specific embodiments, the values q=48 and m=12 can be used, which means that the water level to be predicted at the 12th moment after the current moment can be predicted based on the water level data and outbound flow rate 48 moments before the current moment. Station water level data.

在一些实施例的步骤S104中,原始水位预测模型是预先构建的,具有水位预测能力的模型。将初步水位影响数据作为原始水位预测模型的输入数据,通过原始水位预测模型对某时刻待预测水位站的水位进行预测,得到预测水位数据。In step S104 of some embodiments, the original water level prediction model is a pre-built model with water level prediction capabilities. The preliminary water level impact data is used as the input data of the original water level prediction model, and the water level at the water level station to be predicted at a certain time is predicted through the original water level prediction model to obtain the predicted water level data.

参照图7,在一些实施例中,初步水位影响数据包括初步历史水位数据和对应的出库流量,原始水位预测模型包括第一水位预测组件和第二水位预测组件,步骤S104包括但不限于包括步骤S701至步骤S704。Referring to Figure 7, in some embodiments, the preliminary water level impact data includes preliminary historical water level data and corresponding outflow flow, the original water level prediction model includes a first water level prediction component and a second water level prediction component. Step S104 includes but is not limited to including Step S701 to step S704.

步骤S701,根据预设权值对初步水位影响数据进行权重处理,得到加权影响数据;Step S701, perform weight processing on the preliminary water level impact data according to the preset weight value to obtain weighted impact data;

步骤S702,根据第一水位预测组件对加权影响数据进行水位预测,得到第一水位数据;Step S702, perform water level prediction on the weighted influence data according to the first water level prediction component to obtain first water level data;

步骤S703,根据第二水位预测组件对初步水位影响数据进行水位预测,得到第二水位数据;Step S703, perform water level prediction on the preliminary water level impact data according to the second water level prediction component to obtain second water level data;

步骤S704,根据第一水位数据和第二水位数据得到预测水位数据。Step S704: Obtain predicted water level data based on the first water level data and the second water level data.

在一些实施例的步骤S701中,参照图3,预设权值是预先设置的,用于表示对应数据对待预测水位站水位预测的影响程度。可以理解的是,图3所示的预设权值仅为示例性的初始值,在后续的模型训练过程中,该预设权值也会发生变化。根据预设权值对对应的初步水位影响数据进行权重处理,得到加权影响数据。In step S701 of some embodiments, referring to FIG. 3 , the preset weight value is set in advance and is used to represent the degree of influence of the corresponding data on the water level prediction of the to-be-predicted water level station. It can be understood that the preset weight value shown in Figure 3 is only an exemplary initial value, and the preset weight value will also change during the subsequent model training process. The corresponding preliminary water level impact data is weighted according to the preset weight value to obtain weighted impact data.

在一些实施例的步骤S702中,第一水位预测组件是预先设置的,基于神经网络模型结构构建的模型。将加权影响数据作为第一水位预测组件的输入数据,根据第一水位预测组件对加权影响数据进行水位预测,得到第一水位数据In step S702 of some embodiments, the first water level prediction component is a preset model built based on a neural network model structure. Use the weighted influence data as input data of the first water level prediction component, perform water level prediction on the weighted influence data according to the first water level prediction component, and obtain the first water level data.

参照图8,在一些实施例中,第一水位预测组件包括卷积层、循环注意力层、循环跳跃层和全连接层,步骤S702包括但不限于包括步骤S801至步骤S804。Referring to Figure 8, in some embodiments, the first water level prediction component includes a convolutional layer, a recurrent attention layer, a recurrent skip layer and a fully connected layer, and step S702 includes but is not limited to steps S801 to S804.

步骤S801,根据卷积层对加权影响数据进行特征提取,得到水位影响向量;Step S801, perform feature extraction on the weighted influence data according to the convolution layer to obtain the water level influence vector;

步骤S802,根据循环注意力层对水位影响向量进行循环权重处理和注意力处理,得到加权影响向量;Step S802: Perform cyclic weight processing and attention processing on the water level influence vector according to the cyclic attention layer to obtain a weighted influence vector;

步骤S803,根据循环跳跃层对水位影响向量进行跳跃特征提取,得到隐藏影响向量;Step S803, perform jump feature extraction on the water level influence vector according to the cyclic jump layer to obtain a hidden influence vector;

步骤S804,根据全连接层对加权影响向量、隐藏影响向量进行向量映射,得到第一水位数据。Step S804: Perform vector mapping on the weighted influence vector and the hidden influence vector according to the fully connected layer to obtain the first water level data.

需要说明的是,第一水位预测组件包括输入层、CNN卷积层、Recurrent Attention层(即循环注意力层)、Recurrent-skip层(即循环跳跃层)和全连接层。可以理解的是,参照图9,为了在后续操作中能够对训练好的模型进行验证,还可以将初步影响数据划分为训练集和验证集,根据训练集中的数据构建初步水位影响数据和初步水位数据,因此加权影响数据属于训练集。训练集和验证集可以按照数据量8:2的比例进行划分。在训练阶段,可以采用十字交叉法训练数据,将每一组数据集划分为10个子集,保证每一组数据的特征均能被捕捉。具体地,在输入层设置输入数据的格式为x=(batch_size,q,features),也就是说将加权影响数据划分为多个数据维度为(batch_size,q,features)格式的输入数据。batch_size表示批处理大小,q表示时间步数(采样时长),即利用最近q个时刻的加权影响数据作为影响水位的自变量因子,features表示影响水位的因素数量,本申请实施例的多因素分别为待预测水位站的水位数据、A船闸站点的出库流量、B船闸站点的出库流量、C船闸站点的出库流量、D船闸站点的出库流量,因此features=5。下面对CNN卷积层、Recurrent Attention层(即循环注意力层)、Recurrent-skip层(即循环跳跃层)和全连接层进行展开说明。It should be noted that the first water level prediction component includes an input layer, a CNN convolution layer, a Recurrent Attention layer (i.e., a cyclic attention layer), a Recurrent-skip layer (i.e., a cyclic skip layer), and a fully connected layer. It can be understood that, referring to Figure 9, in order to verify the trained model in subsequent operations, the preliminary impact data can also be divided into a training set and a verification set, and preliminary water level impact data and preliminary water level can be constructed based on the data in the training set. data, so the weighted impact data belongs to the training set. The training set and validation set can be divided according to the ratio of data volume 8:2. In the training phase, the cross-cross method can be used to train the data and divide each set of data into 10 subsets to ensure that the characteristics of each set of data can be captured. Specifically, the input data format is set to x=(batch_size, q, features) in the input layer, that is to say, the weighted influence data is divided into multiple input data with data dimensions in the format of (batch_size, q, features). batch_size represents the batch size, q represents the number of time steps (sampling duration), that is, the weighted influence data of the last q moments are used as independent variable factors that affect the water level, and features represent the number of factors that affect the water level. The multiple factors in the embodiment of this application are respectively It is the water level data of the water level station to be predicted, the outbound flow of ship lock site A, the outbound flow of ship lock site B, the outbound flow of ship lock site C, and the outbound flow of ship lock site D, so features=5. The following is an explanation of the CNN convolutional layer, Recurrent Attention layer (i.e. cyclic attention layer), Recurrent-skip layer (i.e. cyclic skip layer) and fully connected layer.

在一些实施例的步骤S801中,卷积层是一个没有池化的卷积神经网络,旨在提取时间维度上的短期模式以及自变量因子之间的局部依赖关系。卷积层包括多个宽度为w和高度为n的卷积核。在本申请实施例中,高度n与影响水位的因素数量features相同。具体地,如下式(2)所示,第k个卷积核扫描输入数据x并得到水位影响向量hkIn step S801 of some embodiments, the convolutional layer is a convolutional neural network without pooling, aiming to extract short-term patterns in the time dimension and local dependencies between independent variable factors. The convolutional layer includes multiple convolution kernels with width w and height n. In the embodiment of this application, the height n is the same as the number of features that affect the water level. Specifically, as shown in the following equation (2), the k-th convolution kernel scans the input data x and obtains the water level influence vector hk .

hk=RELU(Wk*x+bk)......式(2)hk =RELU(Wk *x+bk )...Equation (2)

其中,*表示卷积运算,RELU函数为RELU(x)=max(0,x),通过在输入矩阵(即输入数据)x左侧进行0填充使得水位影响向量hk的长度为q。卷积层的输出矩阵(即水位影响向量)大小为dc×ts,其中dc表示卷积核的数量。Among them, * represents the convolution operation, and the RELU function is RELU(x)=max(0,x). By padding 0 on the left side of the input matrix (ie, input data) x, the length of the water level influence vector hk is q. The size of the output matrix of the convolutional layer (i.e., the water level influence vector) is dc×ts, where dc represents the number of convolution kernels.

在一些实施例的步骤S802中,Recurrent Attention层包括一个带有独立循环长短期记忆网络(Independently Recurrent Long Short Term Memory,IndyLSTM)和注意力机制Attention,并使用tanh函数作为隐藏更新激活函数。其中,IndyLSTM单元用于对水位影响向量进行循环权重处理,注意力机制Attention用于对IndyLSTM单元的输出进行注意力处理。IndyLSTM单元是LSTM的一种变体,与LSTM单元相比,IndyLSTM单元中隐藏层内的每个单元时刻不直接相连,循环权重由全矩阵变换为对角矩阵。即每个IndyLSTM单元的输出和细胞状态仅与输入及其自身的输出和细胞状态有关,而不是输入以及层中所有单元的输出和细胞状态。并且每个IndyLSTM单元的参数数量与隐藏层节点数量呈线性关系,而LSTM则为二次方,因此IndyLSTM单元能够使模型更轻量级。在时间t的循环单元隐藏状态计算如下式(3)至式(8)所示,即循环权重处理如式(3)至式(8)所示。In step S802 of some embodiments, the Recurrent Attention layer includes an Attention with an Independently Recurrent Long Short Term Memory (IndyLSTM) network and an attention mechanism, and uses the tanh function as the hidden update activation function. Among them, the IndyLSTM unit is used to perform cyclic weight processing on the water level influence vector, and the attention mechanism Attention is used to perform attention processing on the output of the IndyLSTM unit. The IndyLSTM unit is a variant of LSTM. Compared with the LSTM unit, each unit in the hidden layer of the IndyLSTM unit is not directly connected at all times, and the cycle weights are transformed from a full matrix to a diagonal matrix. That is, the output and cell state of each IndyLSTM unit are only related to the input and its own output and cell state, rather than the input and the output and cell state of all units in the layer. And the number of parameters of each IndyLSTM unit is linearly related to the number of hidden layer nodes, while LSTM is quadratic, so the IndyLSTM unit can make the model more lightweight. The calculation of the hidden state of the loop unit at time t is as shown in the following formula (3) to formula (8), that is, the loop weight processing is as shown in formula (3) to formula (8).

ft=σ(Wfxt+uf⊙ht-1+bf)......式(3)ft =σ(Wf xt +uf ⊙ht-1 +bf )...Equation (3)

it=σ(Wixt+ui⊙ht-1+bi)......式(4)it =σ(Wi xt +ui ⊙ht-1 +bi )...Equation (4)

ot=σ(WoXt+uo⊙ht-1+bo)......式(5)ot =σ(Wo Xt +uo ⊙ht-1 +bo )...Equation (5)

ht=ot⊙tanh ct......式(8)ht =ot ⊙tanh ct ...Formula (8)

其中,ft表示t时刻下遗忘门的计算结果,it表示t时刻下输入门的计算结果,ot表示t时刻下输出门的计算结果。Wf表示遗忘门的权重矩阵,Wi表示输入门的权重矩阵,Wo表示输出门的权重矩阵。uf表示遗忘门的权重向量,ui表示输入门的权重向量,uo表示输出门的权重向量。uf维度小于Wf,ui维度小于Wi,uo维度小于Wo。bf表示遗忘门的偏置项,bi表示输入门的偏置项,bo表示输出门的偏置项。σ表示激活函数sigmoid。ct表示t时刻的细胞状态,ht表示t时刻隐藏层的状态,xt表示t时刻的输入数据。ct-1表示记忆层在上一时刻(即t-1时刻)的细胞状态,ht-1表示隐藏层在上一时刻(即t-1时刻)的隐藏状态,由存储模块输出t时刻的存储单元细胞状态和隐藏层状态。Wc表示输入单元状态权重矩阵;bc表示输入状态的偏置;tanh表示激活函数,⊙表示哈达马积(hadamard product),即element-wise乘法操作。IndyLSTM采用element-wise乘法替代LSTM矩阵乘法,输出/隐藏状态的每个元素取决于输入数据xt的所有元素,以及ht-1和ct-1相应位置的元素,从而使得模型参数量降低的同时能够提升任务精确度。Among them, ft represents the calculation result of the forget gate at time t, it represents the calculation result of the input gate at time t, and ot represents the calculation result of the output gate at time t. Wf represents the weight matrix of the forget gate,Wi represents the weight matrix of the input gate, and Wo represents the weight matrix of the output gate. uf represents the weight vector of the forget gate, ui represents the weight vector of the input gate, and uo represents the weight vector of the output gate. The uf dimension is smaller than Wf , the ui dimension is smaller than Wi , and the uo dimension is smaller than Wo . bf represents the bias term of the forget gate, bi represents the bias term of the input gate, and bo represents the bias term of the output gate. σ represents the activation function sigmoid. ct represents the cell state at time t, ht represents the state of the hidden layer at time t, and xt represents the input data at time t. ct-1 represents the cell state of the memory layer at the previous moment (that is, time t-1), ht-1 represents the hidden state of the hidden layer at the previous moment (that is, time t-1), and the storage module outputs time t The storage unit cell state and hidden layer state. Wc represents the input unit state weight matrix; bc represents the bias of the input state; tanh represents the activation function, and ⊙ represents the hadamard product, which is the element-wise multiplication operation. IndyLSTM uses element-wise multiplication instead of LSTM matrix multiplication. Each element of the output/hidden state depends on all elements of the input data xt , as well as the elements at the corresponding positions of ht-1 and ct-1 , thus reducing the number of model parameters. while improving task accuracy.

针对循环注意力层中的注意力机制Attention,Attention可以提高IndyLSTM中重要时间步的作用,从而进一步降低水位预测误差。Attention的本质是求最后一层IndyLSTM输出向量的加权平均和。IndyLSTM隐藏层输出向量作为Attention的输入,通过一个全连接层进行训练,再对全连接层的输出使用softmax函数进行归一化,得到每一个隐藏层向量的分配权重,权重大小表示每个时间步的隐状态对预测结果的重要程度。Attention的权重训练过程如下式(9)至式(11)所示,即注意力处理如式(9)至式(11)所示。For the attention mechanism Attention in the loop attention layer, Attention can improve the role of important time steps in IndyLSTM, thereby further reducing the water level prediction error. The essence of Attention is to find the weighted average sum of the output vectors of the last layer of IndyLSTM. The IndyLSTM hidden layer output vector is used as the input of Attention. It is trained through a fully connected layer. The output of the fully connected layer is then normalized using the softmax function to obtain the assigned weight of each hidden layer vector. The weight size represents each time step. The importance of the hidden state to the prediction result. The weight training process of Attention is as shown in the following equations (9) to (11), that is, the attention processing is as shown in equations (9) to (11).

St=tanh(WsHt+bs)......式(9)St =tanh(Ws Ht +bs )...Equation (9)

αt=soft max(St)......式(10)αt =soft max(St )...Equation (10)

ht=αt·Ht......式(11)ht = αt ·Ht ...Formula (11)

其中,Ht=[ht-q,...,ht-1]表示最后一层IndyLSTM隐藏层的输出,St表示每个隐藏层输出的得分,αt表示权重系统。加权上下文向量结果ht为Attention的最终输出,也即为水位影响向量。softmax为激活函数。Among them, Ht = [htq ,..., ht-1 ] represents the output of the last IndyLSTM hidden layer, St represents the score of each hidden layer output, and αt represents the weight system. The weighted context vector result ht is the final output of Attention, which is the water level influence vector. softmax is the activation function.

在一些实施例的步骤S803中,IndyLSTM中的的循环跳跃层能够记住历史信息,从而学习到相对长距离依赖关系。然而,由于梯度消失或者梯度爆炸,不管是LSTM、GRU还是IndyLSTM在实际中通常无法捕捉到非常长期的相关性。因此,本申请实施例通过设置一个Recurrent-skip层(即循环跳跃层)来解决上述问题。循环跳跃层利用流域水位呈现出一定周期性的特性,例如待预测水位站每周每天某个时刻的水位可能呈现出明显的规律。相关技术中,如果要预测今日3时待预测水位站的水位,季节性模型通常是利用历史数据中3时的水位数据,以及最近记录的水位数据。本申请实施例设置了一种具有时间跳跃连接的循环跳跃层,即在当前隐藏单元,以及与当前隐藏单元具有相邻周期、相同阶段的隐藏单元之间添加跳跃连接。具体地,根据如下式(12)至式(17)得到隐藏影响向量。In step S803 of some embodiments, the cyclic skip layer in IndyLSTM can remember historical information, thereby learning relatively long-distance dependencies. However, due to vanishing or exploding gradients, either LSTM, GRU or IndyLSTM usually cannot capture very long-term correlations in practice. Therefore, the embodiment of the present application solves the above problem by setting up a Recurrent-skip layer (ie, cycle skip layer). The cyclic jump layer uses the basin water level to show certain periodic characteristics. For example, the water level at a water level station to be predicted at a certain time every day of the week may show obvious patterns. In related technologies, if you want to predict the water level at a water level station to be predicted at 3 o'clock today, the seasonal model usually uses the water level data at 3 o'clock in the historical data and the recently recorded water level data. The embodiment of the present application sets up a cyclic skip layer with time skip connections, that is, adding skip connections between the current hidden unit and the hidden units with adjacent cycles and the same stage as the current hidden unit. Specifically, the hidden influence vector is obtained according to the following equations (12) to (17).

ft=σ(Wfxt+uf⊙ht-p+bf)......式(12)ft =σ(Wf xt +uf ⊙htp +bf )...Equation (12)

it=σ(Wixt+ui⊙ht-p+bi)......式(13)it =σ(Wi xt +ui ⊙htp +bi )...Equation (13)

ot=σ(Woxt+uo⊙ht-p+bo)......式(14)ot =σ(Wo xt +uo ⊙htp +bo )...Equation (14)

ht=ot⊙tanhct......式(17)ht =ot ⊙tanhct ......Formula (17)

可以理解的是,循环跳跃层的输入数据为卷积层的输出数据。p表示跳过隐藏单元的数量。对于具有明显周期特性的数据集,例如当将本申请实施例应用于待预测水位站每天每时刻水位的预测时,p可以根据实际需要设置为24或其他数值,对此本申请实施例不作具体限定。It can be understood that the input data of the loop skip layer is the output data of the convolution layer. p represents the number of skipped hidden units. For data sets with obvious periodic characteristics, for example, when the embodiment of the present application is applied to the prediction of the water level of the water level station to be predicted at every moment of the day, p can be set to 24 or other values according to actual needs, which is not specified in the embodiment of the present application. limited.

在一些实施例的步骤S804中,根据全连接层组合Recurrent-skip层的输出数据和Recurrent Attention层的输出数据,以实现对上述两个输出数据进行向量映射,得到第一水位数据。具体地,全连接层的输入数据包括Recurrent Attention层t时刻的隐藏状态ht,以及Recurrent-skip层从t-p+1时刻到t时刻的p个隐藏状态(表示为)。全连接层根据如下式(18)计算得到第一水位数据/>In step S804 of some embodiments, the output data of the Recurrent-skip layer and the output data of the Recurrent Attention layer are combined according to the fully connected layer to implement vector mapping of the above two output data to obtain the first water level data. Specifically, the input data of the fully connected layer includes the hidden state ht of the Recurrent Attention layer at time t, and the p hidden states of the Recurrent-skip layer from time t-p+1 to time t (expressed as ). The fully connected layer calculates the first water level data according to the following equation (18)/>

其中,WR表示权重矩阵,b表示偏置项。Among them, WR and represents the weight matrix, and b represents the bias term.

在一些实施例的步骤S703中,第二水位预测组件是预先设置的,基于自回归模型结构构建的模型。将初步水位影响数据中的水位数据作为初步历史水位数据,将初步历史水位数据作为第二水位预测组件的输入数据,根据第二水位预测组件进行水位预测,得到第二水位数据具体地,第二水位预测组件根据如下式(19)预测得到第二水位数据In step S703 of some embodiments, the second water level prediction component is a preset model built based on an autoregressive model structure. Use the water level data in the preliminary water level impact data as preliminary historical water level data, use the preliminary historical water level data as input data of the second water level prediction component, perform water level prediction according to the second water level prediction component, and obtain the second water level data. Specifically, the second water level prediction component predicts the second water level data according to the following equation (19)

其中,将第二水位预测组件的权重系统表示为bar∈R,qar是输入矩阵上输入窗口的大小,即使用最近qar个时间步的输入数据。Among them, the weight system of the second water level prediction component is expressed as bar ∈R, qar is the size of the input window on the input matrix, that is, using the input data of the latest qar time steps.

在一些实施例的步骤S704中,对第一水位数据和第二水位数据/>进行求和计算,得到预测水位数据。In step S704 of some embodiments, for the first water level data and second water level data/> Perform summation calculations to obtain predicted water level data.

步骤S701至步骤S704的好处是,由于第一水位预测组件的非线性特性,即神经网络模型输出的数据对输入数据不敏感,但是在实际应用中,输入数据以非周期性的方式不断变化,因此神经网络模型的预测精度会受到影响。为了缓解这个问题,本申请实施例的原始水位预测模型的最终预测分解为主要关注局部缩放问题的线性部分(即第二水位预测组件),以及包含重复模式的非线性部分(即第一水位预测组件)。The benefit of steps S701 to S704 is that due to the nonlinear characteristics of the first water level prediction component, that is, the data output by the neural network model is not sensitive to the input data, but in actual applications, the input data continues to change in a non-periodic manner, Therefore, the prediction accuracy of the neural network model will be affected. In order to alleviate this problem, the final prediction of the original water level prediction model of the embodiment of the present application is decomposed into a linear part that mainly focuses on the local scaling problem (i.e., the second water level prediction component), and a nonlinear part that contains repeated patterns (i.e., the first water level prediction component) components).

在一些实施例的步骤S105中,参照图9,根据预设的损失函数对预测水位数据和初步水位数据进行损失计算,以确定原始水位预测模型的预测误差。根据损失计算结果对原始水位预测模型进行模型训练,即调整原始水位预测模型的模型参数,得到目标水位预测模型。In step S105 of some embodiments, referring to FIG. 9 , loss calculation is performed on the predicted water level data and preliminary water level data according to the preset loss function to determine the prediction error of the original water level prediction model. Carry out model training on the original water level prediction model based on the loss calculation results, that is, adjust the model parameters of the original water level prediction model to obtain the target water level prediction model.

参照图10,在一些实施例中,步骤S105包括但不限于包括步骤S1001至步骤S1003。Referring to FIG. 10 , in some embodiments, step S105 includes, but is not limited to, steps S1001 to S1003.

步骤S1001,根据预测水位数据和初步水位数据对原始水位预测模型进行模型训练,直至原始水位预测模型收敛,得到初步水位预测模型;Step S1001: Perform model training on the original water level prediction model based on the predicted water level data and preliminary water level data until the original water level prediction model converges to obtain a preliminary water level prediction model;

步骤S1002,对初步水位预测模型进行模型评估处理,得到模型评估结果;Step S1002: Perform model evaluation processing on the preliminary water level prediction model to obtain model evaluation results;

步骤S1003,若模型评估结果满足预设评估条件,将初步水位预测模型作为目标水位预测模型。Step S1003: If the model evaluation result meets the preset evaluation conditions, the preliminary water level prediction model is used as the target water level prediction model.

在一些实施例的步骤S1001中,根据预设的损失函数对预测水位数据和初步水位数据进行损失计算,如根据下式(20)进行损失计算,得到预测误差J(Θ)。In step S1001 of some embodiments, loss calculation is performed on the predicted water level data and preliminary water level data according to a preset loss function. For example, the loss calculation is performed according to the following equation (20) to obtain the prediction error J(Θ).

其中,Θ表示原始水位预测模型中所有的模型参数,T表示训练集中样本数量,yi表示初步水位数据,oi表示预测水位数据。可以理解的是,可以利用随机梯度下降(SGD)迭代优化损失函数,使损失函数最小化,直至原始水位预测模型收敛。原始水位预测模型的收敛条件包括:损失函数下降不超过预设的损失函数阈值、迭代轮数达到预设轮数上限值等。将收敛后的原始水位预测模型作为初步水位预测模型。Among them, Θ represents all model parameters in the original water level prediction model, T represents the number of samples in the training set,yi represents preliminary water level data, and oi represents predicted water level data. It can be understood that stochastic gradient descent (SGD) can be used to iteratively optimize the loss function to minimize the loss function until the original water level prediction model converges. The convergence conditions of the original water level prediction model include: the loss function decline does not exceed the preset loss function threshold, the number of iteration rounds reaches the preset round limit, etc. The converged original water level prediction model is used as the preliminary water level prediction model.

在一些实施例的步骤S1002中,为了确定初步水位预测模型的预测性能,对初步水位预测模型进行模型评估处理。具体地,将验证集进行数据划分,得到初步水位预测模型的输入数据,和对应于该输入数据真实的水位数据。对验证集进行数据划分的方法可参照步骤S501至步骤S503,步骤S502相当于确定模型输入数据的方法,步骤S503相当于确定输入数据对应的真实水位数据的方法,对此本申请实施例不再赘述。模型评估处理方法包括Pearson相关系数平方R2、均方根误差RMSE和Nash-Sutcliffe效率系数NSE等,下面对这三种模型评估处理方法展开说明。In step S1002 of some embodiments, in order to determine the prediction performance of the preliminary water level prediction model, a model evaluation process is performed on the preliminary water level prediction model. Specifically, the verification set is divided into data to obtain the input data of the preliminary water level prediction model and the real water level data corresponding to the input data. For the method of dividing the data of the verification set, please refer to steps S501 to step S503. Step S502 is equivalent to the method of determining the input data of the model, and step S503 is equivalent to the method of determining the real water level data corresponding to the input data. The embodiments of this application will not be repeated. Repeat. Model evaluation processing methods include Pearson correlation coefficient square R2 , root mean square error RMSE, and Nash-Sutcliffe efficiency coefficient NSE. These three model evaluation processing methods are explained below.

首先,对Pearson相关系数平方R2展开说明。如下式(21)所示,计算得到相关系数平方R2First, let’s expand on the Pearson correlation coefficient squaredR2 . As shown in the following equation (21), the square correlation coefficient R2 is calculated.

其中,表示对验证集进行数据划分后,将得到的输入数据输入至初步水位预测模型得到的预测水位数据的平均值。/>表示对验证集进行数据划分后得到的真实水位数据的平均值。相关系数平方R2比对了真实值和预测值之前的线性关系,当R2的数值趋近于1时,表明初步水位预测模型的预测性能较好;反之,初步水位预测模型的预测性能较差。in, It means that after dividing the data of the validation set, the input data obtained is input into the average value of the predicted water level data obtained by the preliminary water level prediction model. /> Represents the average value of the real water level data obtained after data division of the validation set. The square correlation coefficient R2 compares the linear relationship between the true value and the predicted value. When the value of R2 approaches 1, it indicates that the prediction performance of the preliminary water level prediction model is better; on the contrary, the prediction performance of the preliminary water level prediction model is better. Difference.

其次,对均方根误差RMSE展开说明。如下式(22)所示,计算得到均方根误差RMSE。Secondly, the root mean square error RMSE is explained. As shown in the following equation (22), the root mean square error RMSE is calculated.

其中,n表示验证集中样本的数量,pi表示对验证集进行数据划分后,将得到的输入数据输入至初步水位预测模型得到的预测水位数据,oi表示对验证集进行数据划分后得到的真实水位数据。当均方根误差RMSE数值越大时,表明预测值与真实值的预测越大,即初步水位预测模型的预测性能较差;反之,初步水位预测模型的预测性能较好。Among them, n represents the number of samples in the verification set, pi represents the predicted water level data obtained by inputting the input data into the preliminary water level prediction model after dividing the data in the verification set, and oi represents the predicted water level data obtained after dividing the data in the verification set. Real water level data. When the value of the root mean square error (RMSE) is larger, it indicates that the prediction between the predicted value and the true value is larger, that is, the prediction performance of the preliminary water level prediction model is poor; conversely, the prediction performance of the preliminary water level prediction model is better.

最后,对效率系数NSE进行展开说明。如下式(23)所示,根据Nash-Sutcliffe模型计算得到效率系数NSE。Finally, the efficiency coefficient NSE is expanded and explained. As shown in the following equation (23), the efficiency coefficient NSE is calculated according to the Nash-Sutcliffe model.

其中,效率系数NSE的取值范围为负无穷至1。当效率系数NSE的取值趋近于1时,表明初步水位预测模型可靠。当效率系数NSE的取值趋近于0时,表明初步水位预测模型的预测值与真实值的平均值误差较小,整体预测是值得信赖的,但预测误差相当大。当效率系数NSE<<0时,表明初步水位预测模型不具备指导意义,不可用。Among them, the efficiency coefficient NSE ranges from negative infinity to 1. When the value of the efficiency coefficient NSE approaches 1, it indicates that the preliminary water level prediction model is reliable. When the value of the efficiency coefficient NSE approaches 0, it indicates that the average error between the predicted value of the preliminary water level prediction model and the true value is small, and the overall prediction is trustworthy, but the prediction error is quite large. When the efficiency coefficient NSE<<0, it indicates that the preliminary water level prediction model does not have guiding significance and cannot be used.

可以理解的是,模型评估结果为对应评估处理方法的取值,即为相关系数平方R2的取值、均方根误差RMSE的取值、效率系数NSE的取值。It can be understood that the model evaluation result is the value of the corresponding evaluation processing method, that is, the value of the square correlation coefficientR2 , the value of the root mean square error RMSE, and the value of the efficiency coefficient NSE.

在一些实施例的步骤S1003中,预先设置评估条件,当对应评估处理方法的取值满足评估条件时,判定初步水位预测模型为可靠的、水位预测是准确的,此时将初步水位预测模型作为目标水位预测模型。可以理解的是,根据上述三种模型评估处理方法,评估条件包括以下至少一种:相关系数平方R2的取值趋近于1、均方根误差RMSE的取值小于预设阈值、效率系数NSE的取值趋近于1。也就是说,可以从上述三种模型评估处理方法中选择任一种或多种对初步水位预测模型进行评估,对此本申请实施例不作具体限定。可以理解的是,根据预测需求,还可以对评估条件进行适应性修改,对此本申请实施例不作具体限定。In step S1003 of some embodiments, the evaluation conditions are preset. When the value of the corresponding evaluation processing method meets the evaluation conditions, it is determined that the preliminary water level prediction model is reliable and the water level prediction is accurate. At this time, the preliminary water level prediction model is used as Target water level prediction model. It can be understood that according to the above three model evaluation processing methods, the evaluation conditions include at least one of the following: the value of the correlation coefficient squareR2 is close to 1, the value of the root mean square error RMSE is less than the preset threshold, and the efficiency coefficient The value of NSE approaches 1. That is to say, any one or more of the above three model evaluation processing methods can be selected to evaluate the preliminary water level prediction model, which is not specifically limited in the embodiments of the present application. It can be understood that, according to the predicted demand, the evaluation conditions can also be adaptively modified, which is not specifically limited in the embodiments of the present application.

在一些实施例的步骤S106至步骤S107中,获取在实际应用中待预测水位站的目标水位影响数据,目标水位影响数据的数据类型与样本影响数据的数据类型相同,即目标水位影响数据包括待预测水位站的目标历史水位数据、预设船闸的目标出库流量。将目标水位影响数据作为目标水位预测模型的输入数据,根据目标水位预测模型对待预测水位站进行水位预测。假设当前时刻为M时刻,则获取M时刻之前P个时刻的目标水位影响数据,并对目标水位影响数据进行归一化处理。将归一化处理后的目标水位影响数据作为目标水位预测模型的输入数据。对目标水位预测模型的输出数据进行反归一化处理,得到目标水位预测模型预测的M+m时刻待预测水位站的水位。In steps S106 to S107 in some embodiments, the target water level impact data of the water level station to be predicted in actual applications is obtained. The data type of the target water level impact data is the same as the data type of the sample impact data, that is, the target water level impact data includes the target water level impact data. Predict the target historical water level data of the water level station and the target outflow of the preset ship lock. The target water level impact data is used as the input data of the target water level prediction model, and the water level of the to-be-predicted water level station is predicted based on the target water level prediction model. Assume that the current time is time M, obtain the target water level impact data P times before time M, and normalize the target water level impact data. The normalized target water level impact data is used as the input data of the target water level prediction model. The output data of the target water level prediction model is denormalized to obtain the water level of the water level station to be predicted at time M+m predicted by the target water level prediction model.

本申请实施例提出一种有效的基于CNN-RNN-Attention融合AR模型的多因素水位预测模型,实验结果表明本申请实施例的目标水位预测模型可以有效改善模型的拟合能力和提高预测精度。通过结合上游支流船闸站点的出库流量及增加近期历史时刻的水位数据的权重,以提高各指标预测精度为目的,在建立多种单一模型基础上,针对流域水位的时间序列预测自身特点,以均方误差最小为原则,提出CRANet为实施例的多因素水位预测模型,使得水位预测误差控制在4%以内。预测效果对流域船闸运行调度中心精准预调度船舶,对行业主管和装载货物的船舶形成有效的指导建议等具有重要指导价值。The embodiments of the present application propose an effective multi-factor water level prediction model based on the CNN-RNN-Attention fusion AR model. Experimental results show that the target water level prediction model of the embodiments of the present application can effectively improve the fitting ability of the model and improve the prediction accuracy. By combining the outflow of the upstream tributary ship lock station and increasing the weight of the water level data in recent historical moments, with the purpose of improving the prediction accuracy of each indicator, based on the establishment of multiple single models, the characteristics of the time series of the water level in the basin are predicted. Based on the principle of minimum mean square error, a multi-factor water level prediction model based on CRANet is proposed as an embodiment, so that the water level prediction error is controlled within 4%. The prediction effect has important guiding value for the river basin ship lock operation dispatching center to accurately pre-schedule ships, and to form effective guidance and suggestions for industry supervisors and ships carrying cargo.

参照图11和12,在一些实施例中,本申请实施例还提供了一种水位预测系统,该水位预测系统包括:Referring to Figures 11 and 12, in some embodiments, embodiments of the present application also provide a water level prediction system. The water level prediction system includes:

数据交互装置1101,数据交换装置包括数据交换模块、主控模块、接口模块,其中,数据交换模块分别与待预测水位站的数据采集装置、预设船闸的数据采集装置通信连接,用于获取样本影响数据;主控模块用于对样本影响数据进行数据冲突处理和/或数据同步处理;Data exchange device 1101. The data exchange device includes a data exchange module, a main control module, and an interface module. The data exchange module is communicatively connected to the data acquisition device of the water level station to be predicted and the data acquisition device of the preset ship lock for obtaining samples. Impact data; the main control module is used to perform data conflict processing and/or data synchronization processing on sample impact data;

水位预测装置1102,水位预测装置用于与接口模块通信连接,用于执行上述任一实施例所描述的水位预测方法。Water level prediction device 1102. The water level prediction device is used to communicate with the interface module and execute the water level prediction method described in any of the above embodiments.

下面对数据交换装置及水位预测系统进行展开说明。The following describes the data exchange device and water level prediction system.

数据交换装置是一种水情多源异构汇聚平台,数据交换装置通过JDBC接口对接各种数据源,如包括但不限于与待预测水位站数据采集装置连接、包括但不限于与预设船闸的数据采集装置连接,以获取多个水位站的水位数据和多个船闸站点的出库流量。其中,数据采集装置可以为传感器或其他装置,对此本申请实施例不作具体限定。主控模块为数据交换装置的总平台,可以用于异地热备份。接口模块用于与业务系统连接,提供对外服务的业务数据。例如,当需对待预测水位站进行水位预测时,可以通过接口模块获取待预测水位站历史p个时刻的水位数据,以及对应预设船闸的出库流量,将水位数据和出库流量作为目标水位预测模型的输入数据,从而实现对m个时刻以后待预测水位站水位的预测。其次,还可以实现船闸调度等功能。The data exchange device is a multi-source heterogeneous water regime aggregation platform. The data exchange device connects to various data sources through the JDBC interface, including but not limited to connection with the data acquisition device of the water level station to be predicted, including but not limited to connection with the preset ship lock. The data acquisition device is connected to obtain the water level data of multiple water level stations and the outflow flow of multiple ship lock sites. The data collection device may be a sensor or other device, which is not specifically limited in this embodiment of the present application. The main control module is the overall platform of the data exchange device and can be used for remote hot backup. The interface module is used to connect with the business system and provide business data for external services. For example, when it is necessary to predict the water level of a water level station to be predicted, the water level data of p historical moments of the water level station to be predicted can be obtained through the interface module, as well as the outbound flow rate corresponding to the preset ship lock, and the water level data and outbound flow rate can be used as the target water level. The input data of the prediction model is used to predict the water level of the water level station to be predicted m times later. Secondly, functions such as ship lock scheduling can also be realized.

本申请实施例提供的水位预测系统,提出一种非侵入性的多源异构数据共享交换方案。解决了多源异构环境下数据库的访问,数据的获取与复制,动态数据源的处理以及同步过程中数据冲突与同步的实时性等问题。其中,同步过程中数据冲突问题是指,当数据采集装置因自身因素重复上传同一个时刻数据,导致出现同一个时刻对应多个数据的情况。此时,主控模块将根据线性差值法等方式解决该问题。以线性差值法为例,假设时刻1上传的数据为1,时刻3上传的数据为3,时刻2上传的数据为(2,4,5),即时刻2存在多数据上传。此时,主控模块根据线性差值法确定时刻2的数据为2。解决同步实时性问题的目的是尽可能保证获取到每个时刻的数据,因此,可以设置同步策略,在不同数据源端根据不同数据上传间隔频率设置同步间隔。例如,某水位站数据采集装置的数据上传时间间隔为每小时,则可以设置整时过5分钟和整时过15分钟各同步一次,以进一步保证数据同步实时性。The water level prediction system provided by the embodiment of the present application proposes a non-invasive multi-source heterogeneous data sharing and exchange solution. It solves the problems of database access, data acquisition and copying, dynamic data source processing, data conflicts and real-time synchronization during the synchronization process in a multi-source heterogeneous environment. Among them, the problem of data conflict during the synchronization process refers to when the data collection device repeatedly uploads data at the same time due to its own factors, resulting in the situation that the same time corresponds to multiple data. At this time, the main control module will solve the problem according to the linear difference method and other methods. Taking the linear difference method as an example, assume that the data uploaded at time 1 is 1, the data uploaded at time 3 is 3, and the data uploaded at time 2 is (2,4,5), that is, there is multiple data uploaded at time 2. At this time, the main control module determines that the data at time 2 is 2 based on the linear difference method. The purpose of solving the problem of real-time synchronization is to ensure that data at every moment is obtained as much as possible. Therefore, a synchronization strategy can be set, and the synchronization interval can be set at different data sources according to different data upload interval frequencies. For example, if the data upload time interval of a data collection device at a water level station is every hour, you can set synchronization once every 5 minutes after the hour and once every 15 minutes after the hour to further ensure the real-time data synchronization.

参照图13,本申请实施例还提供一种水位预测装置,可以实现上述水位预测方法,该装置包括:Referring to Figure 13, an embodiment of the present application also provides a water level prediction device that can implement the above water level prediction method. The device includes:

第一数据获取模块1301,用于获取待预测水位站的样本影响数据;其中,样本影响数据包括待预测水位站的样本历史水位数据、预设船闸的样本出库流量;The first data acquisition module 1301 is used to obtain sample impact data of the water level station to be predicted; wherein the sample impact data includes sample historical water level data of the water level station to be predicted and sample outflow flow of the preset ship lock;

预处理模块1302,用于对样本影响数据进行预处理,得到初步影响数据;The preprocessing module 1302 is used to preprocess the sample impact data to obtain preliminary impact data;

数据构建模块1303,用于根据初步影响数据构建初步水位影响数据和初步水位数据;The data construction module 1303 is used to construct preliminary water level impact data and preliminary water level data based on the preliminary impact data;

第一水位预测模块1304,用于将初步水位影响数据输入至预设的原始水位预测模型进行水位预测,得到预测水位数据;The first water level prediction module 1304 is used to input preliminary water level impact data into the preset original water level prediction model to perform water level prediction and obtain predicted water level data;

模型训练模块1305,用于根据预测水位数据和初步水位数据对原始水位预测模型进行模型训练,得到目标水位预测模型;The model training module 1305 is used to perform model training on the original water level prediction model based on the predicted water level data and preliminary water level data to obtain the target water level prediction model;

第二数据获取模块1306,用于获取待预测水位站的目标水位影响数据;其中,目标水位影响数据包括待预测水位站的目标历史水位数据、预设船闸的目标出库流量;The second data acquisition module 1306 is used to obtain the target water level impact data of the water level station to be predicted; wherein the target water level impact data includes the target historical water level data of the water level station to be predicted and the target outflow flow of the preset ship lock;

第二水位预测模块1307,用于根据目标水位预测模型对目标水位数据进行水位预测。The second water level prediction module 1307 is used to perform water level prediction on the target water level data according to the target water level prediction model.

该水位预测装置的具体实施方式与上述水位预测方法的具体实施例基本相同,在此不再赘述。The specific implementation of the water level prediction device is basically the same as the specific implementation of the above water level prediction method, and will not be described again here.

本申请实施例还提供了一种电子设备,电子设备包括存储器和处理器,存储器存储有计算机程序,处理器执行计算机程序时实现上述水位预测方法。该电子设备可以为包括平板电脑、车载电脑等任意智能终端。An embodiment of the present application also provides an electronic device. The electronic device includes a memory and a processor. The memory stores a computer program. When the processor executes the computer program, the above water level prediction method is implemented. The electronic device can be any smart terminal including a tablet computer, a vehicle-mounted computer, etc.

参照图14,图14示意了另一实施例的电子设备的硬件结构,电子设备包括:Referring to Figure 14, Figure 14 illustrates the hardware structure of an electronic device according to another embodiment. The electronic device includes:

处理器1401,可以采用通用的CPU(CentralProcessingUnit,中央处理器)、微处理器、应用专用集成电路(ApplicationSpecificIntegratedCircuit,ASIC)、或者一个或多个集成电路等方式实现,用于执行相关程序,以实现本申请实施例所提供的技术方案;The processor 1401 can be implemented by a general CPU (Central Processing Unit, central processing unit), a microprocessor, an application specific integrated circuit (Application Specific Integrated Circuit, ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement The technical solutions provided by the embodiments of this application;

存储器1402,可以采用只读存储器(ReadOnlyMemory,ROM)、静态存储设备、动态存储设备或者随机存取存储器(RandomAccessMemory,RAM)等形式实现。存储器1402可以存储操作系统和其他应用程序,在通过软件或者固件来实现本说明书实施例所提供的技术方案时,相关的程序代码保存在存储器1402中,并由处理器1401来调用执行本申请实施例的水位预测方法;The memory 1402 can be implemented in the form of read-only memory (ReadOnlyMemory, ROM), static storage device, dynamic storage device, or random access memory (RandomAccessMemory, RAM). The memory 1402 can store operating systems and other application programs. When implementing the technical solutions provided by the embodiments of this specification through software or firmware, the relevant program codes are stored in the memory 1402 and called by the processor 1401 to execute the implementation of this application. Example of water level prediction method;

输入/输出接口1403,用于实现信息输入及输出;Input/output interface 1403, used to implement information input and output;

通信接口1404,用于实现本设备与其他设备的通信交互,可以通过有线方式(例如USB、网线等)实现通信,也可以通过无线方式(例如移动网络、WIFI、蓝牙等)实现通信;Communication interface 1404 is used to realize communication interaction between this device and other devices. Communication can be achieved through wired methods (such as USB, network cables, etc.) or wirelessly (such as mobile networks, WIFI, Bluetooth, etc.);

总线1405,在设备的各个组件(例如处理器1401、存储器1402、输入/输出接口1403和通信接口1404)之间传输信息;Bus 1405, which transmits information between various components of the device (such as processor 1401, memory 1402, input/output interface 1403, and communication interface 1404);

其中处理器1401、存储器1402、输入/输出接口1403和通信接口1404通过总线1405实现彼此之间在设备内部的通信连接。The processor 1401, the memory 1402, the input/output interface 1403 and the communication interface 1404 implement communication connections between each other within the device through the bus 1405.

本申请实施例还提供了一种计算机可读存储介质,该计算机可读存储介质存储有计算机程序,该计算机程序被处理器执行时实现上述水位预测方法。Embodiments of the present application also provide a computer-readable storage medium that stores a computer program. When the computer program is executed by a processor, the above-mentioned water level prediction method is implemented.

存储器作为一种非暂态计算机可读存储介质,可用于存储非暂态软件程序以及非暂态性计算机可执行程序。此外,存储器可以包括高速随机存取存储器,还可以包括非暂态存储器,例如至少一个磁盘存储器件、闪存器件、或其他非暂态固态存储器件。在一些实施方式中,存储器可选包括相对于处理器远程设置的存储器,这些远程存储器可以通过网络连接至该处理器。上述网络的实例包括但不限于互联网、企业内部网、局域网、移动通信网及其组合。As a non-transitory computer-readable storage medium, memory can be used to store non-transitory software programs and non-transitory computer executable programs. In addition, the memory may include high-speed random access memory and may also include non-transitory memory, such as at least one magnetic disk storage device, flash memory device, or other non-transitory solid-state storage device. In some embodiments, the memory may optionally include memory located remotely from the processor, and the remote memory may be connected to the processor via a network. Examples of the above-mentioned networks include but are not limited to the Internet, intranets, local area networks, mobile communication networks and combinations thereof.

本申请实施例描述的实施例是为了更加清楚的说明本申请实施例的技术方案,并不构成对于本申请实施例提供的技术方案的限定,本领域技术人员可知,随着技术的演变和新应用场景的出现,本申请实施例提供的技术方案对于类似的技术问题,同样适用。The embodiments described in the embodiments of the present application are for the purpose of more clearly illustrating the technical solutions of the embodiments of the present application, and do not constitute a limitation on the technical solutions provided by the embodiments of the present application. Those skilled in the art will know that with the evolution of technology and new technologies, As application scenarios arise, the technical solutions provided by the embodiments of this application are also applicable to similar technical problems.

本领域技术人员可以理解的是,图中示出的技术方案并不构成对本申请实施例的限定,可以包括比图示更多或更少的步骤,或者组合某些步骤,或者不同的步骤。Those skilled in the art can understand that the technical solutions shown in the figures do not limit the embodiments of the present application, and may include more or fewer steps than those shown in the figures, or combine certain steps, or different steps.

以上所描述的装置实施例仅仅是示意性的,其中作为分离部件说明的单元可以是或者也可以不是物理上分开的,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。The device embodiments described above are only illustrative, and the units described as separate components may or may not be physically separate, that is, they may be located in one place, or they may be distributed to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

本领域普通技术人员可以理解,上文中所公开方法中的全部或某些步骤、系统、设备中的功能模块/单元可以被实施为软件、固件、硬件及其适当的组合。Those of ordinary skill in the art can understand that all or some steps, systems, and functional modules/units in the devices disclosed above can be implemented as software, firmware, hardware, and appropriate combinations thereof.

本申请的说明书及上述附图中的术语“第一”、“第二”、“第三”、“第四”等(如果存在)是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便这里描述的本申请的实施例能够以除了在这里图示或描述的那些以外的顺序实施。此外,术语“包括”和“具有”以及他们的任何变形,意图在于覆盖不排他的包含,例如,包含了一系列步骤或单元的过程、方法、系统、产品或设备不必限于清楚地列出的那些步骤或单元,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它步骤或单元。The terms "first", "second", "third", "fourth", etc. (if present) in the description of this application and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe specific objects. Sequence or sequence. It is to be understood that the data so used are interchangeable under appropriate circumstances so that the embodiments of the application described herein can be practiced in sequences other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, e.g., a process, method, system, product, or apparatus that encompasses a series of steps or units and need not be limited to those explicitly listed. Those steps or elements may instead include other steps or elements not expressly listed or inherent to the process, method, product or apparatus.

应当理解,在本申请中,“至少一个(项)”是指一个或者多个,“多个”是指两个或两个以上。“和/或”,用于描述关联对象的关联关系,表示可以存在三种关系,例如,“A和/或B”可以表示:只存在A,只存在B以及同时存在A和B三种情况,其中A,B可以是单数或者复数。字符“/”一般表示前后关联对象是一种“或”的关系。“以下至少一项(个)”或其类似表达,是指这些项中的任意组合,包括单项(个)或复数项(个)的任意组合。例如,a,b或c中的至少一项(个),可以表示:a,b,c,“a和b”,“a和c”,“b和c”,或“a和b和c”,其中a,b,c可以是单个,也可以是多个。It should be understood that in this application, "at least one (item)" refers to one or more, and "plurality" refers to two or more. "And/or" is used to describe the relationship between associated objects, indicating that there can be three relationships. For example, "A and/or B" can mean: only A exists, only B exists, and A and B exist simultaneously. , where A and B can be singular or plural. The character "/" generally indicates that the related objects are in an "or" relationship. “At least one of the following” or similar expressions thereof refers to any combination of these items, including any combination of a single item (items) or a plurality of items (items). For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c" ”, where a, b, c can be single or multiple.

在本申请所提供的几个实施例中,应该理解到,所揭露的装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,上述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only illustrative. For example, the division of the above units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components may be combined or may be Integrated into another system, or some features can be ignored, or not implemented. On the other hand, the coupling or direct coupling or communication connection between each other shown or discussed may be through some interfaces, and the indirect coupling or communication connection of the devices or units may be in electrical, mechanical or other forms.

上述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described above as separate components may or may not be physically separated. The components shown as units may or may not be physical units, that is, they may be located in one place, or they may be distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。In addition, each functional unit in each embodiment of the present application can be integrated into one processing unit, each unit can exist physically alone, or two or more units can be integrated into one unit. The above integrated units can be implemented in the form of hardware or software functional units.

集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括多指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例的方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(Read-Only Memory,简称ROM)、随机存取存储器(Random Access Memory,简称RAM)、磁碟或者光盘等各种可以存储程序的介质。Integrated units may be stored in a computer-readable storage medium if they are implemented in the form of software functional units and sold or used as independent products. Based on this understanding, the technical solution of the present application is essentially or contributes to the existing technology, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium , including multiple instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods of various embodiments of the present application. The aforementioned storage media include: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), magnetic disk or optical disk, etc. that can store programs. medium.

以上参照附图说明了本申请实施例的优选实施例,并非因此局限本申请实施例的权利范围。本领域技术人员不脱离本申请实施例的范围和实质内所作的任何修改、等同替换和改进,均应在本申请实施例的权利范围之内。The preferred embodiments of the embodiments of the present application have been described above with reference to the accompanying drawings, but this does not limit the scope of rights of the embodiments of the present application. Any modifications, equivalent substitutions and improvements made by those skilled in the art without departing from the scope and essence of the embodiments of the present application shall be within the scope of rights of the embodiments of the present application.

Claims (10)

Translated fromChinese
1.一种水位预测方法,其特征在于,所述方法包括:1. A water level prediction method, characterized in that the method includes:获取待预测水位站的样本影响数据;其中,所述样本影响数据包括所述待预测水位站的样本历史水位数据、预设船闸的样本出库流量;Obtain the sample impact data of the water level station to be predicted; wherein the sample impact data includes the sample historical water level data of the water level station to be predicted and the sample outflow flow of the preset ship lock;对所述样本影响数据进行预处理,得到初步影响数据;Preprocess the sample impact data to obtain preliminary impact data;根据所述初步影响数据构建初步水位影响数据和初步水位数据;Construct preliminary water level impact data and preliminary water level data based on the preliminary impact data;将所述初步水位影响数据输入至预设的原始水位预测模型进行水位预测,得到预测水位数据;Input the preliminary water level impact data into the preset original water level prediction model to perform water level prediction to obtain predicted water level data;根据所述预测水位数据和所述初步水位数据对所述原始水位预测模型进行模型训练,得到目标水位预测模型;Perform model training on the original water level prediction model according to the predicted water level data and the preliminary water level data to obtain a target water level prediction model;获取所述待预测水位站的目标水位影响数据;其中,所述目标水位影响数据包括所述待预测水位站的目标历史水位数据、所述预设船闸的目标出库流量;Obtain the target water level impact data of the water level station to be predicted; wherein the target water level impact data includes the target historical water level data of the water level station to be predicted and the target outflow flow of the preset ship lock;根据所述目标水位预测模型对所述目标水位影响数据进行水位预测。Water level prediction is performed on the target water level impact data according to the target water level prediction model.2.根据权利要求1所述的方法,其特征在于,所述对所述样本影响数据进行预处理,得到初步影响数据,包括:2. The method according to claim 1, characterized in that preprocessing the sample impact data to obtain preliminary impact data includes:对所述样本影响数据进行缺失数据处理,得到完整影响数据;Perform missing data processing on the sample impact data to obtain complete impact data;获取所述完整影响数据的采样时间、所述预设船闸与所述待测水位站之间的水流耗时;The sampling time to obtain the complete impact data and the water flow time between the preset ship lock and the water level station to be measured;根据所述采样时间、所述水流耗时对所述完整影响数据进行时间对齐处理,得到对齐影响数据;Perform time alignment processing on the complete impact data according to the sampling time and the water flow time consumption to obtain aligned impact data;对所述对齐影响数据进行归一化处理,得到初步影响数据。The alignment impact data is normalized to obtain preliminary impact data.3.根据权利要求2所述的方法,其特征在于,所述根据所述初步影响数据构建初步水位影响数据和初步水位数据,包括:3. The method of claim 2, wherein constructing preliminary water level impact data and preliminary water level data based on the preliminary impact data includes:根据预设的参考采样时间对初步影响数据进行数据划分,得到第一影响数据和第二影响数据;Divide the preliminary impact data according to the preset reference sampling time to obtain the first impact data and the second impact data;根据预设的采样时长对所述第一影响数据进行数据筛选,得到所述初步水位影响数据;Perform data screening on the first impact data according to the preset sampling duration to obtain the preliminary water level impact data;根据预设的预测时间间隔对所述第二影响数据进行数据筛选,得到所述初步水位数据。The second impact data is filtered according to a preset prediction time interval to obtain the preliminary water level data.4.根据权利要求1所述的方法,其特征在于,所述原始水位预测模型包括第一水位预测组件和第二水位预测组件,所述将所述初步水位影响数据输入至预设的原始水位预测模型进行水位预测,得到预测水位数据,包括:4. The method of claim 1, wherein the original water level prediction model includes a first water level prediction component and a second water level prediction component, and the preliminary water level impact data is input to a preset original water level. The prediction model performs water level prediction and obtains predicted water level data, including:根据预设权值对所述初步水位影响数据进行权重处理,得到加权影响数据;Perform weight processing on the preliminary water level impact data according to the preset weight value to obtain weighted impact data;根据所述第一水位预测组件对所述加权影响数据进行水位预测,得到第一水位数据;Perform water level prediction on the weighted influence data according to the first water level prediction component to obtain first water level data;根据所述第二水位预测组件对所述初步水位影响数据进行水位预测,得到第二水位数据;Perform water level prediction on the preliminary water level impact data according to the second water level prediction component to obtain second water level data;根据所述第一水位数据和所述第二水位数据得到所述预测水位数据。The predicted water level data is obtained according to the first water level data and the second water level data.5.根据权利要求4所述的方法,其特征在于,所述第一水位预测组件包括卷积层、循环注意力层、循环跳跃层和全连接层,所述根据所述第一水位预测组件对所述加权影响数据进行水位预测,得到第一水位数据,包括:5. The method according to claim 4, wherein the first water level prediction component includes a convolution layer, a cyclic attention layer, a cyclic skip layer and a fully connected layer. Perform water level prediction on the weighted impact data to obtain first water level data, including:根据所述卷积层对所述加权影响数据进行特征提取,得到水位影响向量;Perform feature extraction on the weighted influence data according to the convolution layer to obtain a water level influence vector;根据所述循环注意力层对所述水位影响向量进行循环权重处理和注意力处理,得到加权影响向量;Perform cyclic weight processing and attention processing on the water level influence vector according to the cyclic attention layer to obtain a weighted influence vector;根据所述循环跳跃层对所述水位影响向量进行跳跃特征提取,得到隐藏影响向量;Perform jump feature extraction on the water level influence vector according to the cyclic jump layer to obtain a hidden influence vector;根据所述全连接层对所述加权影响向量、所述隐藏影响向量进行向量映射,得到所述第一水位数据。Vector mapping is performed on the weighted influence vector and the hidden influence vector according to the fully connected layer to obtain the first water level data.6.根据权利要求1至5任一项所述的方法,其特征在于,所述根据所述预测水位数据和所述初步水位数据对所述原始水位预测模型进行模型训练,得到目标水位预测模型,包括:6. The method according to any one of claims 1 to 5, characterized in that the original water level prediction model is model trained according to the predicted water level data and the preliminary water level data to obtain a target water level prediction model. ,include:根据所述预测水位数据和所述初步水位数据对所述原始水位预测模型进行模型训练,直至所述原始水位预测模型收敛,得到初步水位预测模型;Perform model training on the original water level prediction model according to the predicted water level data and the preliminary water level data until the original water level prediction model converges to obtain a preliminary water level prediction model;对所述初步水位预测模型进行模型评估处理,得到模型评估结果;Perform model evaluation processing on the preliminary water level prediction model to obtain model evaluation results;若所述模型评估结果满足预设评估条件,将所述初步水位预测模型作为所述目标水位预测模型。If the model evaluation result meets the preset evaluation conditions, the preliminary water level prediction model is used as the target water level prediction model.7.一种水位预测系统,其特征在于,所述系统包括:7. A water level prediction system, characterized in that the system includes:数据交换装置,所述数据交换装置包括数据交换模块、主控模块、接口模块,其中,所述数据交换模块分别与所述待预测水位站的数据采集装置、所述预设船闸的数据采集装置通信连接,用于获取样本影响数据;所述主控模块用于对所述样本影响数据进行数据冲突处理和/或数据同步处理;Data exchange device. The data exchange device includes a data exchange module, a main control module, and an interface module. The data exchange module is respectively connected with the data acquisition device of the water level station to be predicted and the data acquisition device of the preset ship lock. Communication connection, used to obtain sample impact data; the main control module is used to perform data conflict processing and/or data synchronization processing on the sample impact data;水位预测装置,所述水位预测装置用于与所述接口模块通信连接,用于执行如权利要求1至6任一项所述的方法。A water level prediction device, the water level prediction device is used to communicate with the interface module and is used to perform the method according to any one of claims 1 to 6.8.一种水位预测装置,其特征在于,所述装置包括:8. A water level prediction device, characterized in that the device includes:第一数据获取模块,用于获取待预测水位站的样本影响数据;其中,所述样本影响数据包括所述待预测水位站的样本历史水位数据、预设船闸的样本出库流量;The first data acquisition module is used to obtain the sample impact data of the water level station to be predicted; wherein the sample impact data includes the sample historical water level data of the water level station to be predicted and the sample outflow flow of the preset ship lock;预处理模块,用于对所述样本影响数据进行预处理,得到初步影响数据;A preprocessing module, used to preprocess the sample impact data to obtain preliminary impact data;数据构建模块,用于根据所述初步影响数据构建初步水位影响数据和初步水位数据;A data construction module, configured to construct preliminary water level impact data and preliminary water level data based on the preliminary impact data;第一水位预测模块,用于将所述初步水位影响数据输入至预设的原始水位预测模型进行水位预测,得到预测水位数据;The first water level prediction module is used to input the preliminary water level impact data into the preset original water level prediction model to perform water level prediction and obtain predicted water level data;模型训练模块,用于根据所述预测水位数据和所述初步水位数据对所述原始水位预测模型进行模型训练,得到目标水位预测模型;A model training module, configured to perform model training on the original water level prediction model based on the predicted water level data and the preliminary water level data to obtain a target water level prediction model;第二数据获取模块,用于获取所述待预测水位站的目标水位影响数据;其中,所述目标水位影响数据包括所述待预测水位站的目标历史水位数据、所述预设船闸的目标出库流量;The second data acquisition module is used to obtain the target water level impact data of the water level station to be predicted; wherein the target water level impact data includes the target historical water level data of the water level station to be predicted, and the target exit of the preset ship lock. Library flow;第二水位预测模块,用于根据所述目标水位预测模型对所述目标水位数据进行水位预测。The second water level prediction module is used to predict the water level on the target water level data according to the target water level prediction model.9.一种电子设备,其特征在于,所述电子设备包括存储器和处理器,所述存储器存储有计算机程序,所述处理器执行所述计算机程序时实现权利要求1至6任一项所述的方法。9. An electronic device, characterized in that the electronic device includes a memory and a processor, the memory stores a computer program, and when the processor executes the computer program, it implements any one of claims 1 to 6 Methods.10.一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现权利要求1至6中任一项所述的方法。10. A computer-readable storage medium storing a computer program, characterized in that when the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
CN202310672834.6A2023-06-072023-06-07 Water level prediction methods, systems, devices, electronic equipment and mediaPendingCN116822722A (en)

Priority Applications (1)

Application NumberPriority DateFiling DateTitle
CN202310672834.6ACN116822722A (en)2023-06-072023-06-07 Water level prediction methods, systems, devices, electronic equipment and media

Applications Claiming Priority (1)

Application NumberPriority DateFiling DateTitle
CN202310672834.6ACN116822722A (en)2023-06-072023-06-07 Water level prediction methods, systems, devices, electronic equipment and media

Publications (1)

Publication NumberPublication Date
CN116822722Atrue CN116822722A (en)2023-09-29

Family

ID=88140256

Family Applications (1)

Application NumberTitlePriority DateFiling Date
CN202310672834.6APendingCN116822722A (en)2023-06-072023-06-07 Water level prediction methods, systems, devices, electronic equipment and media

Country Status (1)

CountryLink
CN (1)CN116822722A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN117824788A (en)*2024-03-052024-04-05河海大学 Water level monitoring and analysis system
CN119250458A (en)*2024-10-092025-01-03华能西藏雅鲁藏布江水电开发投资有限公司 A cascade optimization scheduling method and system for flood control power generation
CN119398251A (en)*2024-10-232025-02-07重庆交通大学 A method for predicting waterway freight volume

Cited By (5)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN117824788A (en)*2024-03-052024-04-05河海大学 Water level monitoring and analysis system
CN117824788B (en)*2024-03-052024-05-28河海大学Water level monitoring and analyzing system
CN119250458A (en)*2024-10-092025-01-03华能西藏雅鲁藏布江水电开发投资有限公司 A cascade optimization scheduling method and system for flood control power generation
CN119250458B (en)*2024-10-092025-08-22华能西藏雅鲁藏布江水电开发投资有限公司 A cascade optimization scheduling method and system for flood control power generation
CN119398251A (en)*2024-10-232025-02-07重庆交通大学 A method for predicting waterway freight volume

Similar Documents

PublicationPublication DateTitle
CN109255505B (en) A short-term load forecasting method based on multi-model fusion neural network
CN116822722A (en) Water level prediction methods, systems, devices, electronic equipment and media
CN113193556B (en)Short-term wind power prediction method based on probability prediction model
CN108683614B (en)Virtual reality equipment cluster bandwidth allocation device based on threshold residual error network
CN108985514A (en)Load forecasting method, device and equipment based on EEMD and LSTM
CN117671952A (en) Traffic flow prediction method and system based on spatiotemporal synchronized dynamic graph attention network
CN112633463A (en)Dual recurrent neural network architecture for modeling long term dependencies in sequence data
CN110570035A (en) People Flow Prediction System Simultaneously Modeling Spatiotemporal Dependence and Daily Flow Correlation
CN114572229A (en)Vehicle speed prediction method, device, medium and equipment based on graph neural network
CN114330935A (en)New energy power prediction method and system based on multiple combined strategy integrated learning
CN112241802A (en)Interval prediction method for wind power
Shivaditya et al.Graph neural network-based surrogate models for finite element analysis
CN118312759A (en) Multi-temporal and spatiotemporal power flow prediction method and device based on graph convolution and recurrent neural network
CN116979506A (en)HGL-GTCN-based short-term power load prediction method
CN116993185A (en)Time sequence prediction method, device, equipment and storage medium
CN110335466A (en) Traffic Flow Prediction Method and Equipment
CN106407932A (en)Handwritten number recognition method based on fractional calculus and generalized inverse neural network
CN117079452A (en)Traffic flow prediction method and device based on space-time attention network and readable medium
CN114239945B (en)Short-term power load prediction method, device, equipment and storage medium
Ullah et al.Hybrid BiGRU‐CNN Model for Load Forecasting in Smart Grids with High Renewable Energy Integration
CN119807813A (en) A method, device, medium and equipment for predicting long-term load in power system
CN118468099A (en) Visibility prediction method, system, electronic device and storage medium
CN115907000B (en)Small sample learning method for power system optimal power flow prediction
JP2025513087A (en) Automated variational inference using probabilistic models with irregular beliefs
CN116245220A (en)Photovoltaic output prediction method and system based on neural network

Legal Events

DateCodeTitleDescription
PB01Publication
PB01Publication
SE01Entry into force of request for substantive examination
SE01Entry into force of request for substantive examination

[8]ページ先頭

©2009-2025 Movatter.jp