Stack purging model sample construction method and device, medium and equipment

By using the sliding window sliding window technology of nested array segmentation function in the construction of stack purge model samples, the problem of poor applicability in the construction of stack purge model samples in the existing technology is solved, and the dynamic control of the input feature sequence is realized. Change capture and data processing efficiency improvement.

CN118627640APending Publication Date: 2024-09-10DONGFENG MOTOR GRP
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202410736658.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-07
Publication Date
2024-09-10

AI Technical Summary

Technical Problem

The existing technology has poor applicability when constructing stack purge model samples, resulting in poor model performance and difficulty in capturing the dynamic changes of the input feature sequence in time series.

Method used

The sliding window using the nested array segmentation function slides in the input feature queue, determines the target input feature array and target label feature, builds a subset of model samples, and improves data processing efficiency through vectorization operations.

Benefits of technology

It effectively captures the dynamic changes of the input feature sequence, simplifies the amount of code, improves data processing efficiency, and improves the prediction ability of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118627640A
    Figure CN118627640A
Patent Text Reader

Abstract

The invention discloses a pile purging model sample construction method and device, a medium and equipment, and the method comprises the steps: for each original time sequence data subset in a pile purging process, sliding in a queue where input characteristic quantities are located based on a sliding window nested with a plurality of groups of segmentation functions, a target input feature quantity array and a target label feature quantity corresponding to each sliding window are determined, a model sample subset corresponding to the original time sequence data subset is constructed, and an array segmentation function is used for conducting vectorization operation on the multiple sliding windows at the same time; and dividing each model sample subset into a model training sample set and a model test sample set for supervised learning of the stack purging model. According to the technical scheme provided by the invention, the dynamic and static parameters of the valve can be distinguished and monitored, the dynamic change of the input characteristic quantity sequence under the time sequence can be captured, and the data processing efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of data processing technology, and in particular, relates to a method, device, medium and equipment for constructing a stack purge model sample. Background Art

[0002] The construction of model samples has an important impact on the quality of model training results. At present, when processing sample data of the stack purge model, a large amount of original stack purge data is usually selected, and training sets and test sets are randomly selected to construct model samples, thereby improving the generalization ability of the model. However, this method has poor applicability when applied to sample construction of the stack purge model, resulting in poor results of the trained model. Summary of the invention

[0003] The embodiments of the present application provide a method, device, medium and equipment for constructing a stack purge model sample, thereby being able to capture the dynamic changes of an input feature quantity sequence in a time series at least to a certain extent, thereby improving data processing efficiency.

[0004] Other features and advantages of the present application will become apparent from the following detailed description, or may be learned in part by the practice of the present application.

[0005] According to a first aspect of an embodiment of the present application, a method for constructing a stack purge model sample is provided, comprising:

[0006] Acquire an original time series data set of the stack purge process, wherein the original time series data set includes multiple original time series data subsets, each of the original time series data subsets includes multiple groups of feature quantities in the form of a queue, and each group of feature quantities includes an input feature quantity and a label feature quantity;

[0007] For each subset of the original time series data, a sliding window embedded with an array splitting function is slid in the queue where the input feature quantity is located, and a target input feature quantity array and a target label feature quantity corresponding to each sliding window are determined, and each target input feature quantity array and the target label feature quantity are used as a model sample to construct a model sample subset corresponding to the subset of the original time series data, wherein the array splitting function is used to perform vectorized operations on multiple sliding windows simultaneously;

[0008] Each of the model sample subsets is divided into a model training sample set and a model test sample set, so as to perform supervised learning of the stack purge model based on the model training sample set and the model test sample set.

[0009] In some embodiments of the present application, based on the above solution, before the sliding window based on the nested array slicing function slides in the queue where the input feature quantity is located, the method further includes:

[0010] Array conversion is performed on each of the input feature quantities according to a preset data type to obtain a target array, so that a sliding window embedded with an array segmentation function is called to slide in the target array.

[0011] In some embodiments of the present application, based on the above-mentioned solution, the sliding window based on the nested array segmentation function slides in the queue where the input feature quantity is located, including:

[0012] In the process of sliding in the queue where the input feature quantity is located according to the preset window size n and the sliding step size s, each sliding window is simultaneously vectorized based on the array segmentation function to segment each sliding window, and the target view is determined according to the target shape and the target step size. The target view includes multiple target input feature quantity arrays set according to the target shape and the target step size, and each of the target input feature quantity arrays corresponds to a sliding window.

[0013] In some embodiments of the present application, based on the aforementioned scheme, the target step size includes a first step size, a second step size and a third step size, the first step size is the row step size of the target view, the second step size is the column step size of the target view, and the third step size is the size of each element in the target view, and each of the elements is the input feature quantity in a set of feature quantities.

[0014] In some embodiments of the present application, based on the above solution, determining the target input feature array and the target label feature corresponding to each sliding window includes:

[0015] Determine the target input feature array in the sliding window obtained at the i-th moment;

[0016] According to the window size n and the sliding step s, the target label feature corresponding to the target input feature array at the i-th moment is determined, wherein the target label feature is the label feature at the (i+n+s)-th moment.

[0017] In some embodiments of the present application, based on the above solution, after taking each of the target input feature arrays and the target label feature as a model sample, the method further includes:

[0018] Based on the number of feature types of the input feature quantity and the number of feature types of the label feature quantity, the model sample is subjected to dimensionality upgrading processing to obtain a multi-dimensional model sample.

[0019] In some embodiments of the present application, based on the aforementioned solution, the input feature quantity includes purge time and purge flow rate, and the label feature quantity includes stack impedance.

[0020] According to a second aspect of an embodiment of the present application, a device for constructing a stack purge model sample is provided, comprising:

[0021] An acquisition unit, used for acquiring an original time series data set of a stack purge process, wherein the original time series data set includes a plurality of original time series data subsets, each of which includes a plurality of groups of feature quantities in a queue form, and each group of feature quantities includes an input feature quantity and a label feature quantity;

[0022] A construction unit is used for sliding a sliding window embedded with an array splitting function in the queue where the input feature quantity is located for each of the original time series data subsets, determining a target input feature quantity array and a target label feature quantity corresponding to each sliding window, and taking each of the target input feature quantity array and the target label feature quantity as a model sample to construct a model sample subset corresponding to the original time series data subset, wherein the array splitting function is used to perform vectorized operations on multiple sliding windows simultaneously;

[0023] A division unit is used to divide each of the model sample subsets into a model training sample set and a model test sample set, so as to perform supervised learning of the stack purge model based on the model training sample set and the model test sample set.

[0024] According to a third aspect of an embodiment of the present application, a computer-readable storage medium is provided, characterized in that at least one computer program instruction is stored in the computer-readable storage medium, and the at least one computer program instruction is loaded and executed by a processor to implement the operations performed by any method described in the first aspect.

[0025] According to a fourth aspect of an embodiment of the present application, an electronic device is provided, comprising one or more processors and one or more memories, wherein at least one program code is stored in the one or more memories, and the at least one program code is loaded and executed by the one or more processors to implement the operations performed by any of the methods described in the first aspect.

[0026] One or more technical solutions provided by the embodiments of the present invention achieve at least the following technical effects or advantages:

[0027] For each subset of original time series data, the present application slides in the queue where the input feature quantity is located based on a sliding window nested with an array splitting function, determines the target input feature quantity array and the target label feature quantity corresponding to each sliding window, and uses each target input feature quantity array and the target label feature quantity as a model sample to construct a model sample subset corresponding to the original time series data subset, wherein the array splitting function is used to perform vectorized operations on multiple sliding windows at the same time, so that the input feature quantity sequence in the original time series data subset can be divided into several small time windows, and the data in each window can be processed and analyzed simultaneously, which can not only capture the dynamic changes of the input feature quantity sequence in the time series, but also simplify the amount of code and improve data processing efficiency.

[0028] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] The drawings herein are incorporated into the specification and constitute a part of the specification, showing embodiments consistent with the present application, and together with the specification, are used to explain the principles of the present application. Obviously, the drawings described below are only some embodiments of the present application, and for ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. In the drawings:

[0030] Figure 1 A flow chart showing a method for constructing a stack purge model sample according to an embodiment of the present application is shown;

[0031] Figure 2 The target view of the embodiment of the present application is shown;

[0032] Figure 3 A schematic diagram showing the working principle of the sliding window in an embodiment of the present application is shown.

[0033] Figure 4 A schematic diagram of dividing the model samples in an embodiment of the present application is shown;

[0034] Figure 5 A multi-level function nesting principle flow chart of an embodiment of the present application is shown;

[0035] Figure 6 A schematic diagram of a multi-level nested function call relationship in an embodiment of the present application is shown;

[0036] Figure 7 A flowchart showing the principle of splitting a nested supervised learning data set according to an embodiment of the present application is shown;

[0037] Figure 8 A structural diagram of a device for constructing a stack purge model sample according to an embodiment of the present application is shown;

[0038] Fig. 9 A schematic diagram of the structure of a computer system suitable for implementing an electronic device of an embodiment of the present application is shown. DETAILED DESCRIPTION

[0039] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0040] In addition, described feature, structure or characteristic can be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present application. However, those skilled in the art will appreciate that the technical scheme of the present application can be put into practice without one or more of the specific details, or other methods, components, devices, steps, etc. can be adopted. In other cases, known methods, devices, realizations or operations are not shown or described in detail to avoid blurring the various aspects of the application.

[0041] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities may be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.

[0042] The flowcharts shown in the accompanying drawings are only exemplary and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps can be decomposed, and some operations / steps can be combined or partially combined, so the actual execution order may change according to actual conditions.

[0043] It should also be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the objects used in this way can be interchanged where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those shown or described.

[0044] See also Figure 1 , showing a flow chart of a method for constructing a stack purge model sample according to an embodiment of the present application.

[0045] like Figure 1As shown, according to the first aspect of the embodiment of the present application, a method for constructing a stack purge model sample is provided, including but not limited to being implemented by steps S1 to S3:

[0046] Step S1. Acquire an original time series data set of the stack purge process, wherein the original time series data set includes multiple original time series data subsets, each of which includes multiple groups of feature quantities in the form of a queue, and each group of feature quantities includes an input feature quantity and a label feature quantity;

[0047] It should be noted that in order to avoid excessive moisture remaining in the fuel cell after shutdown, the stack needs to be purged when the fuel cell is shut down to prevent the fuel cell from failing to start due to a large amount of ice inside the battery during the next startup; on the other hand, stack shutdown purging can increase the water storage capacity of the membrane electrode, thereby extending the freezing time during startup and increasing the probability of successful cold start of the fuel cell.

[0048] During the shutdown and purge process of the stack, there is an exponential function relationship between the purge time t and the purge flow f and the stack impedance R, that is, an exponential function relationship in the form of R(t, f). Therefore, if the purge time t and the purge flow f are used as input feature quantities, and the stack impedance R is used as the label feature quantity, the stack purge model is trained. Based on the purge time t and the purge flow f at historical moments, the change of the stack impedance R at future moments can be predicted, thereby guiding the stack purge process.

[0049] Therefore, before model training, it is necessary to construct a model sample. In the embodiment of the present application, data including the shutdown purge phase of the stack can be collected from tests such as the stack durability drum test and the stack low-temperature cold start test, and the overall data is processed into a matrix table data including a number of purge times, purge flows, and stack impedances, and stored in the form of a csv file. Among them, the purge time, purge flow, and stack impedance are stored in the matrix table in the form of queues, for example, the purge time is in the first column, the purge flow is in the second column, and the stack impedance is in the third column.

[0050] It is understandable that if there are several motor purge processes, several csv files can be obtained accordingly, for example, including 500 csv files, i.e., the original time series data set, each csv file is an original time series data subset, and each original time series data subset includes multiple groups of feature quantities in the form of queues, each group of feature quantities includes input feature quantities such as purge time and purge flow, and label feature quantities such as battery stack impedance. It is understandable that there is a time series relationship between each group of feature quantities, for example: the first group of feature quantities is collected from time 0, the purge flow is f1, and the battery stack impedance is R1, the second group of feature quantities is collected from time 0.1, the purge flow is f2, and the battery stack impedance is R2, and so on, each original time series data subset can have several groups of feature quantities, for example, 200 groups of feature quantities.

[0051] Step S2. For each subset of the original time series data, a sliding window embedded with an array splitting function is slid in the queue where the input feature quantity is located, and the target input feature quantity array and the target label feature quantity corresponding to each sliding window are determined. Each of the target input feature quantity array and the target label feature quantity is used as a model sample to construct a model sample subset corresponding to the subset of the original time series data, wherein the array splitting function is used to perform vectorized operations on multiple sliding windows simultaneously;

[0052] It should be noted that the sliding time window is used to divide the continuous time data stream into multiple fixed-length or variable-length sample windows, each of which corresponds to a time interval. As time goes by, the window will continue to slide to new data points while discarding old data points. Various data processing and analysis operations can be performed on each window, such as summation, averaging, counting, etc. The sliding window includes two main parameters: window size and sliding step size, where the window size defines the number of data points contained in the window, and the sliding step size defines the rate at which the window moves.

[0053] In the embodiment of the present application, since the stack purge process data is time series data with a time series relationship, in order to capture the dynamic changes of the original time series data subset under time series, that is, the time dependence of the stack purge process data, a sliding window can be used to capture the relationship between the stack purge process data at different time points, so as to better understand the dynamic change process of the data, so that the model sample data set obtained subsequently can characterize the time series dynamic changes of the data, which is more in line with the needs of the stack purge model for stack impedance prediction at future times.

[0054] It can be understood that in order to efficiently implement the sliding window, the embodiment of the present application embeds an array splitting function in the sliding window, and the array splitting function is used to perform vectorized operations on multiple sliding windows at the same time, so that the original time series data subset can be quickly divided into multiple sliding time windows, thereby improving data processing efficiency.

[0055] In some embodiments, the array slicing function uses the np.lib.stride_tricks.as_strided function.

[0056] It should be noted that np.lib.stride_tricks.as_strided is a function in the NumPy library that allows you to create a view of an array by specifying a new shape and strides instead of creating a new copy of the array, thereby achieving efficient processing of the original time series data subsets divided into several sliding windows, where shape refers to the shape of the result array, which is a tuple representing the size of each dimension of the new array; stride refers to the step size of the data on each dimension in the new array, which is a tuple representing the stride size, which is essentially the same as the length of the shape tuple.

[0057] It is understandable that since the np.lib.stride_tricks.as_strided function allows direct access and manipulation of memory blocks (i.e., the storage space of the original time series data subset), compared with the conventional array slicing method, this function does not need to actually allocate and copy data, thereby enabling efficient processing of the original time series data subset being split into several sliding windows.

[0058] In some embodiments, before sliding the sliding window based on the nested array slicing function in the queue where the input feature quantity is located, the method further includes:

[0059] Array conversion is performed on each of the input feature quantities according to a preset data type to obtain a target array, so that a sliding window embedded with an array segmentation function is called to slide in the target array.

[0060] It is understandable that in order to make each group of feature quantities in the original time series data subset conform to the data format to be processed by the sliding window and the array splitting function, it is necessary to convert the data type of each input feature quantity, such as converting it to Int8, Int16, Int32, Int64 and other data types. The specific conversion is performed according to needs and is not limited here; of course, it is understandable that although the sliding window only slides the queue where the input feature quantity is located, that is, only the input feature quantity data is extracted, but when the subsequent sample data is constructed, it is also necessary to establish a correspondence between the input feature quantity and the label feature quantity. Therefore, if the input feature quantity is converted into a data type, the label feature quantity needs to be converted to the same data type accordingly, so as to ensure the consistency of subsequent data processing.

[0061] In some embodiments, the sliding window based on the nested array segmentation function slides in the queue where the input feature quantity is located, including:

[0062] In the process of sliding in the queue where the input feature quantity is located according to the preset window size n and the sliding step size s, each sliding window is simultaneously vectorized based on the array segmentation function to segment each sliding window, and the target view is determined according to the target shape and the target step size. The target view includes multiple target input feature quantity arrays set according to the target shape and the target step size, and each of the target input feature quantity arrays corresponds to a sliding window.

[0063] For example: after the original time series data subset is converted into an array, the following target array is obtained and stored in the memory space, wherein each element in the target array includes two input feature quantities, the first input feature quantity is the purge time, and the second input feature quantity is the purge flow rate.

[0064] np.array=([1,101],[2,102],[3,103],[4,104],[5,105],[6,106],[7,107],[8,108],[9,109],[10,110], [11,111], [12,112], [13,113], [14,114], [15,115], [16,116], [17,117], [18,118], [19,119], [20,120]).

[0065] For example, based on the above target array, the preset window size n=10, the sliding step s=1, then in the process of sliding in the queue where the input feature quantity is located, the vectorization operation is performed on each sliding window based on the array segmentation function to segment each sliding window, and the target view obtained is as follows: Figure 2 As shown in the figure, the target view is the view of the new array obtained by processing the original target array through the sliding window. In this view, there are 11 rows of sub-arrays, each of which includes 10 elements, corresponding to a sliding window size of 10, and the interval between each row of sub-arrays is 1 step, corresponding to a sliding step of 1.

[0066] It can be understood that the target shape of the target view refers to the tuple of the size of each dimension in the new array. For example, in the diagram, the target shape of the target view is equal to the size of each sliding window, that is, 10; the step size of the target view refers to the step size of the data on each dimension in the new array.

[0067] In some embodiments of the present application, based on the aforementioned scheme, the target step size includes a first step size, a second step size and a third step size, the first step size is the row step size of the target view, that is, the size of a row, in bytes; the second step size is the column step size of the target view, that is, the size of an element, in bytes; the third step size is the size of each element in the target view, because each sub-window is a two-dimensional array, and each of the elements is the input feature quantity in a set of feature quantities.

[0068] It can be understood that compared with the traditional method of using loops and slicing to create sliding windows, the embodiment of the present application uses the as_strided function to implement the sliding window, which can significantly reduce memory usage and computing time because the as_strided function does not need to copy any data.

[0069] Specifically, as_strided creates the target view by adjusting the view stride, where the stride determines the memory offset between elements in the array. By setting the stride correctly, as_strided can treat the original target array as a continuous sequence of blocks consisting of sliding windows, thereby accelerating the calculation by directly operating the memory layout of the array without additional memory being allocated; in addition, correctly setting the shape and strides can avoid accessing invalid memory locations or producing incorrect results.

[0070] It is understandable that in the NumPy library, vectorized operations mean performing element-level operations on the elements in the target array, rather than using Python's loop structure to process elements one by one. Since NumPy's vectorized operations are implemented in C language, which is closer to the underlying hardware than Python, it can more effectively utilize CPU resources, thereby greatly speeding up the operation.

[0071] In addition, the as_strided function allows the creation of overlapping views of the target array, so that multiple overlapping sub-arrays (i.e. sliding windows) can be accessed simultaneously without having to copy the data of the original target array. Based on this, vectorized operations can be performed on multiple sliding windows simultaneously, rather than calculating each sliding window one by one, thus avoiding display loops and reducing data copying by directly manipulating the memory layout, thereby significantly reducing calculation time; in addition, since the use of the as_strided function can avoid writing lengthy and error-prone loops to create arrays of specific structures, it can effectively simplify the code and improve development efficiency.

[0072] In some embodiments of the present application, based on the above solution, determining the target input feature array and the target label feature corresponding to each sliding window includes:

[0073] Determine the target input feature array in the sliding window obtained at the i-th moment;

[0074] According to the window size n and the sliding step s, the target label feature corresponding to the target input feature array at the i-th moment is determined, wherein the target label feature is the label feature at the (i+n+s)-th moment.

[0075] like Figure 3 As shown, for example: the sliding window size is 10, and the sliding step size is 1, then the target input feature array in the first sliding time window should be the combination of the input feature quantities from the 1st moment to the 10th moment (that is, the combination of the input feature quantities from 0 to 1.8 in the diagram). Since the input feature quantities are used to predict the label feature quantities, the target label feature quantities should be the label feature quantities corresponding to the next moment of the target input feature array, that is, the label feature quantities at the 11th moment (that is, the label feature quantities corresponding to the 2 input feature quantities in the diagram); similarly, the target input feature array in the second sliding time window should be the combination of the input feature quantities from the 2nd moment to the 11th moment (that is, the combination of the input feature quantities from 0.2 to 2 in the diagram), and the corresponding target label feature quantities should be the label feature quantities at the 12th moment (that is, the label feature quantities corresponding to the 2.2 input feature quantities in the diagram).

[0076] It can be understood that by using a sliding window to overlap and extract model samples of several input feature quantities in the original time series data subset, the input feature quantities can be observed at different time scales to capture local patterns and trends in the input feature quantities, which are important for subsequent prediction, classification or clustering tasks. In addition, when processing various input feature quantities, if the problem of inconsistent input feature lengths is encountered, all sequences can be converted into feature vectors of fixed length by using a sliding window, which facilitates subsequent batch processing and analysis. In addition, by using a sliding window, only a part of the data in the input feature quantity sequence can be focused on, thereby significantly reducing the amount of calculation. At the same time, since the sliding window is continuous, the results of the previous calculation can be used to accelerate subsequent calculations. Furthermore, in time series data, time dependence is an important feature. By using a sliding window, the relationship between the input feature quantity sequence at different time points can be captured, so as to better understand the dynamic change process of the input feature quantity. Finally, the size and step size of the sliding window can be adjusted as needed. By adjusting the sliding parameters, the granularity and range of feature extraction can be flexibly controlled to meet different task requirements.

[0077] In some embodiments, after taking each of the target input feature arrays and the target label feature as a model sample, the method further includes:

[0078] Based on the number of feature types of the input feature quantity and the number of feature types of the label feature quantity, the model sample is subjected to dimensionality upgrading processing to obtain a multi-dimensional model sample.

[0079] It can be understood that after taking values ​​and converting data types of each column of data in the original time series data subset, the model samples can be dimensionally upgraded based on the number of feature types of the input feature quantity (for example, including two feature types of purge time and purge flow, the number is 2) and the number of feature types of the label feature quantity (for example, including one feature type of stack and impedance, the number is 1), so as to provide a dimensionally upgraded data source for the sliding window, that is, two important parameters of the time sliding window: window length and sliding step size, so as to construct the multidimensional data structure required for the subsequent stack purge model for model training.

[0080] Step S3. Divide each of the model sample subsets into a model training sample set and a model test sample set, so as to perform supervised learning of the stack purge model based on the model training sample set and the model test sample set.

[0081] like Figure 4 As shown, since each original time series subset can construct a model sample subset, for example, there are 500 original time series subsets and correspondingly 500 model sample subsets are constructed. Then, according to the division ratio of 8:2, 400 model sample subsets of the 500 model sample subsets can be used as model training sample sets, and 100 model sample subsets of the 500 model sample subsets can be used as model test sample sets, so as to perform supervised learning of the stack purge model based on the model training sample set and the model test sample set.

[0082] It can be understood that X_train in the figure: is the input feature subset of the model training sample set. In supervised learning, X_train is used to train the stack purge model so that it can learn and predict the output stack impedance label from the input features. By training the model on X_train, the performance and accuracy of the model can be evaluated. y_train: is the label feature (target label) subset of the model training sample set. In supervised learning, y_train is used to specify the target variable or label when training the stack purge model. For supervised learning tasks, each input feature sample has a corresponding label. The stack purge model predicts new unknown data by learning the mapping relationship between the input features and the labels. By using y_train, the stack purge model can predict the category or target variable corresponding to the input feature. X_test: is the input feature subset of the model test sample set. In supervised learning, the test data set is used to evaluate the performance and accuracy of the model. X_test is usually used to test the predictive ability of the model after training the model using data different from the training data set. The data in the test data set is unknown to the model, so the model needs to make predictions based on what it has learned from the training data. By comparing the model predictions with the true labels of the test dataset, the accuracy and generalization ability of the model can be evaluated. y_test: The label set of the test dataset, which is used to evaluate the performance and accuracy of the supervised learning model. y_test is the target variable or label corresponding to the test dataset, which is usually used in the testing phase to evaluate the accuracy of the model predictions.

[0083] In the embodiment of the present application, in order to implement steps S1 to S3, the following multi-level function nesting and parameter passing method can be adopted, specifically including:

[0084] like Figure 5 and Figure 6 As shown, the embodiment of the present application finally obtains a sample set of the stack purge model, including four samples, X_train, y_train, X_test and y_test (i.e., training input samples, training label samples, test input samples and test label samples), i.e., ① in the figure.

[0085] In order to generate the above four samples, the trainingset(data_raw,ts_i,ts_o) function is defined, that is, the training sample and test sample cutting conversion function, that is, ② in the figure. The function includes three input parameters, namely data_raw (data set), ts_i (the number of features that each input sample should contain), and ts_o (the number of features that each label sample should contain).

[0086] In order to obtain the above three input parameters, the nested function srs_to_sprvs() is called, which is the sample set generation function for supervised learning, that is, ③ in the figure. The function is:

[0087] reframed_train_data_set=np.array(srs_to_sprvs(np.array(data_raw),ts_i,ts_o).values), where reframed_train_data_set represents the reconstructed data set, np.array represents the target array, and values ​​represents the value;

[0088] arr = np.array(data.raw[['t'],['f']]), where t represents the purge time and f represents the purge flow rate.

[0089] It can be understood that if you want to call the nested function srs_to_sprvs(), you need to define the function in advance, that is, ④ in the figure, define srs_to_sprvs(data, n_i, n_o, dropnan=True), and define the sliding of input multi-feature column values ​​and the addition of column names at the previous moment; the sliding of output label / target feature column values ​​and the addition of column names at the previous moment; the prediction sequence (t, t+1,...t+n), and then splice the acquired data together and remove the NaN rows (that is, when the sliding window slides to the front data, the following data is filled with NaN, and "True" means deleting NaN rows). The specific implementation process is as follows Figure 7 As shown;

[0090] Based on the above nested function srs_to_sprvs(), the sliding time window function is called, sld_win(arr,win_size=window_size), that is, ⑤ in the figure. By increasing the dimension of the data set, it is reconstructed into a data format that meets the requirements of supervised learning, that is, [number of samples, time steps, features], and is vertically split into training sets and test sets according to the splitting principle of 8:2 or 7:3, thereby obtaining the above four samples.

[0091] It can be understood that in order to call the sliding time window function, the function needs to be defined in advance, that is, ⑥ in the figure, define sld_win(arr,win_size), and call the built-in nested function as_strided(), that is, ⑦ in the figure, where the shape window_shape and step length strides of the target view of as_strided() are set as follows:

[0092] window_shape = (len(arr), win_size, 2), where len(arr) represents the array length, win_size represents the size of each sliding window, and 2 represents the number of input feature types, i.e., purge time and purge flow rate;

[0093] strides = (arr.strided[0], arr.strided[1]*2, arr.dtype.itemsize), which represent the first step length, the second step length and the third step length respectively;

[0094] curdata=np.lib.stride_tricks.as_stride(arr,shape=window_shape,strides=strides), where curdata represents the current data set.

[0095] It can be understood that the corresponding input parameters in the above-mentioned functions have the same meaning, and different parameter names are used to represent them only to distinguish the functions, that is, the input parameters are passed in each function, and finally a sample set of the stack purge model is obtained, including four samples of X_train, y_train, X_test and y_test. The embodiment of the present application is implemented based on multi-level function nesting and parameter passing, which has the advantages of low code, improved code reuse rate and operating efficiency, highly integrated code with versatility, and easy understanding and maintenance by developers.

[0096] Based on the above disclosed content, in an embodiment of the present application, for each subset of original time series data, a sliding window nested with an array splitting function slides in the queue where the input feature quantity is located, determines the target input feature quantity array and the target label feature quantity corresponding to each sliding window, and uses each target input feature quantity array and the target label feature quantity as a model sample to construct a model sample subset corresponding to the original time series data subset, wherein the array splitting function is used to perform vectorized operations on multiple sliding windows at the same time, so that the input feature quantity sequence in the original time series data subset can be divided into several small time windows, and the data in each window can be processed and analyzed simultaneously, which can not only capture the dynamic changes of the input feature quantity sequence in the time series, but also simplify the amount of code and improve data processing efficiency.

[0097] See also Figure 8 , showing a structural diagram of a device for constructing a stack purge model sample according to an embodiment of the present application.

[0098] like Figure 8 As shown, according to the second aspect of the embodiment of the present application, a stack purge model sample construction device 200 is provided, comprising:

[0099] An acquisition unit 201 is used to acquire an original time series data set of a stack purge process, wherein the original time series data set includes multiple original time series data subsets, each of which includes multiple groups of feature quantities in a queue form, and each group of feature quantities includes an input feature quantity and a label feature quantity;

[0100] A construction unit 202 is used for sliding a sliding window embedded with an array splitting function in the queue where the input feature quantity is located for each of the original time series data subsets, determining a target input feature quantity array and a target label feature quantity corresponding to each sliding window, and taking each of the target input feature quantity array and the target label feature quantity as a model sample to construct a model sample subset corresponding to the original time series data subset, wherein the array splitting function is used to perform vectorized operations on multiple sliding windows simultaneously;

[0101] The division unit 203 is used to divide each of the model sample subsets into a model training sample set and a model test sample set, so as to perform supervised learning of the stack purge model based on the model training sample set and the model test sample set.

[0102] According to a third aspect of an embodiment of the present application, a computer-readable storage medium is provided, in which at least one computer program instruction is stored, and the at least one computer program instruction is loaded and executed by a processor to implement the operations performed by any method of the first aspect.

[0103] The computer readable storage medium may be a portable compact disk read-only memory (CD-ROM) and include program code, and may be run on a terminal device, such as a personal computer. However, the computer readable storage medium of the present application is not limited thereto, and in the present application, the readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, apparatus, or device.

[0104] The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination thereof. More specific examples of readable storage media (a non-exhaustive list) include: an electrical connection with one or more conductors, a portable disk, 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 disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof.

[0105] Program code for performing the operations of the present application may be written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Java, C++, etc., and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., via the Internet using an Internet service provider).

[0106] See also Fig. 9 , which is a schematic diagram of the structure of a computer system suitable for implementing an electronic device of an embodiment of the present application.

[0107] According to the fourth aspect of an embodiment of the present application, an electronic device is provided, comprising one or more processors and one or more memories, wherein at least one program code is stored in the one or more memories, and the at least one program code is loaded and executed by the one or more processors to implement operations performed by any method of the first aspect.

[0108] like Fig. 9 As shown, the electronic device 400 is in the form of a general computing device. The components of the electronic device 400 may include but are not limited to: at least one processing unit 410, at least one storage unit 420, and a bus 430 connecting different system components (including the storage unit 420 and the processing unit 410).

[0109] The storage unit stores program codes, which can be executed by the processing unit 410, so that the processing unit 410 executes the steps described in the above “Embodiment Method” section of this specification according to various exemplary implementations of the present application.

[0110] The storage unit 420 may include a readable medium in the form of a volatile storage unit, such as a random access memory unit (RAM) 421 and / or a cache memory unit 422 , and may further include a read-only memory unit (ROM) 423 .

[0111] The storage unit 420 may also include a program / utility 424 having a set (at least one) of program modules 425, such program modules 425 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.

[0112] Bus 430 may represent one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.

[0113] The electronic device 400 may also communicate with one or more external devices 500 (e.g., keyboards, pointing devices, Bluetooth devices, etc.), may also communicate with one or more devices that enable a user to interact with the electronic device 400, and / or communicate with any device that enables the electronic device 400 to communicate with one or more other computing devices (e.g., routers, modems, etc.). Such communication may be performed via an input / output (I / O) interface 450. Furthermore, the electronic device 400 may also communicate with one or more networks (e.g., local area networks (LANs), wide area networks (WANs), and / or public networks, such as the Internet) via a network adapter 460. As shown, the network adapter 460 communicates with other modules of the electronic device 400 via a bus 430. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 400, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.

[0114] The functions described herein may be implemented in hardware, software executed by a processor, firmware, or any combination thereof. If implemented in software executed by a processor, the functions may be stored as one or more instructions or codes on a computer-readable medium or transmitted via a computer-readable medium. Other examples and implementations are within the scope and spirit of the present invention and the appended claims. For example, due to the nature of software, the functions described above may be implemented using software executed by a processor, hardware, firmware, hard wiring, or a combination of any of these. In addition, each functional unit may be integrated into a processing unit, each unit may exist physically separately, or two or more units may be integrated into one unit.

[0115] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of units can be a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.

[0116] The units described as separate components may or may not be physically separated, and the components of the control device may or may not be physical units, that is, they may be located in one place or distributed in multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0117] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, server or network device, etc.) to perform all or part of the steps of the methods of each embodiment of the present invention. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk, etc., which can store program code.

[0118] The above description is only an embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent substitution, improvement, etc. made within the spirit and principle of the present application shall be included in the scope of the claims of the present application.

Claims

1. A method for constructing a stack purge model sample, characterized in that: include: Acquire an original time series data set of the stack purge process, wherein the original time series data set includes multiple original time series data subsets, each of the original time series data subsets includes multiple groups of feature quantities in the form of a queue, and each group of feature quantities includes an input feature quantity and a label feature quantity; For each subset of the original time series data, a sliding window embedded with an array splitting function is slid in the queue where the input feature quantity is located, and a target input feature quantity array and a target label feature quantity corresponding to each sliding window are determined, and each target input feature quantity array and the target label feature quantity are used as a model sample to construct a model sample subset corresponding to the subset of the original time series data, wherein the array splitting function is used to perform vectorized operations on multiple sliding windows simultaneously; Each of the model sample subsets is divided into a model training sample set and a model test sample set, so as to perform supervised learning of the stack purge model based on the model training sample set and the model test sample set.

2. The method according to claim 1, characterized in that Before sliding the sliding window based on the nested array slicing function in the queue where the input feature quantity is located, the method further includes: Array conversion is performed on each of the input feature quantities according to a preset data type to obtain a target array, so that a sliding window embedded with an array segmentation function is called to slide in the target array.

3. The method according to claim 1, characterized in that The sliding window based on the nested array segmentation function slides in the queue where the input feature quantity is located, including: In the process of sliding in the queue where the input feature quantity is located according to the preset window size n and the sliding step size s, each sliding window is simultaneously vectorized based on the array segmentation function to segment each sliding window, and the target view is determined according to the target shape and the target step size. The target view includes multiple target input feature quantity arrays set according to the target shape and the target step size, and each of the target input feature quantity arrays corresponds to a sliding window.

4. The method according to claim 3, characterized in that The target step size includes a first step size, a second step size and a third step size, wherein the first step size is the row step size of the target view, the second step size is the column step size of the target view, and the third step size is the size of each element in the target view, each of which is the input feature value in a set of feature values.

5. The method according to claim 3, characterized in that: The step of determining the target input feature array and the target label feature corresponding to each sliding window includes: Determine the target input feature array in the sliding window obtained at the i-th moment; According to the window size n and the sliding step s, the target label feature corresponding to the target input feature array at the i-th moment is determined, wherein the target label feature is the label feature at the (i+n+s)-th moment.

6. The method according to claim 1, characterized in that After taking each of the target input feature arrays and the target label feature as a model sample, the method further includes: Based on the number of feature types of the input feature quantity and the number of feature types of the label feature quantity, the model sample is subjected to dimensionality upgrading processing to obtain a multi-dimensional model sample.

7. The method according to any one of claims 1 to 6, characterized in that: The input feature quantities include purge time and purge flow rate, and the label feature quantities include stack impedance.

8. A device for constructing a stack purge model sample, characterized in that: include: An acquisition unit, used for acquiring an original time series data set of a stack purge process, wherein the original time series data set includes a plurality of original time series data subsets, each of which includes a plurality of groups of feature quantities in a queue form, and each group of feature quantities includes an input feature quantity and a label feature quantity; A construction unit is used for sliding a sliding window embedded with an array splitting function in the queue where the input feature quantity is located for each of the original time series data subsets, determining a target input feature quantity array and a target label feature quantity corresponding to each sliding window, and taking each of the target input feature quantity array and the target label feature quantity as a model sample to construct a model sample subset corresponding to the original time series data subset, wherein the array splitting function is used to perform vectorized operations on multiple sliding windows simultaneously; A division unit is used to divide each of the model sample subsets into a model training sample set and a model test sample set, so as to perform supervised learning of the stack purge model based on the model training sample set and the model test sample set.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores at least one computer program instruction, and the at least one computer program instruction is loaded and executed by a processor to implement the operations performed by any one of the methods according to claims 1-7.

10. An electronic device, characterized in that: The method comprises one or more processors and one or more memories, wherein at least one program code is stored in the one or more memories, and the at least one program code is loaded and executed by the one or more processors to implement the operations performed by the method according to any one of claims 1 to 7.

Citation Information

Cited By

  • Game equipment fault monitoring method

    CN119226109A

  • A method of monitoring a game device for failure

    CN119226109B