Model training method and device, equipment and storage medium

By using the method of generating timestamps and matching traffic characteristic values ​​in model training, the problem of low model stability in the prior art is solved, and a more accurate traffic prediction model is achieved.

CN119885104APending Publication Date: 2025-04-25BEIJING SHOUGANG AUTOMATION INFORMATION TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411965954.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-30
Publication Date
2025-04-25

AI Technical Summary

Technical Problem

In the prior art, the model is not stable and cannot ensure the diversity of test data, resulting in inaccurate model prediction results.

Method used

By obtaining the preset test time period, multiple timestamps are generated, and at least two corresponding traffic characteristic values ​​are matched for each timestamp, multi-dimensional sample data is formed, and the initial model is trained based on these sample data to generate a traffic prediction model.

Benefits of technology

By matching timestamps with traffic characteristic values, multi-dimensional sample data is generated, which enhances the diversity and flexibility of the data, making the trained traffic prediction model more stable and the prediction results are more accurate.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119885104A_ABST
    Figure CN119885104A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a model training method and device, electronic equipment and a computer readable storage medium, and relates to the technical field of computer data processing. The method comprises the following steps: acquiring a preset test time period, and generating a plurality of timestamps based on the test time period; matching at least two corresponding traffic characteristic values for each timestamp; and taking each timestamp and the traffic characteristic value corresponding to the timestamp as sample data, and training the initial model based on the sample data to generate a traffic prediction model. According to the embodiment of the invention, the diversity and flexibility of the sample data are enhanced, so that the traffic prediction model trained by the multi-dimensional sample data is more stable, and the prediction result of the traffic prediction model is more accurate.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer data processing technology, and in particular to a model training method, device, equipment and storage medium. Background Art

[0002] With the development of computer Internet, artificial intelligence and other technologies, big data processing has become the core technology of various industries, with important application value and development prospects. In modern algorithm development and system testing, it is crucial to generate multi-dimensional test data with practical significance. Models can be trained based on test data to achieve data prediction and system testing. In related technologies, although there are automated tools for generating test data, they cannot ensure the diversity of test data, resulting in low model stability. Summary of the invention

[0003] The present application provides a model training method, device, equipment and storage medium for solving the problem of low model stability in the prior art.

[0004] According to one aspect of the present application, a model training method is provided, the method comprising:

[0005] Obtain a preset test time period, and generate multiple timestamps based on the test time period;

[0006] Matching at least two corresponding traffic feature values ​​for each timestamp;

[0007] Each timestamp and the traffic feature value corresponding to the timestamp are taken as a sample data, and the initial model is trained based on the sample data to generate a traffic prediction model.

[0008] In a possible implementation, the at least two traffic feature values ​​corresponding to each timestamp match include:

[0009] Obtain at least two traffic characteristics and a value range of each traffic characteristic;

[0010] The data probability distribution corresponding to each traffic feature is determined, and each timestamp is assigned a value based on the data probability distribution and the corresponding value range to obtain the traffic feature value matched by each timestamp.

[0011] In a possible implementation, the obtaining of at least two traffic characteristics and a value range of each traffic characteristic includes:

[0012] Get historical traffic data;

[0013] Feature extraction and feature statistics are performed on historical traffic data to obtain at least two traffic features and a value range of each traffic feature.

[0014] In another possible implementation, the initial model is trained based on sample data to generate a traffic prediction model, including:

[0015] Determine the input data and label data in each sample data, and perform at least one of the following update operations on the initial model based on each sample data until the initial model meets the preset convergence condition:

[0016] Input the input data into the initial model to obtain the predicted data output by the initial model; calculate the loss value of the initial model based on the preset loss function; update the parameters of the initial model based on the loss value; wherein the loss value represents the difference information between the predicted data and the label data;

[0017] The updated initial model is used as the traffic prediction model.

[0018] In another possible implementation, the above convergence condition includes any one of the following:

[0019] The loss value is less than a preset threshold;

[0020] The initial model completes a preset number of update operations.

[0021] In another possible implementation, the inputting of the input data into the initial model to obtain the predicted data output by the initial model includes:

[0022] Encode the input data to obtain the feature vector;

[0023] Perform linear transformation on the feature vector to obtain key feature information;

[0024] The key feature information is transformed nonlinearly to obtain the predicted data.

[0025] In another possible implementation, the above traffic characteristics include weather characteristics, road condition characteristics, traffic flow characteristics, and parking space remaining characteristics.

[0026] According to another aspect of an embodiment of the present application, a model training device is provided, the device comprising:

[0027] A generation module, used to obtain a preset test time period and generate multiple timestamps based on the test time period;

[0028] A matching module, used for matching at least two corresponding traffic characteristic values ​​for each timestamp;

[0029] The training module is used to take each timestamp and the traffic characteristic value corresponding to the timestamp as a sample data, and train the initial model based on the sample data to generate a traffic prediction model.

[0030] According to another aspect of the present application, an electronic device is provided, which includes: a memory, a processor, and a computer program stored in the memory, and the processor executes the computer program to implement the steps of the method shown in the first aspect of the present application.

[0031] According to another aspect of the present application, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the method shown in the first aspect of the present application are implemented.

[0032] The beneficial effects of the technical solution provided by this application are:

[0033] The training method, device, equipment and storage medium of the model provided by the present application can generate multiple timestamps through a preset test time period, and match at least two corresponding traffic characteristic values ​​for each timestamp; then use each timestamp and the traffic characteristic value corresponding to the timestamp as a sample data, and train the initial model based on the sample data to generate a traffic prediction model. The present application generates multi-dimensional sample data by matching the timestamp with at least two traffic characteristic values. The sample data has at least two dimensional feature description values, namely traffic characteristic values, and also has time information and timestamps, which enhances the diversity and flexibility of the sample data, making the traffic prediction model trained by the multi-dimensional sample data more stable and the prediction results of the traffic prediction model more accurate. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, a brief introduction will be given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0035] Figure 1 A flowchart of a model training method provided in an embodiment of the present application;

[0036] Figure 2 A flowchart of a training method for a model provided in an example embodiment of the present application;

[0037] Figure 3 A schematic diagram of the structure of a model training device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0038] Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. However, it should be understood that these descriptions are exemplary only and are not intended to limit the scope of the present disclosure. In addition, in the following description, descriptions of well-known structures and technologies are omitted to avoid unnecessary confusion of the concepts of the present disclosure.

[0039] Various structural schematic diagrams according to embodiments of the present disclosure are shown in the accompanying drawings. These figures are not drawn to scale, and some details are magnified and some details may be omitted for the purpose of clear expression. The shapes of various regions and layers shown in the figures and the relative sizes and positional relationships therebetween are only exemplary, and may deviate in practice due to manufacturing tolerances or technical limitations, and those skilled in the art may further design regions / layers with different shapes, sizes, and relative positions according to actual needs.

[0040] In the context of the present disclosure, when a layer / element is referred to as being "on" another layer / element, the layer / element may be directly on the other layer / element or an intervening layer / element may exist therebetween. In addition, if a layer / element is "on" another layer / element in one orientation, the layer / element may be "below" the other layer / element when the orientation is reversed.

[0041] In modern algorithm development and system testing, manually generating test data is not only time-consuming but also error-prone. Existing automated data generation tools are capable of generating data but often lack flexibility and diversity.

[0042] Based on the above technical problems, some embodiments of the present application generate multiple timestamps through a preset test time period, and match at least two corresponding traffic characteristic values ​​for each timestamp; then use each timestamp and the traffic characteristic value corresponding to the timestamp as a sample data, and train the initial model based on the sample data to generate a traffic prediction model. The present application generates multi-dimensional sample data by matching the timestamp with at least two traffic characteristic values. The sample data has at least two dimensional feature description values, namely traffic characteristic values, and also has time information and timestamps, which enhances the diversity and flexibility of the sample data, making the traffic prediction model trained based on the multi-dimensional sample data more stable and the prediction results of the traffic prediction model more accurate.

[0043] The following is a detailed description of the technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.

[0044] The present application provides a model training method, such as Figure 1As shown, it can be applied to a terminal or server for model training, and the method includes:

[0045] S101, obtaining a preset test time period, and generating multiple timestamps based on the test time period.

[0046] The above-mentioned multiple time stamps are obtained by dividing the test time period at preset time intervals.

[0047] Specifically, the user inputs the start time and end time of the test on the client, and the terminal or server used for model training can accept the start time and end time sent by the client, and determine the test time period based on the above start time and end time.

[0048] Preferably, the start time and end time can be specified by the user by inputting parameters, for example: the start time is 00:00:00 on January 1, 2024, and the end time is 23:59:59 on January 31, 2024.

[0049] In some implementations, the timestamp may be randomly generated based on the time range of the testing period.

[0050] In other implementations, multiple timestamps may be obtained by evenly dividing the test time period according to a time interval randomly generated or sent by the user end.

[0051] In some further implementations, multiple timestamps may be generated within a test period according to the number of timestamps sent by the user end.

[0052] S102, matching at least two corresponding traffic characteristic values ​​for each timestamp.

[0053] Among them, traffic characteristics may include weather characteristics, road condition characteristics, traffic flow characteristics, and parking space surplus characteristics, etc. When the traffic characteristics are weather characteristics, the corresponding traffic characteristic values ​​may include sunny, rainy, cloudy, snowy, etc.; when the traffic characteristics are road condition characteristics, the corresponding traffic characteristic values ​​may include good, slippery, poor, or average, etc.; when the traffic characteristics are traffic flow characteristics, the traffic characteristic values ​​may be the number of vehicles passing per hour; when the traffic characteristics are parking space surplus characteristics, the traffic characteristic values ​​may be the number of parking spaces.

[0054] Specifically, a terminal or server used for model training can match a corresponding traffic feature value for each timestamp based on the data probability distribution corresponding to each traffic feature.

[0055] S103, taking each timestamp and the traffic characteristic value corresponding to the timestamp as a sample data, and training the initial model based on the sample data to generate a traffic prediction model.

[0056] In an embodiment of the present application, timestamp, weather characteristics, and road condition characteristics can be used as input data, and at least one of traffic flow characteristics and parking space remaining characteristics can be used as corresponding label data; then, the initial model is trained based on the above input data and label data to generate a traffic prediction model.

[0057] The embodiment of the present application generates multiple timestamps through a preset test time period, and matches at least two corresponding traffic characteristic values ​​for each timestamp; then each timestamp and the traffic characteristic value corresponding to the timestamp are used as a sample data, and the initial model is trained based on the sample data to generate a traffic prediction model. The present application generates multi-dimensional sample data by matching the timestamp with at least two traffic characteristic values. The sample data has at least two dimensional feature description values, namely traffic characteristic values, and also has time information and timestamps, which enhances the diversity and flexibility of the sample data, making the traffic prediction model trained by the multi-dimensional sample data more stable and the prediction results of the traffic prediction model more accurate.

[0058] A possible implementation method is provided in an embodiment of the present application. The above-mentioned at least two traffic feature values ​​corresponding to each timestamp match include:

[0059] Obtain at least two traffic characteristics and a value range for each traffic characteristic; determine the data probability distribution corresponding to each traffic characteristic, and assign a value to each timestamp based on the data probability distribution and the corresponding value range to obtain the traffic characteristic value matched by each timestamp.

[0060] Optionally, when the traffic feature is a weather feature, the value range of the corresponding traffic feature value may include weather conditions such as sunny, rainy, cloudy, and snowy; for each timestamp, a weather condition can be randomly selected from the above traffic feature values ​​to obtain the traffic feature value matching each timestamp.

[0061] Preferably, the probability distribution can also be used to adjust the selection frequency of different weather conditions to simulate the actual weather change law, and then match the traffic characteristic value for each timestamp. For example, the probability of sunny is 60%, the probability of raining is 20%, the probability of cloudy is 15%, and the probability of snowing is 5%.

[0062] Optionally, when the traffic feature is a road condition feature, the value range of the corresponding traffic feature value may include good, slippery, poor or general road conditions; for each timestamp, a road condition can be randomly selected from the above traffic feature values ​​to obtain the traffic feature value matching each timestamp.

[0063] Preferably, the probability distribution can also be used to adjust the selection frequency of different road conditions to simulate the actual road condition change law, and then match the traffic characteristic value for each time stamp. For example, the probability of good is 50%, the probability of slippery is 25%, the probability of poor is 15%, and the probability of general is 10%.

[0064] When the traffic feature is a traffic flow feature, its traffic feature value can be the number of vehicles passing through per hour. For example, its value range can be a traffic flow of 100 to 1000 vehicles per hour. For each timestamp, a random method can be used to generate an integer value within the traffic flow range to obtain the traffic feature value matching each timestamp.

[0065] Preferably, Poisson distribution or normal distribution can also be used to generate traffic flow to more realistically simulate the changes in actual traffic conditions, thereby matching traffic characteristic values ​​for each timestamp. For example, the parameter of Poisson distribution is 500, that is, an average of 500 vehicles per hour, and the standard deviation of Poisson distribution is 100.

[0066] When the traffic feature is a parking space surplus feature, its traffic feature value may be the number of parking spaces, for example, its value range may be the number range of 0 to 100 parking spaces, and for each timestamp, a random method is used to generate an integer value within the range of the number of parking spaces.

[0067] Preferably, the number of parking spaces may be generated using uniform distribution or normal distribution to more realistically simulate the changes in the actual parking space conditions, thereby matching the traffic characteristic value for each timestamp. For example, a uniform distribution is used, the parameters of which are 0 and 100, or a normal distribution is used, the parameters of which are 50, i.e., an average of 50 parking spaces), and the standard deviation of the normal distribution is 15.

[0068] In an embodiment of the present application, the generated traffic characteristic data such as timestamp, weather conditions, road conditions, traffic flow and number of parking spaces can be collected into a structured data set, and the collected data can be organized into a data set in a tabular form using a data frame construction tool, where each row represents a sample and each column represents a variable. For example, the columns of the data frame can include timestamp, weather conditions, road conditions, traffic flow and number of parking spaces. The generated data frame is then exported to a standard character-separated value (CSV) file format to facilitate subsequent data processing and analysis.

[0069] Specifically, the user can specify the amount of generated data, time range, frequency distribution of weather conditions, distribution parameters of traffic flow, and distribution parameters of the number of parking spaces by means of command line parameters or configuration files. In addition, before generating data, the terminal or server used for model training can verify the parameters input by the user to ensure the rationality and validity of the parameters. Preferably, the terminal or server used for model training uses an exception handling mechanism to capture and handle invalid input parameters.

[0070] At the same time, in order to improve the efficiency of data generation, multi-threading or parallel computing methods can be used to generate data. In the process of generating data, the execution status and generation results of each step can also be recorded to facilitate users to debug and verify. In order to facilitate users to verify the quality of generated data, the terminal or server used for model training can also provide data visualization functions, such as generating time series graphs, distribution graphs, etc.

[0071] The embodiment of the present application determines the data probability distribution corresponding to each traffic feature, and assigns a value to each timestamp based on the data probability distribution and the corresponding value range to obtain the traffic feature value matched by each timestamp, thereby realizing the generation of multidimensional and randomized sample data, enriching the amount of data, and characterizing traffic features from multiple dimensions. The above data probability distribution ensures the rationality and effectiveness of the data, laying a good foundation for subsequent model training.

[0072] In an embodiment of the present application, a possible implementation method is provided, wherein the at least two traffic characteristics and the value range of each traffic characteristic are obtained, including:

[0073] Acquire historical traffic data; perform feature extraction and feature statistics on the historical traffic data to obtain at least two traffic features and a value range for each traffic feature.

[0074] In an embodiment of the present application, a terminal or server used for model training can obtain historical traffic data, for example, historical traffic data within one month, and then perform feature extraction and statistics on the historical traffic data to obtain multiple traffic characteristics and the value range of each traffic characteristic, so that the traffic characteristic value is more accurate, reasonable, and effective, thereby improving the quality of the sample data.

[0075] In an embodiment of the present application, a possible implementation method is provided, wherein the initial model is trained based on sample data to generate a traffic prediction model, including:

[0076] S201, determining the input data and label data in each sample data, and performing at least one of the following update operations on the initial model based on each sample data until the initial model meets the preset convergence condition:

[0077] Input the input data into the initial model to obtain the predicted data output by the initial model; calculate the loss value of the initial model based on the preset loss function; update the parameters of the initial model based on the loss value; wherein the loss value represents the difference information between the predicted data and the label data;

[0078] A possible implementation method is provided in an embodiment of the present application, and the above convergence condition includes any of the following:

[0079] The loss value is less than a preset threshold;

[0080] The initial model completes a preset number of update operations.

[0081] S202: Using the updated initial model as a traffic prediction model.

[0082] Optionally, the initial model may be a neural network model. The neural network is composed of a plurality of "neurons" distributed in different layers, generally including:

[0083] Input layer: receives input data (such as time, weather, road conditions and other features).

[0084] Hidden layer: Performs complex calculations and transformations on the input data (can have one or more layers).

[0085] Output layer: Outputs the final prediction results (such as traffic flow or number of parking spaces).

[0086] Each neuron is connected to other neurons through "weights" and "biases". The input data will be processed by linear transformation and nonlinear activation function in the neuron. The specific data processing method will be introduced in detail below.

[0087] In an embodiment of the present application, a possible implementation method is provided, wherein the input data is input into the initial model to obtain the predicted data output by the initial model, including:

[0088] S301, feature encoding is performed on the input data to obtain a feature vector.

[0089] Optionally, when the input data includes three features of "hour", "weather condition" and "road condition", the input layer can preprocess it, i.e., perform feature encoding, to obtain a feature vector [8, 0, 0].

[0090] S302, performing linear transformation on the feature vector to obtain key feature information.

[0091] When the input data enters the hidden layer of the neural network, it is first linearly transformed. Each input feature is multiplied by a corresponding weight and then a bias is added.

[0092] Assume that the first neuron in the hidden layer has the following weights and biases:

[0093] Weights: w1=0.5, w2=0.3, w3=0.2;

[0094] Bias: b = 0.1;

[0095] Then, the input to the first neuron in the hidden layer is calculated as follows:

[0096] z=(8×0.5)+(0×0.3)+(0×0.2)+0.1=4.1;

[0097] The above value z is the linear combination result of the first neuron in the hidden layer.

[0098] Similarly, other neurons in the hidden layer will have their own weights and biases, and perform similar linear transformations on the input data to obtain their respective z values.

[0099] S303, performing nonlinear transformation on the key feature information to obtain prediction data.

[0100] The result of the linear combination z will be passed to the activation function for nonlinear transformation. Common activation functions include Sigmoid function, Rectified Linear Unit (ReLU), hyperbolic tangent function (Tanh), etc. Here we assume that the ReLU activation function is used, and its definition is:

[0101] ReLU(z)=max(0,z);

[0102] Assuming that the linear combination result of the first neuron in the hidden layer is z = 4.1, the result after applying the ReLU activation function is:

[0103] a = ReLU(4.1) = 4.1;

[0104] Similarly, each neuron will be processed by a similar activation function to obtain the output value after activation.

[0105] Optionally, the neural network may have multiple hidden layers, and the output of each layer is used as the input of the next layer. This process is called forward propagation. The calculation method of each layer is similar to the above process:

[0106] The second hidden layer receives the output of the first hidden layer and performs linear transformation and activation function processing again.

[0107] For the third hidden layer, similar calculations are continued.

[0108] Finally, after multiple layers of computation, the data reaches the output layer.

[0109] In the embodiment of the present application, it is assumed that the output layer has two neurons, which are used to predict traffic flow and the number of parking spaces respectively. The weight and bias of each output layer neuron are as follows:

[0110] Weight: w1=0.4, w2=0.6;

[0111] Bias: b = 10;

[0112] Assume that the output of the first neuron in the hidden layer is 4.1 and the output of the second neuron is 3.5. Then, the calculation process of traffic flow is as follows:

[0113] zTraffic flow = (4.1×0.4)+(3.5×0.6)+10.

[0114] Specific calculation:

[0115] zTraffic flow = 1.64 + 2.1 + 10 = 13.74;

[0116] Weights and biases for the number of parking spaces:

[0117] Weight: w1=0.3, w2=0.7;

[0118] Bias: b = 5;

[0119] Similarly, the number of parking spaces is calculated as follows:

[0120] zNumber of parking spaces = (4.1×0.3)+(3.5×0.7)+5=1.23+2.45+5=8.68.

[0121] The calculation results of the output layer z traffic flow and z number of parking spaces are the final prediction values ​​of the neural network. For regression tasks, we usually use these values ​​directly as prediction results.

[0122] Therefore, for the input data [8,0,0], the final prediction result of the neural network is:

[0123] Timestamp prediction Traffic flow prediction Number of parking spaces;

[0124] 2024-12-01 08:00 13.74 8.68.

[0125] If we need to predict data for multiple time points, such as traffic flow and the number of parking spaces from 8:00 to 10:00 on December 1, 2024, we can repeat the above process:

[0126] Timestamp hour weather conditions road conditions forecast traffic flow forecast number of parking spaces;

[0127] 2024-12-01 08:00 8 0 0 13.74 8.68;

[0128] 2024-12-01 09:00 9 0 0 14.84 9.18;

[0129] 2024-12-01 10:00 10 0 0 15.94 9.68.

[0130] like Figure 2 As shown, in actual use, these weights and biases are learned through a training process. The training process usually includes the following steps:

[0131] Initialize weights and biases: Initialize all weights and biases in the network randomly or in some way.

[0132] Forward propagation: input training data into the network and calculate the prediction results.

[0133] Calculate loss: Compare the predicted results with the actual results and calculate the value of the loss function (such as mean square error).

[0134] Backpropagation: Based on the value of the loss function, adjust the weights and biases in the network to minimize the loss.

[0135] Iteration: Repeat the above steps until the value of the loss function reaches a satisfactory level or reaches a predetermined number of iterations.

[0136] The embodiment of the present application performs model training and prediction through a preset neural network model, which can make full use of the generated sample data to predict traffic characteristics, thereby improving the practicality and robustness of the model.

[0137] The present application embodiment provides a model training device, such as Figure 3 As shown, the model training device 30 may include: a generation module 301, a matching module 302 and a training module 303;

[0138] The generating module 301 is used to obtain a preset test time period and generate multiple timestamps based on the test time period;

[0139] A matching module 302, configured to match at least two corresponding traffic characteristic values ​​for each timestamp;

[0140] The training module 303 is used to take each timestamp and the traffic characteristic value corresponding to the timestamp as a sample data, and train the initial model based on the sample data to generate a traffic prediction model.

[0141] In an embodiment of the present application, a possible implementation is provided. When the matching module 302 matches at least two corresponding traffic feature values ​​for each timestamp, it is used to:

[0142] Obtain at least two traffic characteristics and a value range of each traffic characteristic;

[0143] The data probability distribution corresponding to each traffic feature is determined, and each timestamp is assigned a value based on the data probability distribution and the corresponding value range to obtain the traffic feature value matched by each timestamp.

[0144] In an embodiment of the present application, a possible implementation is provided. When acquiring at least two traffic characteristics and a value range of each traffic characteristic, the matching module 302 is used to:

[0145] Get historical traffic data;

[0146] Feature extraction and feature statistics are performed on historical traffic data to obtain at least two traffic features and a value range of each traffic feature.

[0147] In an embodiment of the present application, a possible implementation method is provided. When the training module 303 trains the initial model based on sample data to generate a traffic prediction model, it is used to:

[0148] Determine the input data and label data in each sample data, and perform at least one of the following update operations on the initial model based on each sample data until the initial model meets the preset convergence condition:

[0149] Input the input data into the initial model to obtain the predicted data output by the initial model; calculate the loss value of the initial model based on the preset loss function; update the parameters of the initial model based on the loss value; wherein the loss value represents the difference information between the predicted data and the label data;

[0150] The updated initial model is used as the traffic prediction model.

[0151] A possible implementation method is provided in an embodiment of the present application, and the above convergence condition includes any of the following:

[0152] The loss value is less than a preset threshold;

[0153] The initial model completes a preset number of update operations.

[0154] A possible implementation method is provided in the embodiment of the present application. When the training module 303 inputs the input data into the initial model to obtain the prediction data output by the initial model, it is used to:

[0155] Encode the input data to obtain the feature vector;

[0156] Perform linear transformation on the feature vector to obtain key feature information;

[0157] The key feature information is transformed nonlinearly to obtain the predicted data.

[0158] A possible implementation method is provided in an embodiment of the present application, where the above-mentioned traffic characteristics include weather characteristics, road condition characteristics, traffic flow characteristics, and parking space remaining characteristics.

[0159] The device of the embodiments of the present application can execute the method provided by the embodiments of the present application, and the implementation principles are similar. The actions performed by each module in the device of each embodiment of the present application correspond to the steps in the method of each embodiment of the present application. For the detailed functional description of each module of the device, please refer to the description in the corresponding method shown in the previous text, which will not be repeated here.

[0160] The embodiment of the present application generates multiple timestamps through a preset test time period, and matches at least two corresponding traffic characteristic values ​​for each timestamp; then each timestamp and the traffic characteristic value corresponding to the timestamp are used as a sample data, and the initial model is trained based on the sample data to generate a traffic prediction model. The present application generates multi-dimensional sample data by matching the timestamp with at least two traffic characteristic values. The sample data has at least two dimensional feature description values, namely traffic characteristic values, and also has time information and timestamps, which enhances the diversity and flexibility of the sample data, making the traffic prediction model trained by the multi-dimensional sample data more stable and the prediction results of the traffic prediction model more accurate.

[0161] An electronic device is provided in an embodiment of the present application, including a memory, a processor, and a computer program stored in the memory, and the processor executes the above-mentioned computer program to implement the steps of the model training method. Compared with the related art, the following can be achieved: the embodiment of the present application generates multiple timestamps through a preset test time period, and matches at least two corresponding traffic characteristic values ​​for each timestamp; then each timestamp and the traffic characteristic value corresponding to the timestamp are used as a sample data, and the initial model is trained based on the sample data to generate a traffic prediction model. The present application generates multi-dimensional sample data by matching the timestamp with at least two traffic characteristic values. The sample data has at least two dimensional feature description values, namely traffic characteristic values, and also has time information and timestamps, which enhances the diversity and flexibility of the sample data, making the traffic prediction model trained by the multi-dimensional sample data more stable and the prediction results of the traffic prediction model more accurate.

[0162] In an embodiment of the present application, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the method shown in the first aspect of the embodiment of the present application are implemented.

[0163] In the above description, the technical details such as the patterning of each layer are not described in detail. However, those skilled in the art should understand that various technical means can be used to form layers, regions, etc. of desired shapes. In addition, in order to form the same structure, those skilled in the art can also design methods that are not completely the same as the methods described above. In addition, although the various embodiments are described above separately, this does not mean that the measures in the various embodiments cannot be used in combination to advantage.

[0164] Although the preferred embodiments of the present application have been described, those skilled in the art may make other changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present application.

[0165] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.

Claims

1. A model training method, characterized in that: The method comprises: Obtaining a preset test time period, and generating multiple timestamps based on the test time period; Matching at least two corresponding traffic feature values ​​for each timestamp; Each timestamp and the traffic characteristic value corresponding to the timestamp are taken as a sample data, and the initial model is trained based on the sample data to generate a traffic prediction model.

2. The method according to claim 1, characterized in that The at least two traffic characteristic values ​​corresponding to each timestamp are matched, including: Obtaining at least two traffic characteristics and a value range of each of the traffic characteristics; The data probability distribution corresponding to each of the traffic characteristics is determined, and each time stamp is assigned a value based on the data probability distribution and the corresponding value range to obtain the traffic characteristic value matched by each time stamp.

3. The method according to claim 1, characterized in that The obtaining of at least two traffic characteristics and a value range of each of the traffic characteristics includes: Get historical traffic data; Feature extraction and feature statistics are performed on the historical traffic data to obtain at least two traffic features and a value range of each of the traffic features.

4. The method according to claim 1, characterized in that: The training of the initial model based on the sample data to generate a traffic prediction model includes: Determine the input data and label data in each sample data, and perform at least one of the following update operations on the initial model based on each sample data until the initial model meets the preset convergence condition: Input the input data into the initial model to obtain the predicted data output by the initial model; calculate the loss value of the initial model based on a preset loss function; update the parameters of the initial model based on the loss value; wherein the loss value represents the difference information between the predicted data and the label data; The updated initial model is used as the traffic prediction model.

5. The method according to claim 4, characterized in that The convergence condition includes any of the following: The loss value is less than a preset threshold value; The initial model completes a preset number of update operations.

6. The method according to claim 4, characterized in that The step of inputting the input data into the initial model to obtain the predicted data output by the initial model includes: Performing feature encoding on the input data to obtain a feature vector; Performing a linear transformation on the feature vector to obtain key feature information; The key feature information is subjected to nonlinear transformation to obtain the predicted data.

7. The method according to claim 2, characterized in that The traffic characteristics include weather characteristics, road condition characteristics, traffic flow characteristics and parking space surplus characteristics.

8. A model training device, characterized in that: The device comprises: A generating module, used for acquiring a preset test time period and generating a plurality of timestamps based on the test time period; A matching module, used for matching at least two corresponding traffic characteristic values ​​for each timestamp; The training module is used to take each timestamp and the traffic characteristic value corresponding to the timestamp as a sample data, and train the initial model based on the sample data to generate a traffic prediction model.

9. An electronic device, characterized in that: include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method according to any one of claims 1 to 7 when executing the computer program.

10. A storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.