WO2021068528A1 - 基于卷积神经网络的注意力权重计算方法、装置及设备 - Google Patents

基于卷积神经网络的注意力权重计算方法、装置及设备 Download PDF

Info

Publication number
WO2021068528A1
WO2021068528A1 PCT/CN2020/093549 CN2020093549W WO2021068528A1 WO 2021068528 A1 WO2021068528 A1 WO 2021068528A1 CN 2020093549 W CN2020093549 W CN 2020093549W WO 2021068528 A1 WO2021068528 A1 WO 2021068528A1
Authority
WO
WIPO (PCT)
Prior art keywords
attention
layer
time series
attention weight
series data
Prior art date
Application number
PCT/CN2020/093549
Other languages
English (en)
French (fr)
Inventor
陈曦
李薿
庄伯金
王少军
Original Assignee
平安科技(深圳)有限公司
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 平安科技(深圳)有限公司 filed Critical 平安科技(深圳)有限公司
Publication of WO2021068528A1 publication Critical patent/WO2021068528A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/045Combinations of networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/047Probabilistic or stochastic networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods

Definitions

  • This application relates to the field of machine learning technology, and in particular to a method, device and equipment for calculating attention weights based on convolutional neural networks.
  • Deep neural network is one of the most advanced perceptual models in the field of artificial intelligence. It simulates the neural connection structure of the human brain by establishing a model, and describes data features hierarchically through multiple transformation stages, such as images, videos, and audios. Large-scale data processing tasks bring breakthrough progress.
  • the deep neural network model is an arithmetic model consisting of a large number of nodes through a network interconnection structure, and these nodes are called neurons.
  • the connection strength between every two nodes represents the weight of the connection signal between the two nodes, that is, the weight, which corresponds to the memory in the human neural network.
  • the attention mechanism is a strategy that was first proposed in the field of visual images.
  • the idea of the attention mechanism is to increase the weight of useful information, so that the task processing device is more focused on finding useful information related to the current output in the input data, thereby improving the quality of the output.
  • the attention mechanism is divided into spatial attention mechanism and temporal attention mechanism.
  • this application proposes a method and device for calculating attention weights based on a convolutional neural network.
  • the first aspect of this application proposes an attention weight calculation method based on a convolutional neural network, which includes:
  • the second aspect of the present application also proposes an attention weight calculation device based on a convolutional neural network, and the attention weight calculation device based on a convolutional neural network includes:
  • An input module for receiving time series data, and using a self-attention mechanism to calculate the attention weight of each feature in the time series data
  • An extraction module which extracts multi-layer attention weights from the time series data, and obtains the influencing factors of the intermediate hidden layer
  • the calculation module calculates the attention weight of the benchmark data at different moments according to the influencing factors of the intermediate hidden layer and the benchmark data obtained in advance;
  • a learning module that extracts multi-layer attention weights from the reference data, and uses a self-attention mechanism to update the influencing factors of the intermediate hidden layer;
  • the output module obtains the prediction result corresponding to the time series data according to the attention weight of the last layer and the influencing factors of the intermediate hidden layer, and displays the prediction result to the client.
  • the third aspect of the present application also proposes a computer device, wherein the computer device includes: a memory, a processor, and an attention weight calculation based on a convolutional neural network that is stored in the memory and can run on the processor
  • the program when the attention weight calculation program based on the convolutional neural network is executed by the processor, the following steps are implemented:
  • the fourth aspect of the present application also proposes a computer-readable storage medium, the computer-readable storage medium includes an attention weight calculation program based on a convolutional neural network, the attention weight calculation based on a convolutional neural network
  • the program is executed by the processor, the following steps are implemented:
  • This application receives time series data and uses a self-attention mechanism to calculate the attention weight of each feature in the time series data; performs multi-layer attention weight extraction on the time series data, and obtains the intermediate hidden layer influencing factors; Calculate the attention weight of the benchmark data at different moments based on the influencing factors of the layer and the pre-acquired benchmark data; extract the attention weight of the benchmark data in multiple layers, and use the self-attention mechanism to update the influencing factors of the intermediate hidden layer; The attention weight and the intermediate hidden layer influencing factors obtain the prediction result corresponding to the time series data, and display the prediction result to the client.
  • This application uses a convolution operation to extract attention weights, which can obtain information from earlier historical information; using a causal convolution method can avoid information leakage at future moments. This application also modifies the weight of the convolution kernel and adopts a multi-layer extraction method to obtain the attention weight more accurately.
  • Fig. 1 shows a flowchart of a method for calculating attention weights based on a convolutional neural network according to the present application
  • Figure 2 shows a block diagram of an attention model based on a temporal convolutional network of the present application
  • FIG. 3 shows a block diagram of an attention module of the present application
  • Figure 4 shows a schematic diagram of a deformable convolution of the present application
  • Figure 5 shows a block diagram of an attention module of a decoder of the present application
  • Fig. 6 shows a block diagram of an attention weight calculation device based on a convolutional neural network of the present application.
  • Fig. 1 shows a flow chart of an attention weight calculation method based on a convolutional neural network of the present application.
  • the first aspect of this application proposes a method for calculating attention weights based on convolutional neural networks, including:
  • S102 Receive time series data, and use a self-attention mechanism to calculate the attention weight of each feature in the time series data;
  • S104 Perform multi-layer attention weight extraction on the time series data, and obtain intermediate hidden layer influencing factors
  • S106 Calculate the attention weight of the benchmark data at different moments according to the influencing factors of the intermediate hidden layer and the benchmark data obtained in advance;
  • S108 Perform multi-layer attention weight extraction on the benchmark data, and use a self-attention mechanism to update the influencing factors of the intermediate hidden layer;
  • S110 Obtain a prediction result corresponding to the time series data according to the attention weight of the last layer and the influencing factors of the intermediate hidden layer, and display the prediction result to the client.
  • the method provided in this embodiment processes the time series data, and finally obtains the prediction result corresponding to the time series data, and displays the prediction result to the client, so that the client can realize the prediction according to the prediction result.
  • the prediction result corresponding to the historical financial market data will be displayed to the client, so that the client can predict the wind direction of the financial market based on the prediction result.
  • using the self-attention mechanism to calculate the attention weight of each feature in the time series data further includes:
  • performing multi-layer attention weight extraction on the reference data and using a self-attention mechanism to update the influencing factors of the intermediate hidden layer also includes:
  • obtaining and displaying the prediction result corresponding to the time series data according to the attention weight of the last layer and the influencing factors of the intermediate hidden layer further includes:
  • the prediction result is linearly transformed, and the classification prediction result is output through a normalized exponential function.
  • the normalized exponential function (softmax) is a generalization of the logical function, and it has a very wide range of applications in machine learning and deep learning. Especially when dealing with multi-classification (C>2) problems, the final output unit of the classifier requires a normalized exponential function for numerical processing.
  • V i is the output of the previous stage classifier output unit; I represents a category index, C represents the total number of categories; Si represents the index of the current element with the index and the ratio of all the elements.
  • the normalized exponential function can convert the output values of multiple categories into relative probabilities, making it easier to understand and compare.
  • the influencing factors of the intermediate hidden layer are extracted and generated based on historical time information and spatial information.
  • the method after receiving the time series data, the method further includes:
  • the time series data is historical value transfer data
  • the historical data includes a daily value transfer threshold, a value transfer amount, a value transfer value, and a value transfer index
  • the prediction result corresponding to the time series data is a preset time period
  • the preset time period is any one of one day, one week, and one month.
  • the historical data of value transfer is the historical data of the stock market.
  • the historical data of the stock market includes daily closing price, transaction volume, transaction volume and industry index; the prediction result corresponding to the historical data of the stock market is within a preset time period in the future
  • the preset time period is any one of one day, one week, and one month.
  • an attention model based on a temporal convolutional network can be established in advance.
  • the attention model includes N encoder attention modules and M decoder attention modules.
  • the daily historical stock data of the auto industry such as the daily closing price, transaction volume, transaction volume, industry index and other indicators, and calculate the volatility, mean value of ma, and increase/decrease. And other statistical indicators.
  • This input is a three-dimensional tensor.
  • the first dimension is the number of data
  • the second dimension is the time dimension of the data.
  • the input data is historical 60 days or 90 days.
  • the third dimension is the characteristic dimension.
  • the attention module use the self-attention mechanism to calculate the attention weight of each feature in the time series data.
  • it can be expanded Causal convolution is used as an attention module to extract attention weights from time series data.
  • the expansion causal convolution changes the receptive field of the convolution kernel by setting different expansion rates to obtain earlier historical information.
  • the extended causal convolution can be used as the attention module for extracting attention weights, and the attention weights of all time points can be extracted at the same time by extending the causal convolution.
  • the structure of the attention module is shown in Figure 3.
  • Q stands for query
  • K stands for key
  • V stands for value.
  • the feature extraction of Q is performed through the extended causal convolution module.
  • the information at time t contains historical information at time t-1, t-2..., and the specific duration Related to expansion rate.
  • the attention model can adaptively select the best duration.
  • the deformable convolution mechanism can be used for feature extraction to obtain comprehensive time dimension information.
  • the deformable convolution mechanism can automatically learn the appropriate expansion rate during the training process.
  • the normalized exponential function layer is used to obtain the attention contribution values of different features at different moments.
  • multi-layer attention extraction is performed on time series data, and the intermediate hidden layer output H of the decoder attention module is obtained, which represents abstraction from historical time and space information through multi-layer extraction Influence factors out.
  • the description is based on the sampling position of the 3 ⁇ 3 standard deformable convolution: (a) the regular sampling grid of the standard convolution; (b) the deformed sampling position, which has an enhanced bias in the deformable convolution Shift; (c) and (d) are special cases of (b), indicating that deformed convolution summarizes various scale transformations, (anisotropic) aspect ratios and rotations.
  • the offset ⁇ p n can be realized by bilinear interpolation, and the specific expression is:
  • G(.,.) is the bilinear interpolation kernel.
  • the aforementioned hidden layer output H is input to the attention module of the decoder.
  • the attention module the attention weight of the reference input at different times is calculated together with the reference input, and the calculation is used as the attention module of the layer. Output.
  • the hidden layer output H is updated by the self-attention module, and the updated H is used as the hidden layer input of the attention module of the next layer.
  • multi-layer attention weight extraction is performed on the reference input, and the hidden layer output H is continuously updated in the process, and then the final output prediction value is obtained, which is to predict the future period of time (such as 1 day or 1 week).
  • the output result of the decoder can be linearly transformed, and the final classification prediction value can be output through a normalized exponential function, and the stock price change can be classified and predicted (such as rise or fall).
  • the attention model further includes position coding, and the position coding is used to put position information into the input sequence.
  • the position information may include the position relationship of each element in the input sequence.
  • the above-mentioned attention model based on time convolutional network extracts attention weights by performing deformable convolution operations on time series data. After that, the extracted attention weights are stacked through attention modules to calculate time series data. Extract multiple self-attentions, and get the output H of the middle layer.
  • the attention weight obtained in this way can not only consider the impact of the previous time step (t-1), but also consider the earlier moments (t-2, t-3%) and the current moment (t). Influencing factors.
  • the weight value of attention can be extracted more accurately.
  • this application uses deformable convolution as the method of extracting attention weights. This method can extract information from earlier historical data, and the time span of its extraction can be learned. Therefore, it has better flexibility and accuracy.
  • the time series data and the hidden layer output H are updated at the same time, that is, H is continuously adjusted according to the feedback during the learning process, so that the obtained attention weight is more accurate.
  • the second aspect of the present application also proposes an attention weight calculation device 6 based on a convolutional neural network.
  • the attention weight calculation device 6 based on a convolutional neural network includes:
  • the input module 61 is configured to receive time series data, and use a self-attention mechanism to calculate the attention weight of each feature in the time series data;
  • the extraction module 62 performs multi-layer attention weight extraction on the time series data, and obtains the intermediate hidden layer influencing factors
  • the calculation module 63 calculates the attention weight of the reference data at different moments according to the influencing factors of the intermediate hidden layer and the reference data obtained in advance;
  • the learning module 64 performs multi-layer attention weight extraction on the reference data, and uses a self-attention mechanism to update the influencing factors of the intermediate hidden layer;
  • the output module 65 obtains the prediction result corresponding to the time series data according to the attention weight of the last layer and the influencing factors of the intermediate hidden layer, and displays the prediction result to the client.
  • using the self-attention mechanism to calculate the attention weight of each feature in the time series data further includes:
  • performing multi-layer attention weight extraction on the reference data and using a self-attention mechanism to update the influencing factors of the intermediate hidden layer also includes:
  • obtaining and displaying the prediction result corresponding to the time series data according to the attention weight of the last layer and the influencing factors of the intermediate hidden layer further includes:
  • the prediction result is linearly transformed, and the classification prediction result is output through a normalized exponential function.
  • the normalized exponential function is a generalization of the logical function, and it has a very wide range of applications in machine learning and deep learning. Especially when dealing with multi-classification (C>2) problems, the final output unit of the classifier requires a normalized exponential function for numerical processing.
  • V i is the output of the previous stage classifier output unit; I represents a category index, C represents the total number of categories; Si represents the index of the current element with the index and the ratio of all the elements.
  • the normalized exponential function can convert the output values of multiple categories into relative probabilities, making it easier to understand and compare.
  • the influencing factors of the intermediate hidden layer are extracted and generated based on historical time and space information.
  • the method after receiving the time series data, the method further includes:
  • time series data is historical data of the stock market, and the historical data includes daily closing price, transaction volume, transaction volume, and industry index;
  • prediction result corresponding to the time series data is stocks within a preset time period in the future For market fluctuations, the preset time period is any one of one day, one week, and one month.
  • the device further includes an attention model based on a temporal convolutional network, and the attention model includes N encoder attention modules and M decoder attention modules.
  • the daily historical stock data of the auto industry such as the daily closing price, transaction volume, transaction volume, industry index and other indicators, and calculate the volatility, mean value of ma, and increase/decrease. And other statistical indicators.
  • This input is a three-dimensional tensor.
  • the first dimension is the number of data
  • the second dimension is the time dimension of the data.
  • the input data is historical 60 days or 90 days.
  • the third dimension is the characteristic dimension.
  • the attention module use the self-attention mechanism to calculate the attention weight of each feature in the time series data.
  • it can be expanded Causal convolution is used as an attention module to extract attention weights from time series data.
  • the expansion causal convolution changes the receptive field of the convolution kernel by setting different expansion rates to obtain earlier historical information.
  • the extended causal convolution can be used as the attention module for extracting attention weights, and the attention weights of all time points can be extracted at the same time by extending the causal convolution.
  • the feature extraction of Q is performed through the extended causal convolution module.
  • the information at time t contains historical information at time t-1, t-2..., and the specific duration Related to expansion rate.
  • the attention model can adaptively select the best duration.
  • the deformable convolution mechanism can be used for feature extraction to obtain comprehensive time dimension information.
  • the deformable convolution mechanism can automatically learn the appropriate expansion rate during the training process.
  • the normalized exponential function layer is used to obtain the attention contribution values of different features at different moments.
  • the description is based on the sampling position of the 3 ⁇ 3 standard deformable convolution: (a) the regular sampling grid of the standard convolution; (b) the deformed sampling position, which has an enhanced offset in the deformable convolution; (c) and (d) is a special case of (b), indicating that deformed convolution summarizes various scale transformations, (anisotropic) aspect ratios and rotations.
  • the offset ⁇ p n can be realized by bilinear interpolation, and the specific expression is:
  • G(.,.) is the bilinear interpolation kernel.
  • the aforementioned hidden layer output H is input to the attention module of the decoder, and the attention weight of the reference input at different times is calculated in the attention module together with the reference input, and the calculation is used as the output of the attention module of this layer.
  • the hidden layer output H is updated by the self-attention module, and the updated H is used as the hidden layer input of the attention module of the next layer.
  • multi-layer attention weight extraction is performed on the reference input, and the hidden layer output H is continuously updated in the process, and then the final output prediction value is obtained, which is to predict the future period of time (such as 1 day or 1 week).
  • the output result of the decoder can be linearly transformed, and the final classification prediction value can be output through the normalized exponential function function to classify and predict the stock price change (such as rise and fall).
  • the attention model further includes position coding, and the position coding is used to put position information into the input sequence.
  • the position information may include the position relationship of each element in the input sequence.
  • the above-mentioned attention model based on time convolutional network extracts attention weights by performing deformable convolution operations on time series data. After that, the extracted attention weights are stacked through attention modules to calculate time series data. Extract multiple self-attentions, and get the output H of the middle layer.
  • the attention weight obtained in this way can not only consider the impact of the previous time step (t-1), but also consider the earlier moments (t-2, t-3%) and the current moment (t). Influencing factors.
  • the weight value of attention can be extracted more accurately.
  • this application uses deformable convolution as the method of extracting attention weights. This method can extract information from earlier historical data, and the time span of its extraction can be learned. Therefore, it has better flexibility and accuracy.
  • the time series data and the hidden layer output H are updated at the same time, that is, H is continuously adjusted according to the feedback during the learning process, so that the obtained attention weight is more accurate.
  • the third aspect of the present application also proposes a computer device, including a memory, a processor, and an attention weight calculation program based on a convolutional neural network that is stored on the memory and can run on the processor.
  • the processor When the program for calculating the attention weight based on the convolutional neural network is executed, the above-mentioned method for calculating the attention weight based on the convolutional neural network is realized.
  • the processor may be a central processing unit (Central Processing Unit, CPU), or other general-purpose processors, digital signal processing (Digital Signal Processor, DSP), and application specific integrated circuits (Application Specific Integrated Circuit). ASIC), Field-Programmable Gate Array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc.
  • the general-purpose processor may be a microprocessor or the processor may also be any conventional processor or the like.
  • the computer device may further include a display, and the prediction result is fed back to the user through the display.
  • the display may also be called a display screen or a display unit.
  • the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an organic light-emitting diode (OLED) touch device, and the like.
  • the display is used to display the information processed in the computer equipment and to display the visual work interface.
  • the fourth aspect of the present application also proposes a computer-readable storage medium.
  • the computer-readable storage medium may be non-volatile or volatile.
  • the computer-readable storage medium includes a convolutional neural The attention weight calculation program of the network. When the attention weight calculation program based on the convolutional neural network is executed by the processor, the steps of the above-mentioned attention weight calculation method based on the convolutional neural network are realized.
  • This application receives time series data and uses a self-attention mechanism to calculate the attention weight of each feature in the time series data; performs multi-layer attention weight extraction on the time series data, and obtains the intermediate hidden layer influencing factors; Calculate the attention weight of the benchmark data at different moments based on the influencing factors of the layer and the pre-acquired benchmark data; extract the attention weight of the benchmark data in multiple layers, and use the self-attention mechanism to update the influencing factors of the intermediate hidden layer; The attention weight and the intermediate hidden layer influencing factors obtain and display the prediction result corresponding to the time series data to the client.
  • This application uses a convolution operation to extract attention weights, which can obtain information from earlier historical information; using a causal convolution method can avoid information leakage at future moments. This application also modifies the weight of the convolution kernel and adopts a multi-layer extraction method to obtain the attention weight more accurately.
  • the disclosed device and method can be implemented in other ways.
  • the device embodiments described above are merely illustrative.
  • the division of the units is only a logical function division, and there may be other divisions in actual implementation, such as: multiple units or components can be combined, or It can be integrated into another device, or some features can be ignored or not implemented.
  • the coupling, or direct coupling, or communication connection between the components shown or discussed may be indirect coupling or communication connection through some interfaces, devices or units, and may be in electrical, mechanical or other forms. of.
  • the units described above as separate components may or may not be physically separate, and the components displayed as units may or may not be physical units; they may be located in one place or distributed on multiple network units; Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of the embodiment.
  • the functional units in the embodiments of the present application can be all integrated into one processing unit, or each unit can be individually used as a unit, or two or more units can be integrated into one unit;
  • the unit can be implemented in the form of hardware, or in the form of hardware plus software functional units.
  • the foregoing program can be stored in a computer readable storage medium.
  • the execution includes The steps of the foregoing method embodiment; and the foregoing storage medium includes: removable storage devices, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), magnetic disks or optical disks, etc.
  • the medium storing the program code.
  • the above-mentioned integrated unit of the present application is implemented in the form of a software function module and sold or used as an independent product, it may also be stored in a computer readable storage medium.
  • the computer software product is stored in a storage medium and includes several instructions for A computer device (which may be a personal computer, a server, or a network device, etc.) executes all or part of the methods described in the various embodiments of the present application.
  • the aforementioned storage media include: removable storage devices, ROM, RAM, magnetic disks, or optical disks and other media that can store program codes.

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Evolutionary Computation (AREA)
  • Molecular Biology (AREA)
  • Artificial Intelligence (AREA)
  • Biomedical Technology (AREA)
  • Biophysics (AREA)
  • Computational Linguistics (AREA)
  • Data Mining & Analysis (AREA)
  • Health & Medical Sciences (AREA)
  • General Health & Medical Sciences (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Mathematical Physics (AREA)
  • Software Systems (AREA)
  • Probability & Statistics with Applications (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)
  • Image Analysis (AREA)

Abstract

一种基于卷积神经网络的注意力权重计算方法,该方法包括:接收时序数据,并使用自注意力机制计算时序数据中各特征的注意力权重(S102);对时序数据进行多层注意力权重提取,并获得中间隐藏层影响因素(S104);根据中间隐藏层影响因素和预先获取的基准数据计算不同时刻基准数据的注意力权重(S106);对基准数据进行多层注意力权重提取,并使用自注意力机制更新中间隐藏层影响因素(S108);根据最后一层的注意力权重和中间隐藏层影响因素获取与所述时序数据对应的预测结果,并显示所述预测结果至客户端(S110)。其使用卷积操作提取注意力权重,可以从历史信息中获得信息;使用因果卷积的方式,可以避免未来时刻的信息泄露;还通过修正卷积核的权重并采用多层提取方式,可以准确地获取注意力权重。

Description

基于卷积神经网络的注意力权重计算方法、装置及设备
本申请基于巴黎公约申明享有2019年10月11日递交的申请号为CN201910962685.0、名称为“基于卷积神经网络的注意力权重计算方法、装置及设备”的中国专利申请的优先权,该中国专利申请的整体内容以参考的方式结合在本申请中。
技术领域
本申请涉及机器学习技术领域,尤其涉及一种基于卷积神经网络的注意力权重计算方法、装置及设备。
背景技术
近年来,深度学习技术得到了飞速发展,在解决高级抽象认知问题,例如图像识别、语音识别、自然语言理解、天气预测、基因表达、内容推荐和智能机器人等领域得到了广泛应用,成为学术界和工业界的研究热点。
深度神经网络是人工智能领域具有最高发展水平的感知模型之一,其通过建立模型来模拟人类大脑的神经连接结构,通过多个变换阶段分层对数据特征进行描述,为图像、视频和音频等大规模数据处理任务带来突破性进展。深度神经网络模型是一种运算模型,由大量节点通过网状互连结构构成,这些节点被称为神经元。每两个节点间连接强度都代表通过该连接信号在两个节点间的加权重,即权重,与人类神经网络中的记忆相对应。
注意力机制是一种策略,最早是在视觉图像领域提出来的。注意力机制的思想是提高有用信息的权重,从而让任务处理装置更专注于找到输入数据中显著的与当前输出相关的有用信息,从而提高输出的质量。从应用层面上来说,注意力机制分为空间注意力机制和时序注意力机制。
目前的时序注意力模型主要有两种,一种使用在RNN模型之中,通过前一时间步(t-1)的state推算下一时间步(t)的注意力权重值。发明人意识到这种方式过于注重前一时间步(t-1)的影响力,而对更早的时间步(如t-2)及现时(t)的影响力估计不足。另一种则通过输入tensor矩阵相乘的方式计算注意力权重,缺少可训练参数。并且其attention形式需要通过连接dense层进行特征提取,一方面模型参数过大,另一方面,在时序模型中简单使用dense层,存在未来信息泄露的风险。
发明内容
为了解决上述至少一个技术问题,本申请提出了一种基于卷积神经网络注意力权重计算方法和装置。
为了实现上述目的,本申请第一方面提出了一种基于卷积神经网络的注意力权重计算 方法,包括:
接收时序数据,并使用自注意力机制计算所述时序数据中各特征的注意力权重;
对所述时序数据进行多层注意力权重提取,并获得中间隐藏层影响因素;
根据中间隐藏层影响因素和预先获取的基准数据计算不同时刻基准数据的注意力权重;
对所述基准数据进行多层注意力权重提取,并使用自注意力机制更新中间隐藏层影响因素;
根据最后一层的注意力权重和中间隐藏层影响因素获取与所述时序数据对应的预测结果,并显示所述预测结果至客户端。
本申请第二方面还提出一种基于卷积神经网络的注意力权重计算装置,所述基于卷积神经网络的注意力权重计算装置包括:
输入模块,用于接收时序数据,并使用自注意力机制计算所述时序数据中各特征的注意力权重;
提取模块,对所述时序数据进行多层注意力权重提取,并获得中间隐藏层影响因素;
计算模块,根据中间隐藏层影响因素和预先获取的基准数据计算不同时刻基准数据的注意力权重;
学习模块,对所述基准数据进行多层注意力权重提取,并使用自注意力机制更新中间隐藏层影响因素;
输出模块,根据最后一层的注意力权重和中间隐藏层影响因素获取与所述时序数据对应的预测结果,并显示所述预测结果至客户端。
本申请第三方面还提出一种计算机设备,其中,该计算机设备包括:存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的基于卷积神经网络的注意力权重计算程序,所述基于卷积神经网络的注意力权重计算程序被处理器执行时,实现如下步骤:
接收时序数据,并使用自注意力机制计算所述时序数据中各特征的注意力权重;
对所述时序数据进行多层注意力权重提取,并获得中间隐藏层影响因素;
根据中间隐藏层影响因素和预先获取的基准数据计算不同时刻基准数据的注意力权重;
对所述基准数据进行多层注意力权重提取,并使用自注意力机制更新中间隐藏层影响因素;
根据最后一层的注意力权重和中间隐藏层影响因素获取与所述时序数据对应的预测结果,并显示所述预测结果至客户端。
本申请第四方面还提出一种计算机可读存储介质,所述计算机可读存储介质中包括一种基于卷积神经网络的注意力权重计算程序,所述基于卷积神经网络的注意力权重计算程序被处理器执行时,实现如下步骤:
接收时序数据,并使用自注意力机制计算所述时序数据中各特征的注意力权重;
对所述时序数据进行多层注意力权重提取,并获得中间隐藏层影响因素;
根据中间隐藏层影响因素和预先获取的基准数据计算不同时刻基准数据的注意力权重;
对所述基准数据进行多层注意力权重提取,并使用自注意力机制更新中间隐藏层影响因素;
根据最后一层的注意力权重和中间隐藏层影响因素获取与所述时序数据对应的预测结果,并显示所述预测结果至客户端。
本申请通过接收时序数据,并使用自注意力机制计算所述时序数据中各特征的注意力权重;对所述时序数据进行多层注意力权重提取,并获得中间隐藏层影响因素;根据中间隐藏层影响因素和预先获取的基准数据计算不同时刻基准数据的注意力权重;对所述基准数据进行多层注意力权重提取,并使用自注意力机制更新中间隐藏层影响因素;根据最后一层的注意力权重和中间隐藏层影响因素获取与所述时序数据对应的预测结果,并显示所述预测结果至客户端。本申请使用卷积操作提取注意力权重,可以从更早的历史信息中获得信息;使用因果卷积的方式,可以避免未来时刻的信息泄露。本申请还通过修正卷积核的权重并采用多层提取的方式,可以更准确地获取注意力权重。
本申请的附加方面和优点将在下面的描述部分中给出,部分将从下面的描述中变得明显,或通过本申请的实践了解到。
附图说明
图1示出了本申请一种基于卷积神经网络的注意力权重计算方法的流程图;
图2示出了本申请一种基于时间卷积网络的注意力模型的框图;
图3示出了本申请一种注意力模块的框图;
图4示出了本申请一种可变形卷积的示意图;
图5示出了本申请一种解码器注意力模块的框图;
图6示出了本申请一种基于卷积神经网络的注意力权重计算装置的框图。
具体实施方式
为了能够更清楚地理解本申请的上述目的、特征和优点,下面结合附图和具体实施方式对本申请进行进一步的详细描述。需要说明的是,在不冲突的情况下,本申请的实施例及实施例中的特征可以相互组合。
在下面的描述中阐述了很多具体细节以便于充分理解本申请,但是,本申请还可以采用其他不同于在此描述的其他方式来实施,因此,本申请的保护范围并不受下面公开的具体实施例的限制。
图1示出了本申请一种基于卷积神经网络的注意力权重计算方法的流程图。
如图1所示,本申请第一方面提出一种基于卷积神经网络的注意力权重计算方法,包 括:
S102,接收时序数据,并使用自注意力机制计算所述时序数据中各特征的注意力权重;
S104,对所述时序数据进行多层注意力权重提取,并获得中间隐藏层影响因素;
S106,根据中间隐藏层影响因素和预先获取的基准数据计算不同时刻基准数据的注意力权重;
S108,对所述基准数据进行多层注意力权重提取,并使用自注意力机制更新中间隐藏层影响因素;
S110,根据最后一层的注意力权重和中间隐藏层影响因素获取与所述时序数据对应的预测结果,并显示所述预测结果至客户端。
本实施例提供的该方法,对时序数据进行处理,最终获取与时序数据对应的预测结果,并将该预测结果显示至客户端,以供客户端根据该预测结果实现预测。
如:当时序数据为金融市场历史数据时,将于该金融市场历史数据对应的预测结果显示至客户端,以供客户端根据该预测结果对金融市场的风向进行预测。
根据本申请的实施例,使用自注意力机制计算所述时序数据中各特征的注意力权重,还包括:
使用可变形卷积机制对所述时序数据进行特征提取,以获取时间维度信息;
通过归一化指数函数层获取不同特征在不同时刻的注意力贡献值。
根据本申请的实施例,对所述基准数据进行多层注意力权重提取,并使用自注意力机制更新中间隐藏层影响因素,还包括:
对上一层的中间隐藏层影响因素进行自注意力更新处理;
根据更新后的中间隐藏层影响因素和上一层得到的基准数据的注意力权重计算下一层基准数据的注意力权重。
根据本申请的实施例,根据最后一层的注意力权重和中间隐藏层影响因素获取并显示与所述时序数据对应的预测结果,还包括:
将预测结果进行线性变换,并通过归一化指数函数输出分类预测结果。
需要说明的是,归一化指数函数(softmax),是逻辑函数的一种推广,其在机器学习和深度学习中有着非常广泛的应用。尤其在处理多分类(C>2)问题,分类器最后的输出单元需要归一化指数函数进行数值处理。关于归一化指数函数表达式为:
Figure PCTCN2020093549-appb-000001
其中,V i是分类器前级输出单元的输出;i表示类别索引,C表示总的类别个数;Si表示当前元素的指数与所有元素指数和的比值。归一化指数函数可以将多分类的输出数值转化为相对概率,更容易理解和比较。
优选的,所述中间隐藏层影响因素根据历史时间信息和空间信息提取生成。
根据本申请的实施例,在接收时序数据之后,还包括:
对所述时序数据进行扩张因果卷积操作以提取注意力权重。
进一步的,所述时序数据为数值转移历史数据,所述历史数据包括每日数值转移阈值、 数值转移量、数值转移价值以及数值转移指数;与所述时序数据对应的预测结果为预设时间段内数值转移的各项预测结果,所述预设时间段为一天、一周、一个月中的任意一种。
如:数值转移历史数据为股票市场的历史数据,股票市场的历史数据包括每日收盘价、交易量、交易额以及行业指数;与股票市场的历史数据对应的预测结果为未来预设时间段内股票市场的涨跌情况,所述预设时间段为一天、一周、一个月中的任意一种。
根据本申请的实施例,可以预先建立基于时间卷积网络的注意力模型,如图2所示,所述注意力模型包括N个编码器注意力模块及M个解码器注意力模块。
以A股市场汽车行业为例,首先获取到汽车行业的股票每日历史数据,如每日收盘价、交易量、交易额、行业指数等指标,同时计算出波动率、ma均值、涨跌幅等统计指标。将上述多种指标作为特征输入到注意力模型中,此输入为一个三维张量,第一维度为数据个数,第二维度为数据的时间维度,如输入数据为历史60天或90天的日频数据,第三维度为特征维度。
将上述历史数据整理为时序数据,之后,将时序数据输入到编码器注意力模块中,在注意力模块中使用自注意力机制计算时序数据中各特征的注意力权重,特别地,可以将扩张因果卷积作为注意力模块用于对时序数据进行注意力权重的提取。所述扩张因果卷积通过设置不同的扩张率改变卷积核感受野,以获取更早的历史信息。
需要说明的是,可以将扩展因果卷积作为提取注意力权重的注意力模块,通过扩展因果卷积可以同时提取所有时间点的注意力权重。注意力模块结构如图3所示,自注意力即图中的Q=K=V,其中,Q代表query,K代表key,V代表value。具体地,以Q为例,通过扩展因果卷积模块对Q进行特征提取,提取后在输出Q’之中,t时刻的信息包含了t-1,t-2…时刻的历史信息,具体时长与扩张率有关。通过将扩张率设置为可学习的参数,使注意力模型可以自适应地选择最佳的时长。在提取之后,将中间层输出Q’与K’通过矩阵相乘函数进行矩阵相乘,并通过归一化指数函数进行压缩来获取注意力权重。
需要说明的是,在注意力权重的计算过程中,可以使用可变形卷积机制进行特征提取,以获取全面的时间维度信息,可变形卷积机制可以在训练过程中自动学习合适的扩张率,以获取更准确、全面的时间维度信息。之后,通过归一化指数函数层获取不同特征在不同时刻的注意力贡献值。最后,通过多层注意力模块的堆叠,对时序数据进行多层注意力提取,并获得解码器注意力模块的中间隐藏层输出H,其代表了从历史时间、空间信息中通过多层提取抽象出的影响力因素。
如图4所示,基于3×3标准可变形卷积的采样位置进行说明:(a)标准卷积的规则采样网格;(b)变形的采样位置,在可变形卷积中具有增强偏移;(c)和(d)是(b)的特殊情况,表明变形卷积概括了各种尺度变换、(各向异性)纵横比和旋转。
需要说明的是,可变形卷积的表达式为:
Figure PCTCN2020093549-appb-000002
其中,偏移量Δp n可以通过双线性插值实现,具体表达式为:
Figure PCTCN2020093549-appb-000003
上述式中,G(.,.)为双线性插值核。
如图5所示,将前述的隐藏层输出H输入到解码器注意力模块中,在注意力模块中与基准输入共同计算不同时刻基准输入的注意力权重,计算后作为该层注意力模块的输出。同时,通过自注意力模块对隐藏层输出H做自注意力更新处理,更新后的H作为下一层注意力模块的隐藏层输入。之后,通过多层注意力模块的堆叠,对基准输入进行多层注意力权重提取,并在此过程中不断更新隐藏层输出H,进而获取最终的输出预测值,即预测未来一段时间内(如1天或1周)的涨跌情况。具体的,可以将解码器的输出结果进行线性变换,并通过归一化指数函数输出最终的分类预测值,对股价变化进行分类预测(如涨、跌)。
需要说明是,所述注意力模型还包括位置编码,所述位置编码用于对输入序列置入位置信息。优选的,所述位置信息可以包括输入序列中各元素的位置关系。
可以理解,上述基于时间卷积网络的注意力模型,通过对时序数据进行可变形卷积操作以提取注意力权重,之后,对提取到的注意力权重再通过注意力模块的堆叠以对时序数据提取多次自注意力,得到中间层输出H。使用这种方式得到的注意力权重,不仅可以考虑前一时间步(t-1)的影响,还可以考虑到更早时刻(t-2,t-3...)及当前时刻(t)的影响因素。此外,通过多层注意力机制,可以更准确地提取到注意力的权重值。
可以理解,本申请使用可变形卷积作为注意力权重的提取方式,这种方式可以从更早的历史数据中提取信息,同时其提取的时间跨度可以学习,因此,具有更好的灵活性和准确性。
可以理解,在解码器注意力模块的注意力模块中,同时对时序数据和隐藏层输出H进行更新,即在学习过程中根据反馈不断对H进行调整,从而使获取的注意力权重更加准确。
如图6所示,本申请第二方面还提出一种基于卷积神经网络的注意力权重计算装置6,所述基于卷积神经网络的注意力权重计算装置6包括:
输入模块61,用于接收时序数据,并使用自注意力机制计算所述时序数据中各特征的注意力权重;
提取模块62,对所述时序数据进行多层注意力权重提取,并获得中间隐藏层影响因素;
计算模块63,根据中间隐藏层影响因素和预先获取的基准数据计算不同时刻基准数据的注意力权重;
学习模块64,对所述基准数据进行多层注意力权重提取,并使用自注意力机制更新中间隐藏层影响因素;
输出模块65,根据最后一层的注意力权重和中间隐藏层影响因素获取与所述时序数据对应的预测结果,并显示所述预测结果至客户端。
根据本申请的实施例,使用自注意力机制计算所述时序数据中各特征的注意力权重,还包括:
使用可变形卷积机制对所述时序数据进行特征提取,以获取时间维度信息;
通过归一化指数函数层获取不同特征在不同时刻的注意力贡献值。
根据本申请的实施例,对所述基准数据进行多层注意力权重提取,并使用自注意力机制更新中间隐藏层影响因素,还包括:
对上一层的中间隐藏层影响因素进行自注意力更新处理;
根据更新后的中间隐藏层影响因素和上一层得到的基准数据的注意力权重计算下一层基准数据的注意力权重。
根据本申请的实施例,根据最后一层的注意力权重和中间隐藏层影响因素获取并显示与所述时序数据对应的预测结果,还包括:
将预测结果进行线性变换,并通过归一化指数函数输出分类预测结果。
需要说明的是,归一化指数函数,是逻辑函数的一种推广,其在机器学习和深度学习中有着非常广泛的应用。尤其在处理多分类(C>2)问题,分类器最后的输出单元需要归一化指数函数进行数值处理。关于归一化指数函数表达式为:
Figure PCTCN2020093549-appb-000004
其中,V i是分类器前级输出单元的输出;i表示类别索引,C表示总的类别个数;Si表示当前元素的指数与所有元素指数和的比值。归一化指数函数可以将多分类的输出数值转化为相对概率,更容易理解和比较。
优选的,所述中间隐藏层影响因素根据历史时间和空间信息提取生成。
根据本申请的实施例,在接收时序数据之后,还包括:
对所述时序数据进行扩张因果卷积操作以提取注意力权重。
进一步的,所述时序数据为股票市场的历史数据,所述历史数据包括每日收盘价、交易量、交易额以及行业指数;与所述时序数据对应的预测结果为未来预设时间段内股票市场的涨跌情况,所述预设时间段为一天、一周、一个月的任意一种。
根据本申请的实施例,所述装置还包括基于时间卷积网络的注意力模型,所述注意力模型包括N个编码器注意力模块及M个解码器注意力模块。
以A股市场汽车行业为例,首先获取到汽车行业的股票每日历史数据,如每日收盘价、交易量、交易额、行业指数等指标,同时计算出波动率、ma均值、涨跌幅等统计指标。将上述多种指标作为特征输入到注意力模型中,此输入为一个三维张量,第一维度为数据个数,第二维度为数据的时间维度,如输入数据为历史60天或90天的日频数据,第三维度为特征维度。
将上述历史数据整理为时序数据,之后,将时序数据输入到编码器注意力模块中,在注意力模块中使用自注意力机制计算时序数据中各特征的注意力权重,特别地,可以将扩张因果卷积作为注意力模块用于对时序数据进行注意力权重的提取。所述扩张因果卷积通过设置不同的扩张率改变卷积核感受野,以获取更早的历史信息。
需要说明的是,可以将扩展因果卷积作为提取注意力权重的注意力模块,通过扩展因果卷积可以同时提取所有时间点的注意力权重。自注意力即Q=K=V,其中,Q代表query,K代表key,V代表value。具体地,以Q为例,通过扩展因果卷积模块对Q进行特征提取,提取后在输出Q’之中,t时刻的信息包含了t-1,t-2…时刻的历史信息,具体时长与扩张率有关。通过将扩张率设置为可学习的参数,使注意力模型可以自适应地选择最佳的时长。在提取之后,将中间层输出Q’与K’通过矩阵相乘函数进行矩阵相乘,并通过归一化指数函数函数进行压缩来获取注意力权重。
需要说明的是,在注意力权重的计算过程中,可以使用可变形卷积机制进行特征提取,以获取全面的时间维度信息,可变形卷积机制可以在训练过程中自动学习合适的扩张率,以获取更准确、全面的时间维度信息。之后,通过归一化指数函数层获取不同特征在不同时刻的注意力贡献值。最后,通过多层注意力模块的堆叠,对时序数据进行多层注意力提取,并获得编码器注意力模块的中间隐藏层输出H,其代表了从历史时间、空间信息中通过多层提取抽象出的影响力因素。
基于3×3标准可变形卷积的采样位置进行说明:(a)标准卷积的规则采样网格;(b)变形的采样位置,在可变形卷积中具有增强偏移;(c)和(d)是(b)的特殊情况,表明变形卷积概括了各种尺度变换、(各向异性)纵横比和旋转。
需要说明的是,可变形卷积的表达式为:
Figure PCTCN2020093549-appb-000005
其中,偏移量Δp n可以通过双线性插值实现,具体表达式为:
Figure PCTCN2020093549-appb-000006
上述式中,G(.,.)为双线性插值核。
将前述的隐藏层输出H输入到解码器注意力模块中,在注意力模块中与基准输入共同计算不同时刻基准输入的注意力权重,计算后作为该层注意力模块的输出。同时,通过自注意力模块对隐藏层输出H做自注意力更新处理,更新后的H作为下一层注意力模块的隐藏层输入。之后,通过多层注意力模块的堆叠,对基准输入进行多层注意力权重提取,并在此过程中不断更新隐藏层输出H,进而获取最终的输出预测值,即预测未来一段时间内(如1天或1周)的涨跌情况。具体的,可以将解码器的输出结果进行线性变换,并通过归一化指数函数函数输出最终的分类预测值,对股价变化进行分类预测(如涨、跌)。
需要说明是,所述注意力模型还包括位置编码,所述位置编码用于对输入序列置入位置信息。优选的,所述位置信息可以包括输入序列中各元素的位置关系。
可以理解,上述基于时间卷积网络的注意力模型,通过对时序数据进行可变形卷积操作以提取注意力权重,之后,对提取到的注意力权重再通过注意力模块的堆叠以对时序数据提取多次自注意力,得到中间层输出H。使用这种方式得到的注意力权重,不仅可以考 虑前一时间步(t-1)的影响,还可以考虑到更早时刻(t-2,t-3...)及当前时刻(t)的影响因素。此外,通过多层注意力机制,可以更准确地提取到注意力的权重值。
可以理解,本申请使用可变形卷积作为注意力权重的提取方式,这种方式可以从更早的历史数据中提取信息,同时其提取的时间跨度可以学习,因此,具有更好的灵活性和准确性。
可以理解,在解码器注意力模块的注意力模块中,同时对时序数据和隐藏层输出H进行更新,即在学习过程中根据反馈不断对H进行调整,从而使获取的注意力权重更加准确。
本申请第三方面还提出一种计算机设备,包括存储器、处理器及存储在所述存储器上并可在所述处理器上运行的基于卷积神经网络的注意力权重计算程序,所述处理器执行所述基于卷积神经网络的注意力权重计算程序时实现如上述的基于卷积神经网络的注意力权重计算方法。
需要说明的是,所述处理器可以是中央处理单元(Central Processing Unit,CPU),还可以是其他通用处理器、数字信号处理(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现成可编程门阵列(Field-Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。
需要说明的是,所述计算机设备还可以包括显示器,所述预测结果通过显示器反馈给用户。所述显示器也可以称为显示屏或显示单元。在一些实施例中显示器可以是LED显示器、液晶显示器、触控式液晶显示器以及有机发光二极管(Organic Light-Emitting Diode,OLED)触摸器等。显示器用于显示在计算机设备中处理的信息以及用于显示可视化的工作界面。
本申请第四方面还提出一种计算机可读存储介质,所述计算机可读存储介质可以是非易失性,也可以是易失性,所述计算机可读存储介质中包括一种基于卷积神经网络的注意力权重计算程序,所述基于卷积神经网络的注意力权重计算程序被处理器执行时,实现如上述的一种基于卷积神经网络的注意力权重计算方法的步骤。
本申请通过接收时序数据,并使用自注意力机制计算所述时序数据中各特征的注意力权重;对所述时序数据进行多层注意力权重提取,并获得中间隐藏层影响因素;根据中间隐藏层影响因素和预先获取的基准数据计算不同时刻基准数据的注意力权重;对所述基准数据进行多层注意力权重提取,并使用自注意力机制更新中间隐藏层影响因素;根据最后一层的注意力权重和中间隐藏层影响因素获取并显示与所述时序数据对应的预测结果至客户端。本申请使用卷积操作提取注意力权重,可以从更早的历史信息中获得信息;使用因果卷积的方式,可以避免未来时刻的信息泄露。本申请还通过修正卷积核的权重并采用多层提取的方式,可以更准确地获取注意力权重。
在本申请所提供的几个实施例中,应该理解到,所揭露的设备和方法,可以通过其它 的方式实现。以上所描述的设备实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,如:多个单元或组件可以结合,或可以集成到另一个装置,或一些特征可以忽略,或不执行。另外,所显示或讨论的各组成部分相互之间的耦合、或直接耦合、或通信连接可以是通过一些接口,设备或单元的间接耦合或通信连接,可以是电性的、机械的或其它形式的。
上述作为分离部件说明的单元可以是、或也可以不是物理上分开的,作为单元显示的部件可以是、或也可以不是物理单元;既可以位于一个地方,也可以分布到多个网络单元上;可以根据实际的需要选择其中的部分或全部单元来实现本实施例方案的目的。
另外,在本申请各实施例中的各功能单元可以全部集成在一个处理单元中,也可以是各单元分别单独作为一个单元,也可以两个或两个以上单元集成在一个单元中;上述集成的单元既可以采用硬件的形式实现,也可以采用硬件加软件功能单元的形式实现。
本领域普通技术人员可以理解:实现上述方法实施例的全部或部分步骤可以通过程序指令相关的硬件来完成,前述的程序可以存储于计算机可读取存储介质中,该程序在执行时,执行包括上述方法实施例的步骤;而前述的存储介质包括:移动存储设备、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。
或者,本申请上述集成的单元如果以软件功能模块的形式实现并作为独立的产品销售或使用时,也可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请实施例的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机、服务器、或者网络设备等)执行本申请各个实施例所述方法的全部或部分。而前述的存储介质包括:移动存储设备、ROM、RAM、磁碟或者光盘等各种可以存储程序代码的介质。
以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以所述权利要求的保护范围为准。

Claims (20)

  1. 一种基于卷积神经网络的注意力权重计算方法,其中,包括:
    接收时序数据,并使用自注意力机制计算所述时序数据中各特征的注意力权重;
    对所述时序数据进行多层注意力权重提取,并获得中间隐藏层影响因素;
    根据中间隐藏层影响因素和预先获取的基准数据计算不同时刻基准数据的注意力权重;
    对所述基准数据进行多层注意力权重提取,并使用自注意力机制更新中间隐藏层影响因素;
    根据最后一层的注意力权重和中间隐藏层影响因素获取与所述时序数据对应的预测结果,并显示所述预测结果至客户端。
  2. 根据权利要求1所述的一种基于卷积神经网络的注意力权重计算方法,其中,使用自注意力机制计算所述时序数据中各特征的注意力权重,还包括:
    使用可变形卷积机制对所述时序数据进行特征提取,以获取时间维度信息;
    通过归一化指数函数层获取不同特征在不同时刻的注意力贡献值。
  3. 根据权利要求1所述的一种基于卷积神经网络的注意力权重计算方法,其中,对所述基准数据进行多层注意力权重提取,并使用自注意力机制更新中间隐藏层影响因素,还包括:
    对上一层的中间隐藏层影响因素进行自注意力更新处理;
    根据更新后的中间隐藏层影响因素和上一层得到的基准数据的注意力权重计算下一层基准数据的注意力权重。
  4. 根据权利要求1所述的一种基于卷积神经网络的注意力权重计算方法,其中,根据最后一层的注意力权重和中间隐藏层影响因素获取并显示与所述时序数据对应的预测结果,还包括:
    将预测结果进行线性变换,并通过归一化指数函数输出分类预测结果。
  5. 根据权利要求1所述的一种基于卷积神经网络的注意力权重计算方法,其中,所述中间隐藏层影响因素根据历史时间信息和空间信息提取生成。
  6. 根据权利要求1所述的一种基于卷积神经网络的注意力权重计算方法,其中,在接收时序数据之后,还包括:
    对所述时序数据进行扩张因果卷积操作以提取注意力权重。
  7. 根据权利要求1所述的一种基于卷积神经网络的注意力权重计算方法,其中,
    所述时序数据为数值转移历史数据,所述历史数据包括每日数值转移阈值、数值转移量、数值转移价值以及数值转移指数;与所述时序数据对应的预测结果为预设时间段内数值转移的各项预测结果,所述预设时间段为一天、一周、一个月中的任意一种。
  8. 一种基于卷积神经网络的注意力权重计算装置,其中,所述基于卷积神经网络的注 意力权重计算装置包括:
    输入模块,用于接收时序数据,并使用自注意力机制计算所述时序数据中各特征的注意力权重;
    提取模块,对所述时序数据进行多层注意力权重提取,并获得中间隐藏层影响因素;
    计算模块,根据中间隐藏层影响因素和预先获取的基准数据计算不同时刻基准数据的注意力权重;
    学习模块,对所述基准数据进行多层注意力权重提取,并使用自注意力机制更新中间隐藏层影响因素;
    输出模块,根据最后一层的注意力权重和中间隐藏层影响因素获取与所述时序数据对应的预测结果,并显示所述预测结果至客户端。
  9. 一种计算机设备,其中,该计算机设备包括:存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的基于卷积神经网络的注意力权重计算程序,所述基于卷积神经网络的注意力权重计算程序被处理器执行时,实现如下步骤:
    接收时序数据,并使用自注意力机制计算所述时序数据中各特征的注意力权重;
    对所述时序数据进行多层注意力权重提取,并获得中间隐藏层影响因素;
    根据中间隐藏层影响因素和预先获取的基准数据计算不同时刻基准数据的注意力权重;
    对所述基准数据进行多层注意力权重提取,并使用自注意力机制更新中间隐藏层影响因素;
    根据最后一层的注意力权重和中间隐藏层影响因素获取与所述时序数据对应的预测结果,并显示所述预测结果至客户端。
  10. 如权利要求9所述的计算机设备,其中,使用自注意力机制计算所述时序数据中各特征的注意力权重,还包括:
    使用可变形卷积机制对所述时序数据进行特征提取,以获取时间维度信息;
    通过归一化指数函数层获取不同特征在不同时刻的注意力贡献值。
  11. 如权利要求9所述的计算机设备,其中,对所述基准数据进行多层注意力权重提取,并使用自注意力机制更新中间隐藏层影响因素,还包括:
    对上一层的中间隐藏层影响因素进行自注意力更新处理;
    根据更新后的中间隐藏层影响因素和上一层得到的基准数据的注意力权重计算下一层基准数据的注意力权重。
  12. 如权利要求9所述的计算机设备,其中,根据最后一层的注意力权重和中间隐藏层影响因素获取并显示与所述时序数据对应的预测结果,还包括:
    将预测结果进行线性变换,并通过归一化指数函数输出分类预测结果。
  13. 如权利要求9所述的计算机设备,其中,所述中间隐藏层影响因素根据历史时间信息和空间信息提取生成。
  14. 如权利要求9所述的计算机设备,其中,在接收时序数据之后,还包括:
    对所述时序数据进行扩张因果卷积操作以提取注意力权重。
  15. 如权利要求9所述的计算机设备,其中,所述时序数据为数值转移历史数据,所述历史数据包括每日数值转移阈值、数值转移量、数值转移价值以及数值转移指数;与所述时序数据对应的预测结果为预设时间段内数值转移的各项预测结果,所述预设时间段为一天、一周、一个月中的任意一种。
  16. 一种计算机可读存储介质,其中,所述计算机可读存储介质中包括一种基于卷积神经网络的注意力权重计算程序,所述基于卷积神经网络的注意力权重计算程序被处理器执行时,实现如下步骤:
    接收时序数据,并使用自注意力机制计算所述时序数据中各特征的注意力权重;
    对所述时序数据进行多层注意力权重提取,并获得中间隐藏层影响因素;
    根据中间隐藏层影响因素和预先获取的基准数据计算不同时刻基准数据的注意力权重;
    对所述基准数据进行多层注意力权重提取,并使用自注意力机制更新中间隐藏层影响因素;
    根据最后一层的注意力权重和中间隐藏层影响因素获取与所述时序数据对应的预测结果,并显示所述预测结果至客户端。
  17. 如权利要求16所述的计算机可读存储介质,其中,使用自注意力机制计算所述时序数据中各特征的注意力权重,还包括:
    使用可变形卷积机制对所述时序数据进行特征提取,以获取时间维度信息;
    通过归一化指数函数层获取不同特征在不同时刻的注意力贡献值。
  18. 如权利要求16所述的计算机可读存储介质,其中,对所述基准数据进行多层注意力权重提取,并使用自注意力机制更新中间隐藏层影响因素,还包括:
    对上一层的中间隐藏层影响因素进行自注意力更新处理;
    根据更新后的中间隐藏层影响因素和上一层得到的基准数据的注意力权重计算下一层基准数据的注意力权重。
  19. 如权利要求16所述的计算机可读存储介质,其中,根据最后一层的注意力权重和中间隐藏层影响因素获取并显示与所述时序数据对应的预测结果,还包括:
    将预测结果进行线性变换,并通过归一化指数函数输出分类预测结果。
  20. 如权利要求16所述的计算机可读存储介质,其中,所述中间隐藏层影响因素根据历史时间信息和空间信息提取生成。
PCT/CN2020/093549 2019-10-11 2020-05-29 基于卷积神经网络的注意力权重计算方法、装置及设备 WO2021068528A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910962685.0A CN110909862A (zh) 2019-10-11 2019-10-11 基于卷积神经网络的注意力权重计算方法和装置
CN201910962685.0 2019-10-11

Publications (1)

Publication Number Publication Date
WO2021068528A1 true WO2021068528A1 (zh) 2021-04-15

Family

ID=69815554

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/093549 WO2021068528A1 (zh) 2019-10-11 2020-05-29 基于卷积神经网络的注意力权重计算方法、装置及设备

Country Status (2)

Country Link
CN (1) CN110909862A (zh)
WO (1) WO2021068528A1 (zh)

Cited By (21)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113380237A (zh) * 2021-06-09 2021-09-10 中国科学技术大学 增强局部依赖关系无监督预训练语音识别模型及训练方法
CN113535399A (zh) * 2021-07-15 2021-10-22 电子科技大学 一种nfv资源调度方法、装置以及系统
CN113591593A (zh) * 2021-07-06 2021-11-02 厦门路桥信息股份有限公司 基于因果干预的异常天气下目标检测方法、设备及介质
CN113655884A (zh) * 2021-08-17 2021-11-16 河北师范大学 设备控制方法、终端及系统
CN113705809A (zh) * 2021-09-07 2021-11-26 北京航空航天大学 一种数据预测模型训练方法、工业指标预测方法和装置
CN113806534A (zh) * 2021-09-03 2021-12-17 电子科技大学 一种面向社交网络的热点事件预测方法
CN114444572A (zh) * 2021-12-25 2022-05-06 西北工业大学 一种面向数据错误的空中目标意图识别方法及装置
CN114819053A (zh) * 2022-03-04 2022-07-29 中国人民解放军国防科技大学 基于时空卷积lstm的平均波向预报偏差订正方法
CN114971007A (zh) * 2022-05-20 2022-08-30 山东华科信息技术有限公司 基于多尺度图卷积神经网络的光伏发电预测方法及系统
CN115174421A (zh) * 2022-06-13 2022-10-11 湖北工业大学 基于自监督解缠绕超图注意力的网络故障预测方法及装置
CN115880567A (zh) * 2023-03-03 2023-03-31 深圳精智达技术股份有限公司 一种自注意力的计算方法、装置、电子设备和存储介质
CN116128122A (zh) * 2023-01-03 2023-05-16 北京交通大学 一种考虑突发因素的城市轨道交通短时客流预测方法
CN116310810A (zh) * 2022-12-06 2023-06-23 青岛柯锐思德电子科技有限公司 基于空间注意力引导可变卷积的跨域高光谱图像分类方法
CN116417992A (zh) * 2023-03-10 2023-07-11 华中科技大学 基于时空注意力机制的风机功率预测模型建立方法及应用
CN116955965A (zh) * 2023-09-20 2023-10-27 山东鑫泰莱光电股份有限公司 一种基于太阳能数据故障预测方法、设备以及存储介质
CN117114207A (zh) * 2023-10-23 2023-11-24 山东科技大学 一种海上人员漂移轨迹预测方法
CN117237749A (zh) * 2023-09-15 2023-12-15 上海谱希和光基因科技有限公司 一种眼轴长度预测方法、系统、设备
CN117725841A (zh) * 2024-02-04 2024-03-19 宝鸡核力材料科技有限公司 一种用于提升tc4卷带成材率的方法及系统
CN117975573A (zh) * 2024-03-29 2024-05-03 华南理工大学 基于CNN-Transformer混合模型的手语翻译方法和系统
CN117992741A (zh) * 2024-04-07 2024-05-07 国网山东省电力公司营销服务中心(计量中心) 基于广域相量测量数据的cvt误差状态评估方法及系统
CN118054650A (zh) * 2024-04-16 2024-05-17 深圳市芯仙半导体有限公司 一种电源模块稳压供电控制方法及系统

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110909862A (zh) * 2019-10-11 2020-03-24 平安科技(深圳)有限公司 基于卷积神经网络的注意力权重计算方法和装置
CN111507521B (zh) * 2020-04-15 2023-12-01 北京智芯微电子科技有限公司 台区电力负荷预测方法及预测装置
CN112183886B (zh) * 2020-10-22 2024-03-15 南京信息工程大学 基于卷积网络和注意力机制的短时临近降雨预测方法
CN113283529B (zh) * 2021-06-08 2022-09-06 南通大学 一种面向多模态图像能见度检测的神经网络构建方法
CN114795178B (zh) * 2022-04-28 2023-05-05 电子科技大学 一种基于多注意力神经网络的大脑状态解码方法
CN115841343B (zh) * 2022-12-16 2024-01-30 广州飞狮数字科技有限公司 一种销售额度的确定方法及装置
CN116307266A (zh) * 2023-05-15 2023-06-23 山东建筑大学 作物生长预测方法、装置、电子设备及存储介质
CN116839900B (zh) * 2023-07-06 2024-01-30 昌辉汽车转向系统(黄山)有限公司 基于因果注意的时序卷积网络的故障诊断方法

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150254554A1 (en) * 2014-03-04 2015-09-10 Nec Corporation Information processing device and learning method
CN109598387A (zh) * 2018-12-14 2019-04-09 华东师范大学 基于双向跨模态注意力网络模型的股价预测方法及系统
CN109710919A (zh) * 2018-11-27 2019-05-03 杭州电子科技大学 一种融合注意力机制的神经网络事件抽取方法
CN110163401A (zh) * 2018-02-12 2019-08-23 腾讯科技(深圳)有限公司 时间序列的预测方法、数据预测方法和装置
CN110909862A (zh) * 2019-10-11 2020-03-24 平安科技(深圳)有限公司 基于卷积神经网络的注意力权重计算方法和装置

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150254554A1 (en) * 2014-03-04 2015-09-10 Nec Corporation Information processing device and learning method
CN110163401A (zh) * 2018-02-12 2019-08-23 腾讯科技(深圳)有限公司 时间序列的预测方法、数据预测方法和装置
CN109710919A (zh) * 2018-11-27 2019-05-03 杭州电子科技大学 一种融合注意力机制的神经网络事件抽取方法
CN109598387A (zh) * 2018-12-14 2019-04-09 华东师范大学 基于双向跨模态注意力网络模型的股价预测方法及系统
CN110909862A (zh) * 2019-10-11 2020-03-24 平安科技(深圳)有限公司 基于卷积神经网络的注意力权重计算方法和装置

Cited By (33)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113380237A (zh) * 2021-06-09 2021-09-10 中国科学技术大学 增强局部依赖关系无监督预训练语音识别模型及训练方法
CN113591593A (zh) * 2021-07-06 2021-11-02 厦门路桥信息股份有限公司 基于因果干预的异常天气下目标检测方法、设备及介质
CN113591593B (zh) * 2021-07-06 2023-08-15 厦门路桥信息股份有限公司 基于因果干预的异常天气下目标检测方法、设备及介质
CN113535399A (zh) * 2021-07-15 2021-10-22 电子科技大学 一种nfv资源调度方法、装置以及系统
CN113655884A (zh) * 2021-08-17 2021-11-16 河北师范大学 设备控制方法、终端及系统
CN113806534A (zh) * 2021-09-03 2021-12-17 电子科技大学 一种面向社交网络的热点事件预测方法
CN113806534B (zh) * 2021-09-03 2023-04-18 电子科技大学 一种面向社交网络的热点事件预测方法
CN113705809B (zh) * 2021-09-07 2024-03-19 北京航空航天大学 一种数据预测模型训练方法、工业指标预测方法和装置
CN113705809A (zh) * 2021-09-07 2021-11-26 北京航空航天大学 一种数据预测模型训练方法、工业指标预测方法和装置
CN114444572A (zh) * 2021-12-25 2022-05-06 西北工业大学 一种面向数据错误的空中目标意图识别方法及装置
CN114819053A (zh) * 2022-03-04 2022-07-29 中国人民解放军国防科技大学 基于时空卷积lstm的平均波向预报偏差订正方法
CN114819053B (zh) * 2022-03-04 2024-05-03 中国人民解放军国防科技大学 基于时空卷积lstm的平均波向预报偏差订正方法
CN114971007A (zh) * 2022-05-20 2022-08-30 山东华科信息技术有限公司 基于多尺度图卷积神经网络的光伏发电预测方法及系统
CN115174421B (zh) * 2022-06-13 2023-05-23 湖北工业大学 基于自监督解缠绕超图注意力的网络故障预测方法及装置
CN115174421A (zh) * 2022-06-13 2022-10-11 湖北工业大学 基于自监督解缠绕超图注意力的网络故障预测方法及装置
CN116310810A (zh) * 2022-12-06 2023-06-23 青岛柯锐思德电子科技有限公司 基于空间注意力引导可变卷积的跨域高光谱图像分类方法
CN116310810B (zh) * 2022-12-06 2023-09-15 青岛柯锐思德电子科技有限公司 基于空间注意力引导可变卷积的跨域高光谱图像分类方法
CN116128122A (zh) * 2023-01-03 2023-05-16 北京交通大学 一种考虑突发因素的城市轨道交通短时客流预测方法
CN116128122B (zh) * 2023-01-03 2023-09-12 北京交通大学 一种考虑突发因素的城市轨道交通短时客流预测方法
CN115880567B (zh) * 2023-03-03 2023-07-25 深圳精智达技术股份有限公司 一种自注意力的计算方法、装置、电子设备和存储介质
CN115880567A (zh) * 2023-03-03 2023-03-31 深圳精智达技术股份有限公司 一种自注意力的计算方法、装置、电子设备和存储介质
CN116417992A (zh) * 2023-03-10 2023-07-11 华中科技大学 基于时空注意力机制的风机功率预测模型建立方法及应用
CN116417992B (zh) * 2023-03-10 2024-03-19 华中科技大学 基于时空注意力机制的风机功率预测模型建立方法及应用
CN117237749A (zh) * 2023-09-15 2023-12-15 上海谱希和光基因科技有限公司 一种眼轴长度预测方法、系统、设备
CN116955965B (zh) * 2023-09-20 2024-02-02 山东鑫泰莱光电股份有限公司 一种基于太阳能数据故障预测方法、设备以及存储介质
CN116955965A (zh) * 2023-09-20 2023-10-27 山东鑫泰莱光电股份有限公司 一种基于太阳能数据故障预测方法、设备以及存储介质
CN117114207B (zh) * 2023-10-23 2024-02-06 山东科技大学 一种海上人员漂移轨迹预测方法
CN117114207A (zh) * 2023-10-23 2023-11-24 山东科技大学 一种海上人员漂移轨迹预测方法
CN117725841A (zh) * 2024-02-04 2024-03-19 宝鸡核力材料科技有限公司 一种用于提升tc4卷带成材率的方法及系统
CN117725841B (zh) * 2024-02-04 2024-04-30 宝鸡核力材料科技有限公司 一种用于提升tc4卷带成材率的方法及系统
CN117975573A (zh) * 2024-03-29 2024-05-03 华南理工大学 基于CNN-Transformer混合模型的手语翻译方法和系统
CN117992741A (zh) * 2024-04-07 2024-05-07 国网山东省电力公司营销服务中心(计量中心) 基于广域相量测量数据的cvt误差状态评估方法及系统
CN118054650A (zh) * 2024-04-16 2024-05-17 深圳市芯仙半导体有限公司 一种电源模块稳压供电控制方法及系统

Also Published As

Publication number Publication date
CN110909862A (zh) 2020-03-24

Similar Documents

Publication Publication Date Title
WO2021068528A1 (zh) 基于卷积神经网络的注意力权重计算方法、装置及设备
CN109299396B (zh) 融合注意力模型的卷积神经网络协同过滤推荐方法及系统
CN107480261B (zh) 一种基于深度学习细粒度人脸图像快速检索方法
US11113598B2 (en) Dynamic memory network
Wu et al. Evolving RBF neural networks for rainfall prediction using hybrid particle swarm optimization and genetic algorithm
CN110163299A (zh) 一种基于自底向上注意力机制和记忆网络的视觉问答方法
US20160350653A1 (en) Dynamic Memory Network
CN106446927B (zh) 一种自步增强图像分类方法及系统
CN110362723A (zh) 一种题目特征表示方法、装置及存储介质
CN113837308B (zh) 基于知识蒸馏的模型训练方法、装置、电子设备
CN110543566B (zh) 一种基于自注意力近邻关系编码的意图分类方法
CN106503853A (zh) 一种基于多标度卷积神经网络的外汇交易预测模型
WO2021142904A1 (zh) 视频分析方法及其相关的模型训练方法、设备、装置
CN112699215B (zh) 基于胶囊网络与交互注意力机制的评级预测方法及系统
TWI670628B (zh) 動作評量模型生成裝置及其動作評量模型生成方法
CN110263973B (zh) 预测用户行为的方法及装置
CN111626827A (zh) 基于序列推荐模型的物品推荐方法、装置、设备及介质
US11847389B2 (en) Device and method for optimizing an input parameter in a processing of a semiconductor
CN113449182A (zh) 一种知识信息个性化推荐方法及系统
CN114445121A (zh) 一种广告点击率预测模型构建及广告点击率预测方法
CN113821724A (zh) 一种基于时间间隔增强的图神经网络推荐方法
CN115294405B (zh) 农作物病害分类模型的构建方法、装置、设备及介质
CN116028319A (zh) 基于用户交互行为的预测方法、装置及存储介质
CN115619563A (zh) 一种基于神经网络的股票价格分析方法
CN114358186A (zh) 一种数据处理方法、装置及计算机可读存储介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20874047

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20874047

Country of ref document: EP

Kind code of ref document: A1