CN111782500A - Method and apparatus for generating data - Google Patents

Method and apparatus for generating data Download PDF

Info

Publication number
CN111782500A
CN111782500A CN201910573166.5A CN201910573166A CN111782500A CN 111782500 A CN111782500 A CN 111782500A CN 201910573166 A CN201910573166 A CN 201910573166A CN 111782500 A CN111782500 A CN 111782500A
Authority
CN
China
Prior art keywords
ant
data
position point
path
data sequence
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
CN201910573166.5A
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.)
Beijing Wodong Tianjun Information Technology Co Ltd
Original Assignee
Beijing Wodong Tianjun Information Technology Co Ltd
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 Beijing Wodong Tianjun Information Technology Co Ltd filed Critical Beijing Wodong Tianjun Information Technology Co Ltd
Priority to CN201910573166.5A priority Critical patent/CN111782500A/en
Publication of CN111782500A publication Critical patent/CN111782500A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3692Test management for test results analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/004Artificial life, i.e. computing arrangements simulating life
    • G06N3/006Artificial life, i.e. computing arrangements simulating life based on simulated virtual individual or collective life forms, e.g. social simulations or particle swarm optimisation [PSO]

Abstract

The embodiment of the application discloses a method and a device for generating data. One embodiment of the method comprises: selecting data of the latest N moments from historical data as an original data sequence, wherein N is a natural number greater than 1; determining model parameters of a gray theoretical model constructed based on the original data sequence by using an ant colony algorithm; and generating the predicted data of the next moment by using the gray theoretical model after the model parameters are determined. This embodiment can improve the accuracy of short-term prediction.

Description

Method and apparatus for generating data
Technical Field
The embodiment of the application relates to the technical field of computers, in particular to a method and a device for generating data.
Background
With the rapid development of modern information technology, software systems have penetrated various fields of national economy and national defense construction, and even various aspects of human activities. The software system plays an increasingly large role in each equipment link, and the scale and the importance of the software system are on a steep rising trend. For example, the on-board systems of a space shuttle have approximately 50 ten thousand lines of code, the ground control and processing system code is approximately 35 ten thousand lines, and the overall space system has approximately one million lines of code. High stability is extremely important for equipment, and the stability of most equipment systems is determined by the reliability of the computer software system. Therefore, the reliability of the software system is directly related to the reliability of the entire system.
Software reliability is defined as the probability that software will not fail under specified conditions for a specified time. The process of modeling the software reliability is a process of finding out the rule of software failure and predicting or evaluating the software reliability. A software reliability model may also be understood as a set of methods that evaluate or predict software reliability by analyzing software failure data to find the regularity of the software failure data. The software reliability prediction based on the software failure data obtained in the software testing stage is one of the main methods for software reliability evaluation.
Disclosure of Invention
The embodiment of the application provides a method and a device for generating data.
In a first aspect, an embodiment of the present application provides a method for generating data, where the method includes: selecting data of the latest N moments from historical data as an original data sequence, wherein N is a natural number greater than 1; determining model parameters of a gray theoretical model constructed based on the original data sequence by using an ant colony algorithm; and generating the predicted data of the next moment by using the gray theoretical model after the model parameters are determined.
In some embodiments, determining model parameters of a gray theoretical model constructed based on the raw data sequence using an ant colony algorithm comprises: generating a processed data sequence by once accumulation based on the original data sequence; constructing a gray theoretical model by taking the processed data sequence as a data column; the model parameters of the gray theoretical model are determined using an ant colony algorithm.
In some embodiments, determining model parameters for the gray theoretical model using an ant colony algorithm includes: taking the data in the processed data sequence as position points to be searched by ants, and initializing pheromones on paths between the position points; setting an initial position point of an ant, and executing the following selection steps: determining a path which each ant passes through from the initial position point to the rest position points based on the pheromones on the path; selecting a target path from the determined paths to minimize the average relative error between the accumulation reduction value and the true value of the simulation prediction value of the original data sequence; and if the preset termination condition is met, determining model parameters of the gray theoretical model based on the target path.
In some embodiments, determining model parameters for the gray theoretical model using the ant colony algorithm further comprises: if the preset termination condition is not met, resetting the initial position point of the ant and executing the selection step again.
In some embodiments, determining the path each ant has traversed from the initial location point to the remaining location points based on the concentration of the pheromone on the path comprises: taking the initial position point as the current position point, executing the searching step: selecting a next position point which allows the ants to reach based on the concentration of the pheromones on each path, and moving the ants to the selected next position point; and if the next position point allowing the ant to reach does not exist, updating the pheromone on the path passed by the ant.
In some embodiments, determining a path that each ant travels from the initial location point to the remaining location points based on the pheromone concentration on the path further comprises: if the next position point allowing the ant to reach exists, the position point where the ant is located is used as the current position point, and the searching step is continuously executed.
In some embodiments, generating the prediction data for the next time using the gray theoretical model after the model parameters are determined comprises: generating a predicted value of the processed data sequence by using the gray theoretical model determined by the model parameters; and carrying out subtraction reduction on the predicted value to generate predicted data at the next moment.
In some embodiments, setting an initial location point of an ant includes: all ants were set at the same initial location point.
In some embodiments, setting an initial location point of an ant includes: ants are distributed at a plurality of location points.
In some embodiments, the method further comprises: and generating early warning information in response to the generated prediction data being larger than a preset threshold value.
In some embodiments, 4 ≦ N ≦ 8.
In a second aspect, an embodiment of the present application provides an apparatus for generating data, the apparatus including: the data selecting unit is configured to select data of the latest N moments from the historical data as an original data sequence, wherein N is a natural number greater than 1; a parameter determination unit configured to determine model parameters of a gray theoretical model constructed based on the original data sequence using an ant colony algorithm; and a data generation unit configured to generate prediction data of a next time using the gray theoretical model after the model parameter determination.
In some embodiments, the parameter determination unit comprises: an accumulation module configured to generate a processed data sequence by one accumulation based on an original data sequence; the model building module is configured to build a gray theoretical model by taking the processed data sequence as a data column; a parameter determination module configured to determine model parameters of the gray theoretical model using an ant colony algorithm.
In some embodiments, the parameter determination module comprises: the pheromone initialization module is configured to take the data in the processed data sequence as position points to be searched by ants and initialize pheromones on paths between the position points; the path selection module is configured to set an initial position point of the ant, and execute the following selection steps: determining a path which each ant passes through from the initial position point to the rest position points based on the concentration of the pheromone on the path; selecting a target path from the determined paths to minimize the average relative error between the accumulation reduction value and the true value of the simulation prediction value of the original data sequence; and if the preset termination condition is met, determining model parameters of the gray theoretical model based on the target path.
In some embodiments, the parameter determination module further comprises: and the continuous execution module is configured to reset the initial position point of the ant and execute the selection step again if the preset termination condition is not met.
In some embodiments, determining the path each ant has traversed from the initial location point to the remaining location points based on the concentration of the pheromone on the path comprises: taking the initial position point as the current position point, executing the searching step: selecting a next position point which allows the ants to reach based on the concentration of the pheromones on each path, and moving the ants to the selected next position point; and if the next position point allowing the ant to reach does not exist, updating the pheromone on the path passed by the ant.
In some embodiments, determining a path that each ant travels from the initial location point to the remaining location points based on the pheromone concentration on the path further comprises: if the next position point allowing the ant to reach exists, the position point where the ant is located is used as the current position point, and the searching step is continuously executed.
In some embodiments, the data generation unit comprises: a predicted value generation module configured to generate a predicted value of the processed data sequence using the determined model parameters; and the data reduction module is configured to perform accumulation reduction on the predicted value to generate predicted data at the next moment.
In some embodiments, setting an initial location point of an ant includes: all ants were set at the same initial location point.
In some embodiments, setting an initial location point of an ant includes: ants are distributed at a plurality of location points.
In some embodiments, the apparatus further comprises: an early warning unit configured to generate early warning information in response to the generated prediction data being greater than a preset threshold.
In some embodiments, 4 ≦ N ≦ 8.
In a third aspect, an embodiment of the present application provides an electronic device, including: one or more processors; a storage device having one or more programs stored thereon; when the one or more programs are executed by the one or more processors, the one or more processors are caused to implement the method as described in any implementation of the first aspect.
In a fourth aspect, the present application provides a computer-readable medium, on which a computer program is stored, which, when executed by a processor, implements the method as described in any implementation manner of the first aspect.
According to the method and the device for generating data, the data of the latest N moments are selected from the historical data to serve as the original data sequence, then the ant colony algorithm is used for determining the model parameters of the gray theoretical model constructed based on the original data sequence, and finally the model parameters are used for determining the gray theoretical model to generate the predicted data of the next moment, so that the accuracy of short-term prediction can be improved.
Drawings
Other features, objects and advantages of the present application will become more apparent upon reading of the following detailed description of non-limiting embodiments thereof, made with reference to the accompanying drawings in which:
FIG. 1 is an exemplary system architecture diagram in which one embodiment of the present application may be applied;
FIG. 2 is a flow diagram of one embodiment of a method for generating data according to the present application;
FIG. 3 is a schematic block diagram of one embodiment of an apparatus for generating data according to the present application;
fig. 4 is a schematic structural diagram of an electronic device suitable for implementing embodiments of the present application.
Detailed Description
The present application will be described in further detail with reference to the following drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the relevant invention and not restrictive of the invention. It should be noted that, for convenience of description, only the portions related to the related invention are shown in the drawings.
It should be noted that the embodiments and features of the embodiments in the present application may be combined with each other without conflict. The present application will be described in detail below with reference to the embodiments with reference to the attached drawings.
Fig. 1 shows an exemplary system architecture 100 to which embodiments of the method for generating data or the apparatus for generating data of the present application may be applied.
As shown in fig. 1, the system architecture 100 may include terminal devices 101, 102, 103, a network 104, and a server 105. The network 104 serves as a medium for providing communication links between the terminal devices 101, 102, 103 and the server 105. Network 104 may include various connection types, such as wired, wireless communication networks, or fiber optic cables, among others.
The user may use the terminal devices 101, 102, 103 to interact with the server 105 via the network 104 to receive or send messages or the like. The terminal devices 101, 102, 103 may have installed thereon various communication client applications, such as a data prediction application, a browser application, a shopping-like application, a search-like application, an instant messaging tool, a mailbox client, social platform software, and the like.
The terminal apparatuses 101, 102, and 103 may be hardware or software. When the terminal devices 101, 102, 103 are hardware, they may be various electronic devices supporting vehicle price evaluation, including but not limited to smart phones, tablet computers, Personal Digital Assistants (PDAs), laptop portable computers, desktop computers, and the like. When the terminal apparatuses 101, 102, 103 are software, they can be installed in the electronic apparatuses listed above. It may be implemented as multiple pieces of software or software modules (e.g., to provide distributed services) or as a single piece of software or software module. And is not particularly limited herein.
The server 105 may be a server providing various services, such as a background server providing support for data prediction applications running on the terminal devices 101, 102, 103. The backend server may analyze local or remote history data, and feed back a processing result (e.g., prediction data) to the terminal apparatuses 101, 102, and 103.
The server 105 may be hardware or software. When the server 105 is hardware, it may be implemented as a distributed server cluster composed of a plurality of servers, or may be implemented as a single server. When the server 105 is software, it may be implemented as multiple pieces of software or software modules (e.g., software or software modules used to provide distributed services) or as a single piece of software or software module. And is not particularly limited herein.
It should be noted that the method for generating data provided in the embodiment of the present application may be executed by the terminal devices 101, 102, and 103, or may be executed by the server 105. Accordingly, the means for generating data may be provided in the terminal devices 101, 102, 103, or in the server 105.
It is noted that the system architecture 100 may not include the server 105. When the system architecture 100 does not include the server 105, the terminal devices 101, 102, 103 may obtain the history data locally.
It should be understood that the number of terminal devices, networks, and servers in fig. 1 is merely illustrative. There may be any suitable number of terminal devices, networks, and servers, as desired for implementation.
With continued reference to FIG. 2, a flow 200 of one embodiment of a method for generating data in accordance with the present application is shown. The method for generating data may be applied to a terminal device or a server, and may include the steps of:
in step 201, data of the latest N moments are selected from the historical data as an original data sequence.
In the present embodiment, the execution subject (e.g., terminal apparatus 101, 102, 103 or server 105 of fig. 1) of the method for generating data may select data of the latest N time instants as the original data sequence from history data stored locally or remotely (e.g., server). Wherein N is a natural number greater than 1.
By way of example, in the application scenario of software reliability testing, historical data is historical accumulated failure data detected in the software running process, and a data sequence (x) can be used1,x2,…,xm) To indicate. The execution body may be selected from x in the data sequencemInitially, N data are selected forward as the original data sequence. Wherein x isiAnd the software failure data at the ith moment is i, i is a natural number between 1 and m, and m is a natural number greater than N.
In some application scenarios, early data has little effect on predicting future behavior. For example, in the application scenario of software reliability testing, especially in the case of repairable failures, recent failure data may reflect the characteristics of the software better. Meanwhile, since the gray theoretical model has the characteristic that a small amount of data can be predicted, in some optional implementation manners of this embodiment, the value of N may be: n is more than or equal to 4 and less than or equal to 8.
Step 202, using an ant colony algorithm to determine model parameters of a gray theoretical model constructed based on the original data sequence.
In the present embodiment, the executing subject of the method for generating data (e.g., the terminal device 101, 102, 103 or the server 105 of fig. 1) may first construct a gray theoretical model based on the original data sequence of step 201, and then determine model parameters of the constructed gray theoretical model using an ant colony algorithm.
The ant colony algorithm is a bionic method for natural ants in the process of searching food, and the ants finally find out the optimal path between the nest and the food through continuous iteration updating. The ant releases a certain pheromone on the current path in the process of searching the path, and if the path is longer, the released pheromone is lower; when the ant touches an obstacle, the ant randomly selects a road with a certain probability, and the size of the probability is determined by the concentration of pheromones on the road. The pheromone has volatility, the concentration of the pheromone on the optimal path is higher and higher along with the time, the concentrations of other paths are volatilized along with the time, and finally the optimal path is found by the whole ant colony.
In some alternative implementations of this embodiment, the gray theoretical model may be constructed by: first, a processed data sequence is generated by one-time accumulation based on an original data sequence (hereinafter also referred to as a one-time accumulation generated data sequence); and then, constructing a gray theoretical model by taking the data sequence generated by the primary accumulation as a data column.
As an example, given a raw data sequence X(0)={x(0)(k) (k ═ 1, …, m is a natural number greater than 3), where x(0)(k) Is the raw data at time k.
Firstly, the original data sequence is accumulated once to obtain a once-accumulated generated data sequence X(1)={x(1)(k) }, wherein:
Figure BDA0002111388650000081
thereafter, a data sequence X is generated by a single accumulation(1)Constructing a sequence of close-proximity mean-generated data Z(1)={z(1)(k) }, wherein:
z(1)(k)=λx(1)(k-1)+(1-λ)x(1)(k),λ∈[0,1](2)
suppose X(1)With a rule of approximate exponential change, the whitening differential equation of the gray theoretical model is:
Figure BDA0002111388650000082
discretizing the above formula to obtain a gray differential equation of a gray theoretical model:
x(0)(k)+Az(1)(k)=B (4)
a, B are the model parameters of the gray theoretical model to be determined.
In some optional implementation manners of this embodiment, determining the model parameters of the gray theoretical model by using the ant colony algorithm may specifically include the following steps:
firstly, data in a data sequence generated by one-time accumulation is used as position points to be searched by ants, and pheromones on paths between the position points are initialized.
Then, setting an initial position point of each ant, and executing the following selection steps: determining a path which each ant passes through from the initial position point to the rest position points based on the concentration of the pheromone on the path; selecting a target path from the determined paths to minimize the average relative error between the accumulation reduction value and the true value of the simulation prediction value of the original data sequence; and if the preset termination condition is met, determining model parameters of the gray theoretical model based on the target path.
If the preset termination condition is not met, the initial position point of the ant is reset, and the selection step is executed again.
In some optional implementations of this embodiment, determining, based on the concentration of the pheromone on the path, a path through which each ant moves from the initial position point to the remaining position points may specifically include the following steps:
taking the initial position point as the current position point, executing the searching step: selecting a next position point which allows the ants to reach based on the concentration of the pheromones on each path, and moving the ants to the selected next position point; and if the next position point allowing the ant to reach does not exist, updating the pheromone on the path passed by the ant.
If the next position point allowing the ant to reach exists, the position point where the ant is located is used as the current position point, and the searching step is continuously executed.
This is specifically illustrated by way of example.
First, pheromones on the path between the position points are initialized by equations (5) and (6):
Figure BDA0002111388650000091
Figure BDA0002111388650000092
where σ is the pheromone base number, Δ τijPheromones additionally added according to the length of the path between the ith position point and the jth position point, phi (i) is a set of position points which are allowed to be reached by ants, dijIs the distance from the ith position point to the jth position point, τij(0)The pheromone on the path between the ith position point and the jth position point at time 0.
Thereafter, an initial position point of each ant is set. This is equivalent to placing each ant at a corresponding initial location point and adding the initial location point to the set of location points that are prohibited from reaching.
Then, the probability of moving to the next position point is determined according to the pheromone concentration on the path:
Figure BDA0002111388650000093
wherein the content of the first and second substances,
Figure BDA0002111388650000101
the transition probability of the ant k moving from the ith position point to the jth position point at the time t, phi (k) is a set of position points which the ant k is allowed to reach, α and β are functions of pheromone accumulated by the ant k in the moving process at different position points, and tauij(t)For the pheromone on the path between the ith position point and the jth position point at time t, ηijIs visibility (equal to the reciprocal of the distance from the ith position point to the jth position point).
Each ant selects the next position point according to the probability determined by the formula (7), so that the path which each ant passes through from the initial position point to the rest position points can be obtained (and the pheromone on the transfer path of each ant is updated).
If the ant finishes traversing all the position points, the parameters A, B and the initial value x obtained in the moving process of all the ants are moved(0)(1) Substituting the value of (d) into the following equation:
Figure BDA0002111388650000102
obtaining a prediction value of a data sequence generated by one-time accumulation
Figure BDA0002111388650000103
Performing a subtraction operation on the predicted value to obtain a simulated predicted value of the original data sequence
Figure BDA0002111388650000104
Figure BDA0002111388650000105
Then, the adaptive value f of each ant is calculated according to the formula (10) under the criterion that the maximum relative error reaches the minimum, and the optimal path (i.e., the target path) is found.
Figure BDA0002111388650000106
If the preset termination condition is met, outputting the obtained optimal parameter solution A, B and the initial value x(0)(1) Otherwise, resetting the initial position point of each ant and executing the selecting step again. Here, the preset termination condition may mean that a preset number of iterations is reached.
In some optional implementations of the present embodiment, the setting of the initial location point of the ant may include: all ants were set at the same initial location point.
In some optional implementations of the present embodiment, the setting of the initial location point of the ant may include: ants are distributed at a plurality of location points. For example, all ants are randomly placed at m location points. The ants are distributed at a plurality of position points, and the pheromone with higher concentration is initialized on a longer path and the pheromone with lower concentration is initialized on a shorter path, so that the randomness of the ants for selecting the next position point can be improved, and the problems that the local convergence is too fast and the ants are easy to fall into the local optimal solution can be avoided.
It should be noted that, although the embodiment describes generating the once accumulation generated data sequence to construct the gray theoretical model, the application is not limited thereto. It should be understood that the gray theory model may be constructed in other manners, for example, the raw data sequence is accumulated for multiple times to generate a data sequence, and the gray theory model is constructed by using the data sequence generated by multiple times. Those skilled in the art can set the setting according to the needs of the actual application scenario.
And step 203, generating prediction data of the next moment by using the gray theoretical model after the model parameters are determined.
In this embodiment, the executing body (e.g., the terminal device 101, 102, 103 or the server 105 of fig. 1) of the method for generating data may generate the predicted data at the next time using the gray theoretical model after the model parameter determination.
In some optional implementations of this embodiment, step 203 may specifically include the following two steps:
firstly, generating a predicted value of a data sequence by primary accumulation by using a gray theoretical model after model parameters are determined;
then, the predicted value is subtracted and restored to generate predicted data at the next moment.
In some optional implementations of this embodiment, the method for generating data may further include: and generating early warning information in response to the generated prediction data being larger than a preset threshold value.
According to the method for generating data provided by the above embodiment of the application, the data of the latest N moments are selected from the historical data as the original data sequence, then the ant colony algorithm is used for determining the model parameters of the gray theoretical model constructed based on the original data sequence, and finally the predicted data of the next moment is generated by using the gray theoretical model determined by the model parameters, so that the accuracy of short-term prediction can be improved.
With further reference to fig. 3, as an implementation of the method shown in fig. 2, the present application provides an embodiment of an apparatus for generating data, where the embodiment of the apparatus corresponds to the embodiment of the method shown in fig. 2, and the apparatus may be specifically applied to a terminal device or a server.
As shown in fig. 3, the apparatus 300 for generating data of the present embodiment may include a data selecting unit 301, a parameter determining unit 302, and a data generating unit 303. Wherein, the data selecting unit 301 may be configured to select the data of the most recent N time instants from the history data as the original data sequence. Wherein N is a natural number greater than 1. The parameter determination unit 302 may be configured to determine model parameters of a gray theoretical model constructed based on the raw data sequence using an ant colony algorithm. The data generating unit 303 may be configured to generate prediction data of the next time using the gray theoretical model after the model parameter determination.
In this embodiment, for specific implementation of the data selecting unit 301, the parameter determining unit 302, and the data generating unit 303 of the apparatus 300 for generating data, reference may be made to the related description of step 201 to step 203 in the embodiment corresponding to fig. 2, and no further description is given here.
In some optional implementations of the present embodiment, the parameter determining unit 302 may include an accumulation module, a model building module, and a parameter determining module. Wherein the accumulation module may be configured to generate the once-accumulated generated data sequence based on the original data sequence. The model building module may be configured to build a gray theoretical model for the data column with the data sequence generated by the one-time accumulation. The parameter determination module may be configured to determine model parameters of the gray theoretical model using an ant colony algorithm.
In some optional implementation manners of this embodiment, the parameter determining module may include a pheromone initializing module and a path selecting module. The pheromone initialization module can be configured to take data in the data sequence generated by one-time accumulation as position points to be searched by ants, and initialize pheromones on paths between the position points. The path selection module may be configured to: setting an initial position point of an ant, and executing the following selection steps: determining a path which each ant passes through from the initial position point to the rest position points based on the concentration of the pheromone on the path; selecting a target path from the determined paths to minimize the average relative error between the accumulation reduction value and the true value of the simulation prediction value of the original data sequence; and if the preset termination condition is met, determining model parameters of the gray theoretical model based on the target path.
In some optional implementations of this embodiment, the parameter determining module may further include a continuing execution module. The continuous execution module can be configured to reset the initial position point of the ant and execute the selecting step again if the preset termination condition is not met.
In some optional implementations of this embodiment, determining, based on the pheromone concentration on the path, a path through which each ant moves from the initial location point to the remaining location points includes: taking the initial position point as the current position point, executing the searching step: selecting a next position point which allows the ants to reach based on the concentration of the pheromones on each path, and moving the ants to the selected next position point; and if the next position point allowing the ant to reach does not exist, updating the pheromone on the path passed by the ant.
In some optional implementations of this embodiment, determining, based on the pheromone concentration on the path, a path through which each ant moves from the initial location point to the remaining location points further includes: if the next position point allowing the ant to reach exists, the position point where the ant is located is used as the current position point, and the searching step is continuously executed.
In some optional implementations of this embodiment, the data generating unit 303 may include a predicted value generating module and a data restoring module. Wherein the predicted value generation module can be configured to generate the predicted value of the data sequence through once accumulation by using the gray theory model determined by the model parameters. The data reduction module may be configured to perform subtraction reduction on the predicted value to generate predicted data at a next time.
In some optional implementations of the present embodiment, the setting of the initial location point of the ant may include: all ants were set at the same initial location point.
In some optional implementations of the present embodiment, the setting of the initial location point of the ant may include: ants are distributed at a plurality of location points.
In some optional implementations of this embodiment, the apparatus 300 may further include an early warning unit. Wherein the early warning unit may be configured to generate the early warning information in response to the generated prediction data being greater than a preset threshold.
In some alternative implementations of the present embodiment, 4 ≦ N ≦ 8.
The apparatus for generating data according to the above embodiment of the present application selects the data of the most recent N moments from the historical data as the original data sequence, then determines the model parameters of the gray theoretical model constructed based on the original data sequence by using the ant colony algorithm, and finally generates the predicted data of the next moment by using the gray theoretical model determined by using the model parameters, thereby improving the accuracy of short-term prediction.
Referring now to fig. 4, a schematic diagram of an electronic device (e.g., the terminal devices 101, 102, 103 or the server 105 of fig. 1) 400 suitable for implementing embodiments of the present application is shown. The electronic device shown in fig. 4 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present application.
As shown in fig. 4, electronic device 400 may include a processing device (e.g., central processing unit, graphics processor, etc.) 401 that may perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM)402 or a program loaded from a storage device 408 into a Random Access Memory (RAM) 403. In the RAM403, various programs and data necessary for the operation of the electronic apparatus 400 are also stored. The processing device 401, the ROM 402, and the RAM403 are connected to each other via a bus 404. An input/output (I/O) interface 405 is also connected to bus 404.
The following devices may be connected to the I/O interface 405 in general: an input device 406 including, for example, a mouse, keyboard, or touch screen; an output device 407 including, for example, a Liquid Crystal Display (LCD) or the like; storage 408 including, for example, tape, hard disk, etc.; and a communication device 409. The communication means 409 may allow the electronic device 400 to communicate wirelessly or by wire with other devices to exchange data. While fig. 4 illustrates an electronic device 400 having various means, it is to be understood that not all illustrated means are required to be implemented or provided. More or fewer devices may alternatively be implemented or provided. Each block shown in fig. 4 may represent one device or may represent multiple devices as desired.
In particular, according to an embodiment of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network via the communication device 409, or from the storage device 408, or from the ROM 402. The computer program, when executed by the processing apparatus 401, performs the above-described functions defined in the methods of embodiments of the present disclosure. It should be noted that the computer readable medium in the present disclosure may be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In embodiments of the disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In embodiments of the present disclosure, however, a computer readable signal medium may comprise a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, optical cables, RF (radio frequency), etc., or any suitable combination of the foregoing.
The computer readable medium may be embodied in the apparatus; or may be present separately and not assembled into the device. The computer readable medium carries one or more programs which, when executed by the apparatus, cause the apparatus to: selecting data of the latest N moments from historical data as an original data sequence, wherein N is a natural number greater than 1; determining model parameters of a gray theoretical model constructed based on the original data sequence by using an ant colony algorithm; and generating the predicted data of the next moment by using the gray theoretical model after the model parameters are determined.
Computer program code for carrying out operations for embodiments of the present disclosure may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C + +, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units described in the embodiments of the present disclosure may be implemented by software or hardware. The described units may also be provided in a processor, and may be described as: a processor includes a data selecting unit, a parameter determining unit, and a data generating unit. The names of the units do not form a limitation on the units themselves in some cases, and for example, the data selecting unit may also be described as a unit for selecting data of the latest N time instants from the history data as the original data sequence.
The foregoing description is only exemplary of the preferred embodiments of the disclosure and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the invention in the present disclosure is not limited to the specific combination of the above-mentioned features, but also encompasses other embodiments in which any combination of the above-mentioned features or their equivalents is possible without departing from the inventive concept as defined above. For example, the above features and (but not limited to) the features disclosed in this disclosure having similar functions are replaced with each other to form the technical solution.

Claims (20)

1. A method for generating data, comprising:
selecting data of the latest N moments from historical data as an original data sequence, wherein N is a natural number greater than 1;
determining model parameters of a gray theoretical model constructed based on the original data sequence by using an ant colony algorithm;
and generating the predicted data of the next moment by using the gray theoretical model after the model parameters are determined.
2. The method of claim 1, wherein the determining model parameters of a gray theoretical model constructed based on the raw data sequence using an ant colony algorithm comprises:
generating a processed data sequence by once accumulation based on the original data sequence;
constructing a gray theoretical model by taking the processed data sequence as a data column;
the model parameters of the gray theoretical model are determined using an ant colony algorithm.
3. The method of claim 2, wherein the determining model parameters of the gray theoretical model using ant colony algorithm comprises:
taking the data in the processed data sequence as position points to be searched by ants, and initializing pheromones on paths between the position points;
setting an initial position point of an ant, and executing the following selection steps: determining a path which each ant passes through from the initial position point to the rest position points based on the concentration of the pheromone on the path; selecting a target path from the determined paths, and enabling the average relative error between the accumulation reduction value and the true value of the simulation prediction value of the original data sequence to be minimum; and if the preset termination condition is met, determining model parameters of the gray theoretical model based on the target path.
4. The method of claim 3, wherein the determining model parameters of the gray theoretical model using ant colony algorithm further comprises:
if the preset termination condition is not met, resetting the initial position point of the ant and executing the selecting step again.
5. The method as claimed in claim 3 or 4, wherein the determining the path each ant passes through from the initial position point to the rest position points based on the concentration of pheromones on the path comprises:
taking the initial position point as the current position point, executing the searching step: selecting a next position point which allows the ants to reach based on the concentration of the pheromones on each path, and moving the ants to the selected next position point; and if the next position point allowing the ant to reach does not exist, updating the pheromone on the path passed by the ant.
6. The method as claimed in claim 5, wherein the determining the path each ant passes through from the initial location point to the remaining location points based on the concentration of pheromones on the path further comprises:
if the next position point allowing the ant to reach exists, the position point where the ant is located is used as the current position point, and the searching step is continuously executed.
7. The method of claim 1, wherein the generating prediction data for the next time using the determined model parameters for the gray theoretical model comprises:
generating a predicted value of the processed data sequence by using the gray theoretical model determined by the model parameters;
and carrying out subtraction reduction on the predicted value to generate predicted data at the next moment.
8. The method as claimed in claim 3, wherein the setting of the initial location point of the ants comprises: all ants were set at the same initial location point.
9. The method as claimed in claim 3, wherein the setting of the initial location point of the ants comprises: ants are distributed at a plurality of location points.
10. The method of claim 1, wherein the method further comprises:
and generating early warning information in response to the generated prediction data being larger than a preset threshold value.
11. The method of claim 1, wherein 4 ≦ N ≦ 8.
12. An apparatus for generating data, comprising:
the data selecting unit is configured to select data of the latest N moments from the historical data as an original data sequence, wherein N is a natural number greater than 1;
a parameter determination unit configured to determine model parameters of a gray theoretical model constructed based on the raw data sequence using an ant colony algorithm;
and a data generation unit configured to generate prediction data of a next time using the gray theoretical model after the model parameter determination.
13. The apparatus of claim 12, wherein the parameter determination unit comprises:
an accumulation module configured to generate a processed data sequence by one accumulation based on the original data sequence;
the model building module is configured to build a gray theoretical model by taking the processed data sequence as a data column;
a parameter determination module configured to determine model parameters of the gray theoretical model using an ant colony algorithm.
14. The apparatus of claim 13, wherein the parameter determination module comprises:
the pheromone initialization module is configured to take the data in the processed data sequence as position points to be searched by ants and initialize pheromones on paths between the position points;
the path selection module is configured to set an initial position point of the ant, and execute the following selection steps: determining a path which each ant passes through from the initial position point to the rest position points based on the concentration of the pheromone on the path; selecting a target path from the determined paths, and enabling the average relative error between the accumulation reduction value and the true value of the simulation prediction value of the original data sequence to be minimum; and if the preset termination condition is met, determining model parameters of the gray theoretical model based on the target path.
15. The apparatus of claim 14, wherein the parameter determination module further comprises:
and the continuous execution module is configured to reset the initial position point of the ant and execute the selection step again if the preset termination condition is not met.
16. The apparatus as claimed in claim 14 or 15, wherein the determining the path each ant passes through from the initial position point to the rest position points based on the concentration of pheromones on the path comprises:
taking the initial position point as the current position point, executing the searching step: selecting a next position point which allows the ants to reach based on the concentration of the pheromones on each path, and moving the ants to the selected next position point; and if the next position point allowing the ant to reach does not exist, updating the pheromone on the path passed by the ant.
17. The apparatus as claimed in claim 16, wherein the determining of the path each ant passes through from the initial location point to the remaining location points based on the concentration of pheromones on the path further comprises:
if the next position point allowing the ant to reach exists, the position point where the ant is located is used as the current position point, and the searching step is continuously executed.
18. The apparatus of claim 1, wherein the data generation unit comprises:
a predicted value generation module configured to generate a predicted value of the processed data sequence using the determined model parameters;
and the data reduction module is configured to perform accumulation reduction on the predicted value to generate predicted data at the next moment.
19. An electronic device, comprising:
one or more processors;
a storage device having one or more programs stored thereon,
when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-11.
20. A computer-readable medium, on which a computer program is stored, wherein the program, when executed by a processor, implements the method of any one of claims 1-11.
CN201910573166.5A 2019-06-28 2019-06-28 Method and apparatus for generating data Pending CN111782500A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910573166.5A CN111782500A (en) 2019-06-28 2019-06-28 Method and apparatus for generating data

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910573166.5A CN111782500A (en) 2019-06-28 2019-06-28 Method and apparatus for generating data

Publications (1)

Publication Number Publication Date
CN111782500A true CN111782500A (en) 2020-10-16

Family

ID=72755264

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910573166.5A Pending CN111782500A (en) 2019-06-28 2019-06-28 Method and apparatus for generating data

Country Status (1)

Country Link
CN (1) CN111782500A (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104732091A (en) * 2015-03-25 2015-06-24 武汉大学 Cellular automaton river bed evolution prediction method based on natural selection ant colony algorithm
CN105389623A (en) * 2015-10-22 2016-03-09 东南大学 Thermal process model parameter identification method adopting improved ant colony algorithm
CN106779242A (en) * 2016-12-30 2017-05-31 中国银联股份有限公司 A kind of method and apparatus for setting up grey forecasting model
CN107705157A (en) * 2017-10-19 2018-02-16 大连理工大学 Automotive supplies Method for Sales Forecast method and system based on unified dynamic integrity model and meta-heuristic algorithm
CN109474973A (en) * 2018-12-03 2019-03-15 上海金卓网络科技有限公司 Method, apparatus, equipment and medium are determined based on the ad hoc network path of ant group algorithm

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104732091A (en) * 2015-03-25 2015-06-24 武汉大学 Cellular automaton river bed evolution prediction method based on natural selection ant colony algorithm
CN105389623A (en) * 2015-10-22 2016-03-09 东南大学 Thermal process model parameter identification method adopting improved ant colony algorithm
CN106779242A (en) * 2016-12-30 2017-05-31 中国银联股份有限公司 A kind of method and apparatus for setting up grey forecasting model
CN107705157A (en) * 2017-10-19 2018-02-16 大连理工大学 Automotive supplies Method for Sales Forecast method and system based on unified dynamic integrity model and meta-heuristic algorithm
CN109474973A (en) * 2018-12-03 2019-03-15 上海金卓网络科技有限公司 Method, apparatus, equipment and medium are determined based on the ad hoc network path of ant group algorithm

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
白晓波: "《非线性系统的状态估计方法》", 西南交通大学出版社, pages: 60 - 61 *

Similar Documents

Publication Publication Date Title
CN110276446B (en) Method and device for training model and selecting recommendation information
EP3446260B1 (en) Memory-efficient backpropagation through time
JP2020047285A (en) Training neural network using prioritized experience memory
CN110766142A (en) Model generation method and device
CN110263938B (en) Method and apparatus for generating information
CN110807515A (en) Model generation method and device
CN111090756B (en) Artificial intelligence-based multi-target recommendation model training method and device
CN110909942B (en) Method and system for training model and method and system for predicting sequence data
CN111340221B (en) Neural network structure sampling method and device
CN111708876B (en) Method and device for generating information
CN111582479B (en) Distillation method and device for neural network model
CN111539479A (en) Method and device for generating sample data
CN111368973B (en) Method and apparatus for training a super network
CN111353601A (en) Method and apparatus for predicting delay of model structure
CN111147431B (en) Method and apparatus for generating information
CN111783810B (en) Method and device for determining attribute information of user
US20180314978A1 (en) Learning apparatus and method for learning a model corresponding to a function changing in time series
CN111563593A (en) Training method and device of neural network model
CN112989146A (en) Method, apparatus, device, medium, and program product for recommending resources to a target user
CN116684330A (en) Traffic prediction method, device, equipment and storage medium based on artificial intelligence
CN114780338A (en) Host information processing method and device, electronic equipment and computer readable medium
CN114818913A (en) Decision generation method and device
CN114119123A (en) Information pushing method and device
CN111782500A (en) Method and apparatus for generating data
CN115391661A (en) Method for training recommendation model, method for recommending resources and device thereof

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination