Equipment test data calculation method and system, storage medium and electronic equipment
By converting the test data into feature vectors and label vectors, and iteratively training weak classifiers to generate classification models, and compute the automated test data, the problem of wasted computing time and storage resources in the existing technology is solved, and more efficient data processing and storage is achieved.
Patent Information
- Application Number
- CN202411682471.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-22
- Publication Date
- 2025-03-14
AI Technical Summary
During the automated testing process, the existing technology has waste of unnecessary computing time and storage resources for the calculation and processing of test data, and it is impossible to effectively deal with the growth and changes of data in dimensions.
By converting the test data into eigenvectors and label vectors, and iteratively training weak classifiers, generating classification models, classifying eigenvectors, outputting label vectors at representation levels, and performing calculations based on the obtained label vectors to reduce the amount of calculation and data storage.
It reduces the calculation time and storage space of test data, improves the speed of data query, and can flexibly cope with the increase in data volume and hierarchy.
Smart Images

Figure CN119622465A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of automated testing technology, and in particular, relates to a method, system, storage medium and electronic device for calculating device test data. Background Art
[0002] In the process of automated testing of communication equipment, the calculation and processing of test data requires the pre-determination of the data structure and data hierarchy, and then the data is processed and calculated according to the established strategies and algorithms. This data calculation method will generate unnecessary computing time and waste of storage resources.
[0003] The data generated during the automated testing process is a hierarchical structure with project information as the first-level index, the device under test information as the second-level index, and the test module information as the third-level index. In the prior art, all original test data are converted into structured model data. This indiscriminate calculation takes extra computing time; all original test data also contains redundant overfitting data, which takes up extra storage space and affects the query speed of data; due to the consumption of excessive computing power and storage space, the test data calculation of the automated testing business cannot cope with the growth and changes in data dimensions when facing the computing scenario where the structural levels of the data model become more numerous. Summary of the invention
[0004] To solve the above problems, the present disclosure provides a device test data calculation method, system, storage medium and electronic device, which converts test data into feature vectors and label vectors, and the label vector corresponds to the level of the feature vector. By iteratively training weak classifiers, the classification model is determined, the feature vectors are classified, and the label vector representing the level is output. Targeted calculation is performed according to the level represented by the obtained label vector, which can reduce the amount of calculation and data storage.
[0005] The present invention is achieved through the following technical solutions:
[0006] In a first aspect, an embodiment of the present disclosure provides a method for calculating device test data, the method comprising:
[0007] Acquire test data of the device under test, and generate feature data and label data according to the test data;
[0008] Convert the feature data into a feature vector, convert the label data into a label vector, generate sample data using the feature vector and the corresponding label vector, and determine a sample set;
[0009] Iteratively train weak classifiers using the sample set, calculate the model weight of each weak classifier, and generate a classification model based on all weak classifiers and the model weights corresponding to the weak classifiers;
[0010] The feature vector is input into the classification model, and the classification model outputs a label vector according to the feature vector. The test data is calculated according to the label vector to obtain a test data calculation result.
[0011] Furthermore,
[0012] Acquire the test data of the device under test, the test data including project test data, device test data and function module test data, and generate the feature data according to the project test data, device test data and function module test data;
[0013] The label data is determined according to the test level corresponding to the characteristic data; wherein the test level includes project level, device level and function module level.
[0014] Furthermore,
[0015] Converting the feature data into the feature vector, each component in the feature vector corresponds to a different type of the test data;
[0016] Converting the label data into the label vector, each component in the label vector corresponds to a different test level;
[0017] The sample data is generated using the feature vector and the corresponding label vector, and the sample set is determined; wherein the sample data is in vector form.
[0018] Furthermore,
[0019] Dividing the sample set into a training set, a validation set and a test set, and setting a sample weight for each sample data in the training set;
[0020] Iteratively train weak classifiers using the training set, calculate the model weight of each weak classifier, and generate a strong classifier based on all weak classifiers and corresponding model weights;
[0021] The strong classifier is subjected to a performance test using the validation set and the test set, and the strong classifier that passes the performance test is used as the classification model.
[0022] Furthermore,
[0023] The sample set determines the training set according to the first coefficient, determines the validation set according to the second coefficient, and determines the test set according to the third coefficient;
[0024] The sample weight of each sample data in the training set is set, and the sample weight calculation formula is:
[0025] wi=1 / (N*Φ1);
[0026] Among them, wi is the sample weight of the i-th sample data in the training set, N is the total number of sample data in the training set, and Φ1 is the first coefficient of the training set.
[0027] Furthermore,
[0028] Set the number of iterations in the iterative training of weak classifiers, the initial number of weak classifiers, and the learning rate value of weak classifiers;
[0029] Calculating the classification error rate of the weak classifier for the training set, and determining the model weight of the weak classifier according to the classification error rate;
[0030] According to the classification result of each sample data in the training set by the weak classifier, the sample weight of each sample data in the training set is updated;
[0031] The strong classifier is generated according to all weak classifiers and corresponding model weights.
[0032] Furthermore,
[0033] When the output label vector is [1, 0, 0], item-level calculation is performed on the test data;
[0034] When the output label vector is [0, 1, 0], perform device-level calculations on the test data;
[0035] When the output label vector is [0, 0, 1], the test data is calculated at the functional module level;
[0036] When the output label vector is [0, 0, 0], there is no need to perform calculations on the test data.
[0037] In a second aspect, based on the same inventive concept, an embodiment of the present disclosure further provides a device test data calculation system, the system comprising: a data acquisition module, a data storage module, a classification module and a data calculation module;
[0038] The data acquisition module is used to obtain the test data of the device under test, convert the test data into structured data, and then send it to the data storage module; the test data conversion into structured data includes: generating feature data and label data according to the test data;
[0039] The data storage module is used to store the feature data and label data, convert the feature data into a feature vector, convert the label data into a label vector, generate sample data according to the feature vector and the label vector, determine a sample set, and store the sample set; and is also used to store the test data calculation results output by the data calculation module;
[0040] The classification module is used to iteratively train weak classifiers using the sample set, calculate the model weight of each weak classifier, and generate a classification model according to all weak classifiers and the model weights corresponding to the weak classifiers; and is also used to use the classification model to output the label vector according to the feature vector, and transmit the label vector to the data calculation module;
[0041] The data calculation module is used to calculate the test data according to the received label vector to obtain the test data calculation result, and transmit the test data calculation result to the data storage module.
[0042] On the third aspect, based on the same inventive concept, the embodiment of the present disclosure also provides a computer-readable storage medium, storing one or more programs, which, when executed, can implement the aforementioned device test data calculation method.
[0043] In a fourth aspect, based on the same inventive concept, an embodiment of the present disclosure further provides an electronic device, including a processor, a communication interface, the aforementioned computer-readable storage medium, and a communication bus. The processor, the communication interface, and the computer-readable storage medium communicate with each other via the communication bus. The processor is used to execute the program stored in the aforementioned computer-readable storage medium.
[0044] Compared with the prior art, the present invention has the following advantages:
[0045] 1. It can reduce the calculation time of test data and reduce the carrying load of resources;
[0046] 2. It can reduce the storage space occupied by test data and test data calculation results, saving storage space;
[0047] 3. Calculations can be performed based on the level corresponding to the test data. The calculation method is flexible and can meet the calculation needs when the data volume and data level increase.
[0048] Other features and advantages of the present disclosure will be described in the following description, and partly become apparent from the description, or be understood by implementing the present disclosure. The purpose and other advantages of the present disclosure can be realized and obtained by the structures pointed out in the description, claims and drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] In order to more clearly illustrate the embodiments of the present disclosure or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0050] Figure 1 A flow chart of a method for calculating device test data provided by an embodiment of the present disclosure;
[0051] Figure 2 A flow chart of another device test data calculation method provided by an embodiment of the present disclosure;
[0052] Figure 3 A flow chart for determining a classification model provided in an embodiment of the present disclosure;
[0053] Figure 4 A block diagram of a device test data calculation system provided by an embodiment of the present disclosure;
[0054] Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0055] In order to make the purpose, technical solution and advantages of the embodiments of the present disclosure clearer, the technical solution in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are part of the embodiments of the present disclosure, not all of the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present disclosure.
[0056] First, Figure 1 A flow chart of a method for calculating device test data provided by an embodiment of the present disclosure, such as Figure 1 As shown, the embodiment of the present disclosure provides a method for calculating device test data, including:
[0057] S1: Obtain test data of the device under test, and generate feature data and label data based on the test data.
[0058] S11: Acquire test data of the device under test, where the test data includes initialization data and test parameter data of the device under test, and generate feature data according to the initialization data and the test parameter data.
[0059] Specifically, the test data includes the initialization data and test parameter data of the device under test. The initialization data of the device under test includes the test project code, test project cycle, project type, test equipment model, test type, test equipment version, and test equipment function; the test parameter data of the device under test includes the device function test duration, test function items, function item test time, and function item test results. According to the data level, the test data includes: project test data, equipment test data, and function module test data; project test data includes project code, test project cycle, and project type; equipment test data includes test equipment model and test type; function module test data includes test equipment version, test equipment function, device function test duration, test function items, function item test time, and function item test results. Integrate the discrete initialization data and test parameter data to generate feature data.
[0060] S12: Determine label data according to the test level corresponding to the feature data; wherein the test level includes project level, device level and function module level.
[0061] Specifically, the device is tested at different test levels, including project-level testing, device-level testing, and functional module-level testing. After the feature data is generated, the label data is determined according to the test level corresponding to the feature data, and the label data is used to mark the test level of the feature data.
[0062] S2: Convert feature data into feature vectors, convert label data into label vectors, use feature vectors and corresponding label vectors to generate sample data, and determine a sample set.
[0063] S21: Convert the feature data into a feature vector, where each component in the feature vector corresponds to a different type of test data.
[0064] Specifically, the feature vector is represented as Xi, Xi = [x1, x2, x3 ... xn], where n is the number of components in the feature vector. The test data includes the test project code, test project cycle, project type, test equipment model, test type, test equipment version, test equipment function, equipment function test duration, test function item, function item test time, function item test result, including 11 data types in total; therefore, Xi = [x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11], further, Xi = [test project code, test project cycle, project type, test equipment model, test type, test equipment version, test equipment function, equipment function test duration, test function item, function item test time, function item test result].
[0065] S22: Convert the label data into a label vector, where each component in the label vector corresponds to a different test level.
[0066] Specifically, the device is tested, including different test levels, including project-level testing, device-level testing and functional module-level testing; the label vector is represented by Yi, Yi = [y1, y2, y3], further, Yi = [project, device, functional module].
[0067] S23: Generate sample data using the feature vector and the corresponding label vector, and determine a sample set; wherein the sample data is in vector form.
[0068] Specifically, the sample data is represented as [Xi, Yi], and multiple sample data constitute a sample set, which is used in subsequent iterations of the weak classifier.
[0069] S3: Use the sample set to iteratively train the weak classifiers and calculate the model weight of each weak classifier. Generate a classification model based on all weak classifiers and the model weights corresponding to the weak classifiers.
[0070] S31: Divide the sample set into a training set, a validation set, and a test set, and set the sample weight of each sample data in the training set.
[0071] S311: The sample set determines the training set according to the first coefficient, determines the validation set according to the second coefficient, and determines the test set according to the third coefficient.
[0072] Specifically, the sample set is divided into a training set, a validation set, and a test set. The first coefficient is Φ1, the second coefficient is Φ2, and the third coefficient is Φ3. In order to improve the accuracy of the model after training, the training set accounts for most of the sample set and the first coefficient of the training set is maximized. In this embodiment, the first coefficient is Φ1=0.7, so that the training set accounts for 70% of the entire sample set; the second coefficient is Φ2=0.2, so that the validation set accounts for 20% of the entire sample set; the third coefficient is Φ3=0.1, so that the test set accounts for 10% of the entire sample set. The weak classifier is iteratively trained using the training set, and the prediction accuracy test is performed using the validation set and the test set. The proportion of the training set, validation set, and test set in the sample set can be adjusted according to the test results.
[0073] S312: Set the sample weight of each sample data in the training set. The sample weight calculation formula is:
[0074] wi=1 / (N*Φ1);
[0075] Among them, wi is the sample weight of the i-th sample data in the training set, N is the total number of sample data in the training set, and Φ1 is the first coefficient of the training set.
[0076] S32: Iteratively train the weak classifiers using the training set, calculate the model weight of each weak classifier, and generate a strong classifier based on all weak classifiers and the corresponding model weights.
[0077] Step a: Set the number of iterations in the iterative training of the weak classifier, the initial number of weak classifiers, and the learning rate value of the weak classifier.
[0078] Step b: Calculate the classification error rate of the weak classifier for the training set, and determine the model weight of the weak classifier according to the classification error rate.
[0079] Specifically, after the weak classifier is trained, the classification error rate Et of the weak classifier is calculated. The classification error rate Et is the number of samples that are not correctly classified / the number of all samples. The specific formula is as follows:
[0080] Et=(∑ N i=1 I(yi!=Ht(xi))) / N;
[0081] Where Et is the error rate of the t-th weak classifier, I is the indicator function, N is the total number of sample data, yi is the actual value of the i-th sample data, Ht(xi) is the predicted value of the t-th classifier, and when yi! = Ht(xi), I(yi! = Ht(xi)) takes the value of 1, and when yi! ≠ Ht(xi), I(yi! = Ht(xi)) takes the value of 0.
[0082] According to the classification error rate Et of the weak classifier, the model weight of the weak classifier is calculated. The specific formula is as follows:
[0083] αt=1 / 2log 10 ((1-Et) / Et);
[0084] Among them, αt is the model weight of the tth weak classifier, and Et is the error rate of the tth weak classifier; when the error rate is less than or equal to 0.5, the model weight of the weak classifier will be positive, and the lower the error rate, the greater the model weight.
[0085] Step c: Update the sample weight of each sample data in the training set according to the classification result of each sample data in the training set by the weak classifier.
[0086] Specifically, after each weak classifier completes training, the sample weights of each sample data in the training set are updated to prepare for the next round of weak classifier training. The specific formula for updating the training set weights is as follows:
[0087] W t+1(i) =W t *exp(-α t ) / sum(W) when E tWhen <=0.5, the sample is correctly classified;
[0088] W t+1(i) =W t *exp(α t ) / sum(W) when E t When >0.5, the sample is misclassified;
[0089] Among them, Wt+1(i) is the sample weight of the i-th sample data in the training set for training the t+1-th weak classifier, αt is the weight of the t-th classifier, and exp(α t ) is based on the parameter α t To grow, exp(-α t ) is based on the parameter α t Attenuation is performed, and sum(W) is the total sample weight of all sample data.
[0090] Step d: Generate a strong classifier based on all weak classifiers and corresponding model weights.
[0091] Specifically, after T rounds of iterative training of weak classifiers, a strong classifier is formed according to the model weights corresponding to all weak classifiers. The prediction result H(x) of the strong classifier is:
[0092] H(x)=∑ T t αth t (x);
[0093] Among them, αt is the model weight of the t-th classifier, h t (x) is the predicted value of the tth classifier, and H(x) is the final prediction result.
[0094] S33: Use the validation set and the test set to perform performance tests on the strong classifier. The strong classifier that passes the performance test is used as the classification model.
[0095] Use the validation set and the test set to perform a performance test on the strong classifier. If the strong classifier fails the performance test, adjust the number of iterations, the initial number of weak classifiers, the learning rate value of the weak classifier, and the first coefficient of the training set based on the test results. Test results that fail the performance test include overfitting of the strong classifier and underfitting of the strong classifier. When the strong classifier overfits or underfits, adjust the number of iterations, the initial number of weak classifiers, the learning rate value of the weak classifier, and the first coefficient of the training set, and iterate and train the weak classifier again to obtain a strong classifier generated based on all weak classifiers and the corresponding model weights, and perform a performance test on the strong classifier again.
[0096] When the strong classifier has a high accuracy in classifying the training set, but a low accuracy in classifying the validation set and the test set, for example, the validation set is classified by the strong classifier with an accuracy of 100%, while the accuracy of the test set is less than 100%, the strong classifier is judged to be overfitting. When the strong classifier is overfitted, the number of samples in the training set is increased according to the number of iterations, that is, the first coefficient of the training set is increased; in order to obtain effective convergence and correction of the overfitting of the strong classifier in each iterative training of the weak classifier, in the process of changing the first coefficient of the training set, the variation range of the first coefficient of the training set is in the ratio of (0%, 20%], and the ratio of 10% is the most preferred. Taking the variation range ratio of the first coefficient of the training set as 10% as an example, δ1 is the first coefficient of the training set after the change, δ2 is the second coefficient of the validation set after the change, and δ3 is the third coefficient of the test set after the change, δ1=1-Φ2-Φ3, δ2=Φ2*(1-0.1*m), δ3=Φ3*(1-0.1*m), where m is the number of times the weak classifier is re-trained, that is, the number of times the strong classifier is re-determined.
[0097] Furthermore, by reducing the learning rate value of the weak classifier, the change ratio of the learning rate value is in the range of (0%, 5%], and when the change ratio is 1%, it is optimal, so that the strong classifier focuses on the overall characteristics of the data and improves the generalization ability; the learning rate value L of the weak classifier G =L G *(1–0.01*m), L G is the learning rate of the weak classifier, and m is the number of times the weak classifier is re-trained iteratively, that is, the number of times the strong classifier is re-determined.
[0098] Furthermore, when the actual number of weak classifiers is greater than the initial number, the actual number of weak classifiers is reduced. The range of the number of weak classifiers is (0, 5]. When the number of weak classifiers changes to 1, it is optimal. The number of weak classifiers reduced corresponds to the number of iterations. The actual number of weak classifiers is adjusted, and the number of iterations is adjusted accordingly.
[0099] The strong classifier has low accuracy in classifying the training set and the validation set. When the accuracy of the strong classifier in classifying the validation set and the test set is less than 100%, the strong classifier is judged as underfitting. When the strong classifier is underfitting, the first coefficient of the training set is Φ1, the second coefficient of the validation set is Φ2, and the third coefficient of the test set is Φ3, which remain unchanged, increasing the total number of sample sets and improving the overall number of samples.
[0100] Furthermore, by increasing the learning rate value of the weak classifier, the change ratio of the learning rate value is in the range of (0%, 5%], and when the change ratio is 1%, it is the best. The learning rate value L of the weak classifier G =L G*(1+0.01*m), L G is the learning rate of the weak classifier, and m is the number of times the weak classifier is re-trained iteratively, that is, the number of times the strong classifier is re-determined.
[0101] Furthermore, when the actual number of weak classifiers is less than the initial number, the actual number of weak classifiers is increased. The range of the number of weak classifiers is (0, 5]. When the number of weak classifiers changes to 1, it is optimal. The increased number corresponds to the number of iterations. The actual number of weak classifiers is adjusted, and the number of iterations is adjusted accordingly.
[0102] S4: Input the feature vector into the classification model. The classification model outputs a label vector according to the feature vector. The test data is calculated according to the label vector to obtain the calculation result of the test data.
[0103] Specifically, after the test data is saved, feature data is extracted from the test data and converted into a feature vector, and the feature vector is input into the classification model. The classification model outputs a label vector based on the feature vector. The output result of the label vector includes four cases: [1, 0, 0] represents the project level, [0, 1, 0] represents the device level, [0, 0, 1] represents the function module level, and [0, 0, 0] represents that no calculation is required. When the output label vector is [1, 0, 0], the test data is calculated at the project level, and before the calculation, the corresponding test data is converted into a structured data format; when the output label vector is [0, 1, 0], the test data is calculated at the device level, and before the calculation, the corresponding test data is converted into a structured data format; when the output label vector is [0, 0, 1], the test data is calculated at the function module level, and before the calculation, the corresponding test data is converted into a structured data format; converting the corresponding test data into a structured data format includes converting the test data into feature data. After determining the level and performing calculations at the corresponding level, the test data calculation results are obtained.
[0104] In the embodiment of the present disclosure, the label vector is [1, 0, 0]. When the test data is calculated at the project level, only the project test data needs to be calculated. At this time, the test data calculation results may include: project test efficiency, project test progress, total project test pass rate, etc.; the label vector is [0, 1, 0]. When the test data is calculated at the device level, only the project test data and the device test data need to be calculated. At this time, the test data calculation results may include: project test efficiency, project test progress, total project pass rate, total device test time, performance indicators of the tested device, device test coverage points, total device pass rate, etc.; the label vector is [0, 0, 1]. When the test data is calculated at the function module level, it is necessary to calculate the project test data, the device test data and the function module test data. At this time, the test data calculation results may include: project test efficiency, project test progress, total project pass rate, total device test time, performance indicators of the tested device, device test coverage points, total device pass rate, total function module test time, function module test progress, function module test pass rate.
[0105] In the prior art, due to the inclusion of multiple data levels such as projects, equipment, and functional modules, when calculating test data, the calculation of test data will not be divided into levels, and all test data will be calculated without distinction, resulting in a huge amount of calculation, which often consumes a lot of calculation time. For example, whether the test data is calculated at the project level, the equipment level, or the functional module level, all test data are calculated to calculate all the test data calculation results corresponding to all test levels. Therefore, the calculation of test data at any level has a calculation complexity of O(n^3). In the present disclosure, when the test data is calculated at the project level, only the project test data needs to be calculated once, so the calculation complexity is only O(n); when the test data is calculated at the equipment level, only the project test data and the equipment test data need to be calculated, so the calculation complexity is only O(n^2), which significantly reduces the amount of calculation. At the same time, when the label vector is [0, 0, 0], no calculation is performed, which reduces unnecessary calculations.
[0106] Furthermore, due to the optimization of the amount of calculation, the storage space is also reduced accordingly. For example, in the prior art, the test data calculation result occupies 12NKB+1NKB, where N is a natural number. In the present disclosure, the project-level calculation result only occupies 4NKB+1NKB, and the device-level calculation result only occupies 8NKB+1NKB.
[0107] In some examples, the device test data calculation method further includes: periodically obtaining the test data calculation results of the tested device and displaying the test data calculation results, specifically including:
[0108] S51: Periodically receiving a query signal output by a timing unit, where the query signal is used to initiate a data call request according to the project name list.
[0109] S52: The data call request is used to request to query the test data list, and according to the project information in the project name list, the test data calculation results corresponding to all the project information are fed back; wherein the test data list stores the test data calculation results.
[0110] S53: receiving the test data calculation results, controlling the test data calculation results corresponding to all project information, and displaying them on the display screen.
[0111] It should be understood that the data calculation of three test levels is given in the embodiment of the present disclosure, and more levels can actually be divided to meet different test requirements. The present disclosure implements the determination of the test level by the label vector, and performs targeted calculations according to the test level, thereby reducing the amount of calculation, the calculation time, and the storage space occupied.
[0112] Compared with the prior art, the present invention has the following advantages:
[0113] 1. It can reduce the calculation time of test data and reduce the carrying load of resources;
[0114] 2. It can reduce the storage space occupied by test data and test data calculation results, saving storage space.
[0115] 3. Calculations can be performed based on the level corresponding to the test data. The calculation method is flexible and can meet the calculation needs when the data volume and data level increase.
[0116] Embodiment 1:
[0117] Figure 2 Another device test data calculation method flow chart provided in the embodiment of the present disclosure is as follows: Figure 2 As shown, in the embodiment of the present disclosure, the test bed module tests the device under test and generates test data.
[0118] S101: Acquire test data of the device under test and convert it into feature data and label data.
[0119] In the disclosed embodiment, the initialization data and test parameter data of the device under test are collected; wherein, the initialization data of the device under test includes the test project code, test project cycle, project type, test equipment model, test type, test equipment version, and test equipment function; the test parameter data of the device under test includes the device function test duration, test function items, function item test time, and function item test results. According to the data hierarchy, the test data includes: project test data, equipment test data, and function module test data; the project test data includes the project code, test project cycle, and project type; the equipment test data includes the test equipment model and test type; the function module test data includes the test equipment version, test equipment function, device function test duration, test function items, function item test time, and function item test results. The discrete initialization data and test parameter data are integrated to generate feature data, and the initialization data and test parameter data are stored and persistently stored.
[0120] Testing the device includes different test levels, including project-level testing, device-level testing, and functional module-level testing. After generating feature data, the label data is determined according to the test level corresponding to the feature data, and the label data is used to mark the test level of the feature data.
[0121] S102: The feature data is converted into a feature vector, and the label data is converted into a label vector.
[0122] In the disclosed embodiment, the feature data is converted into a feature vector, and each component in the feature vector corresponds to different types of test data. The feature vector is represented as Xi, Xi = [x1, x2, x3 ... xn], where n is the number of components in the feature vector. The test data includes a test project code, a test project cycle, a project type, a test device model, a test type, a test device version, a test device function, a device function test duration, a test function item, a function item test time, and a function item test result, including a total of 11 data types; therefore, Xi = [x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11], and further, Xi = [test project code, test project cycle, project type, test device model, test type, test device version, test device function, device function test duration, test function item, function item test time, function item test result].
[0123] The label data is converted into a label vector, and each component in the label vector corresponds to a different test level. Testing the device includes different test levels, including project-level testing, device-level testing, and functional module-level testing; the label vector is represented by Yi, Yi = [y1, y2, y3], and further, Yi = [project, device, functional module].
[0124] S103: Generate sample data according to the feature vector and the label vector, and determine a sample set.
[0125] The feature vector and the corresponding label vector are used to generate sample data and determine the sample set; wherein the sample data is in vector form. The sample data is represented as [Xi, Yi], and multiple sample data constitute a sample set, which is in the subsequent iteration of the weak classifier.
[0126] S104: Determine a classification model using the sample set.
[0127] In the embodiments of the present disclosure, Figure 3 As shown, the sample set determines the training set according to the first coefficient, determines the validation set according to the second coefficient, and determines the test set according to the third coefficient. The sample set is divided into a training set, a validation set, and a test set. The first coefficient is Φ1, the second coefficient is Φ2, and the third coefficient is Φ3. In order to improve the accuracy of the model after training, the training set occupies most of the sample set and the first coefficient of the training set is maximized. In this embodiment, the first coefficient is Φ1=0.7, so that the training set occupies 70% of the entire sample set; the second coefficient is Φ2=0.2, so that the validation set occupies 20% of the entire sample set; the third coefficient is Φ3=0.1, so that the test set occupies 10% of the entire sample set. Use the training set to iteratively train the weak classifier, use the validation set and the test set to test the prediction accuracy, and adjust the proportion of the training set, validation set, and test set in the sample set according to the test results.
[0128] Set the sample weight of each sample data in the training set. The sample weight calculation formula is:
[0129] wi=1 / (N*Φ1);
[0130] Among them, wi is the sample weight of the i-th sample data in the training set, N is the total number of sample data in the training set, and Φ1 is the first coefficient of the training set.
[0131] Step a: Set the number of iterations in the iterative training of the weak classifier, the initial number of weak classifiers, and the learning rate value of the weak classifier.
[0132] Step b: Calculate the classification error rate of the weak classifier for the training set, and determine the model weight of the weak classifier according to the classification error rate.
[0133] Specifically, after the weak classifier is trained, the classification error rate Et of the weak classifier is calculated. The classification error rate Et is the number of samples that are not correctly classified / the number of all samples. The specific formula is as follows:
[0134] Et=(∑ N i=1 I(yi!=Ht(xi))) / N;
[0135] Where Et is the error rate of the t-th weak classifier, I is the indicator function, N is the total number of sample data, yi is the actual value of the i-th sample data, Ht(xi) is the predicted value of the t-th classifier, and when yi! = Ht(xi), I(yi! = Ht(xi)) takes the value of 1, and when yi! ≠ Ht(xi), I(yi! = Ht(xi)) takes the value of 0.
[0136] According to the classification error rate Et of the weak classifier, the model weight of the weak classifier is calculated. The specific formula is as follows:
[0137] αt=1 / 2log 10 ((1-Et) / Et);
[0138] Among them, αt is the model weight of the tth weak classifier, and Et is the error rate of the tth weak classifier; when the error rate is less than or equal to 0.5, the model weight of the weak classifier will be positive, and the lower the error rate, the greater the weight.
[0139] Step c: Update the sample weight of each sample data in the training set according to the classification result of each sample data in the training set by the weak classifier.
[0140] Specifically, after each weak classifier completes training, the sample weights of each sample data in the training set are updated to prepare for the next round of weak classifier training. The specific formula for updating the training set weights is as follows:
[0141] Wt+1(i)=Wt*exp(-α t ) / sum(W)When Et<=0.5, the sample is correctly classified.
[0142] Wt+1(i)=Wt*exp(α t ) / sum(W)When Et>0.5, the sample is misclassified.
[0143] Among them, Wt+1(i) is the sample weight of the i-th sample data in the training set for training the t+1-th weak classifier, α t is the model weight of the t-th weak classifier, exp(α t ) is based on the parameter α t To grow, exp(-α t ) is based on the parameter α t Attenuation is performed, and sum(W) is the total sample weight of all sample data.
[0144] Step d: Generate a strong classifier based on all weak classifiers and corresponding model weights.
[0145] Specifically, after T rounds of iterative training of weak classifiers, a strong classifier is formed according to the model weights corresponding to all weak classifiers. The prediction result H(x) of the strong classifier is:
[0146] H(x)=∑ T t αth t (x);
[0147] Among them, αt is the model weight of the tth weak classifier, h t (x) is the predicted value of the tth classifier, and H(x) is the final prediction result.
[0148] According to steps a to d, use the training set to iteratively train the weak classifiers and calculate the model weight of each weak classifier. Based on all the weak classifiers and the corresponding model weights, a strong classifier is generated.
[0149] In the disclosed embodiment, the performance test of the strong classifier is performed using the validation set and the test set. If the strong classifier fails to pass the performance test, the number of iterations, the initial number of weak classifiers, the learning rate value of the weak classifier, and the first coefficient of the training set are adjusted according to the test results. The test results that fail to pass the performance test include overfitting of the strong classifier and underfitting of the strong classifier. When the strong classifier overfits and underfits, the number of iterations, the initial number of weak classifiers, the learning rate value of the weak classifier, and the first coefficient of the training set are adjusted, and the weak classifier is re-iteratively trained to obtain a strong classifier generated according to all weak classifiers and corresponding model weights, and the strong classifier is again subjected to performance testing.
[0150] When the strong classifier has a high accuracy in classifying the training set, but a low accuracy in classifying the validation set and the test set, for example, the validation set is classified by the strong classifier with an accuracy of 100%, while the accuracy of the test set is less than 100%, the strong classifier is judged to be overfitting. When the strong classifier is overfitted, the number of samples in the training set is increased according to the number of iterations, that is, the first coefficient of the training set is increased; in order to obtain effective convergence and correction of the overfitting of the strong classifier in each iterative training of the weak classifier, in the process of changing the first coefficient of the training set, the variation range of the first coefficient of the training set is in the ratio of (0%, 20%], and the ratio of 10% is the most preferred. Taking the variation range ratio of the first coefficient of the training set as 10% as an example, δ1 is the first coefficient of the training set after the change, δ2 is the second coefficient of the validation set after the change, and δ3 is the third coefficient of the test set after the change, δ1=1-Φ2-Φ3, δ2=Φ2*(1-0.1*m), δ3=Φ3*(1-0.1*m), where m is the number of times the weak classifier is re-trained, that is, the number of times the strong classifier is re-determined.
[0151] Furthermore, by reducing the learning rate value of the weak classifier, the change ratio of the learning rate value is in the range of (0%, 5%], and when the change ratio is 1%, it is optimal, so that the strong classifier focuses on the overall characteristics of the data and improves the generalization ability; the learning rate value L of the weak classifier G =L G *(1–0.01*m), L G is the learning rate of the weak classifier, and m is the number of times the weak classifier is re-trained iteratively, that is, the number of times the strong classifier is re-determined.
[0152] Furthermore, when the actual number of weak classifiers is greater than the initial number, the actual number of weak classifiers is reduced. The range of the number of weak classifiers is (0, 5]. When the number of weak classifiers changes to 1, it is optimal. The number of weak classifiers reduced corresponds to the number of iterations. The actual number of weak classifiers is adjusted, and the number of iterations is adjusted accordingly.
[0153] The strong classifier has low accuracy in classifying the training set and the validation set. When the accuracy of the strong classifier in classifying the validation set and the test set is less than 100%, the strong classifier is judged as underfitting. When the strong classifier is underfitting, the first coefficient of the training set is Φ1, the second coefficient of the validation set is Φ2, and the third coefficient of the test set is Φ3, which remain unchanged, increasing the total number of sample sets and improving the overall number of samples.
[0154] Furthermore, by increasing the learning rate value of the weak classifier, the change ratio of the learning rate value is in the range of (0%, 5%], and when the change ratio is 1%, it is the best. The learning rate value L of the weak classifier G =L G *(1+0.01*m), L G is the learning rate of the weak classifier, and m is the number of times the weak classifier is re-trained iteratively, that is, the number of times the strong classifier is re-determined.
[0155] Furthermore, when the actual number of weak classifiers is less than the initial number, the actual number of weak classifiers is increased. The range of the number of weak classifiers is (0, 5]. When the number of weak classifiers changes to 1, it is optimal. The increased number corresponds to the number of iterations. The actual number of weak classifiers is adjusted, and the number of iterations is adjusted accordingly.
[0156] The validation set and the test set are used to perform performance tests on the strong classifier, and the strong classifier that passes the performance test is used as the classification model.
[0157] In the disclosed embodiment, after modifying the number of samples in the training set, the number of weak classifiers and the learning rate value, and the number of iterations of the weak classifier, multiple weak classifiers are re-iterated and synthesized into a strong classifier, and the re-synthesized strong classifier is trained using the validation set and the training set until the classification accuracy of the strong classifier tested by the validation set and the test set reaches 100%.
[0158] S105: Input the test data into the classification model, and the classification model outputs a label vector, and performs calculations of the corresponding level according to the label vector or does not perform calculations.
[0159] In the disclosed embodiment, after the test data is saved, feature data is extracted from the test data and converted into a feature vector, and the feature vector is input into the classification model. The classification model outputs a label vector according to the feature vector. The output result of the label vector includes four cases: [1, 0, 0] represents the project level, [0, 1, 0] represents the device level, [0, 0, 1] represents the function module level, and [0, 0, 0] represents that no calculation is required. When the output label vector is [1, 0, 0], the test data is calculated at the project level, and the corresponding test data is converted into a structured data format before the calculation is performed; when the output label vector is [0, 1, 0], the test data is calculated at the device level, and the corresponding test data is converted into a structured data format before the calculation is performed; when the output label vector is [0, 0, 1], the test data is calculated at the function module level, and the corresponding test data is converted into a structured data format before the calculation is performed. The test level that needs to be calculated is determined according to the label vector, and the data of the corresponding test level is calculated to obtain the test data calculation result. After the test data calculation results are obtained, it is determined whether the test is completed. If the test is completed, each module stops working; if the test is not completed, it returns to step S101 to wait for new test data.
[0160] When the determined label vector is [0, 0, 0], there is no need to calculate the test data. If the test is completed, each module stops working; if the test is not completed, it returns to step S101 to wait for new test data.
[0161] In the disclosed embodiment, the test data results can be displayed on a display screen. The query signal output by the timing unit is periodically received, and the query signal is used to initiate a data call request according to the project name list. The data call request is used to request to query the test data list, and feedback the test data calculation results corresponding to all project information according to the project information in the project name list; wherein the test data list stores the test data calculation results. The test data calculation results are received, and the test data calculation results corresponding to all project information are controlled to be displayed on the display screen.
[0162] Second, Figure 4 A block diagram of a device test data calculation system provided by an embodiment of the present disclosure, such as Figure 4 As shown, based on the same inventive concept, the embodiment of the present disclosure also provides a device test data calculation system, the system includes: a data acquisition module, a data storage module, a classification module and a data calculation module. The data acquisition module is used to obtain the test data of the device under test, and after converting the test data into structured data, it is sent to the data storage module; the test data is converted into structured data including: generating feature data and label data according to the test data. The data storage module is used to store feature data and label data, convert feature data into feature vectors, convert label data into label vectors, generate sample data according to feature vectors and label vectors, determine sample sets, and store sample sets; and is also used to store the test data calculation results output by the data calculation module. The classification module is used to iteratively train weak classifiers using sample sets, and calculate the model weights of each weak classifier, and generate a classification model according to all weak classifiers and the model weights corresponding to the weak classifiers; and is also used to use the classification model to output a label vector according to the feature vector, and transmit the label vector to the data calculation module. The data calculation module is used to calculate the test data according to the received label vector, obtain the test data calculation results, and transmit the test data calculation results to the data storage module.
[0163] In some examples, the device test data calculation system also includes a test bed module, which tests the device under test and sends the test data to the data acquisition module.
[0164] In some examples, the device test data calculation system further includes a test screen module, and the test screen module includes a timing unit, a query unit, and a display screen.
[0165] The timing unit is used for periodically sending a query signal to the query unit.
[0166] The query unit is used to initiate a data call request to the data storage module according to the project name list after receiving the query signal. The data call request is used to request the data storage module to query the test data list, and feedback the test data calculation results corresponding to all project information according to the project information in the project name list; wherein the test data list stores the test data calculation results. The query unit receives the data calculation results, controls the test data calculation results corresponding to all project information, and displays them on the display screen.
[0167] Embodiment 2:
[0168] The equipment test data calculation system includes: a test bed module, a data acquisition module, a data storage module, a classification module, a data calculation module and a test screen module. The test bed module is connected to the data acquisition module through an API interface, the data acquisition module is connected to the data storage module through an API interface, the data storage module is connected to the classification module through an API interface, the data calculation module is connected to the classification module through an API interface, the data calculation module is connected to the data storage module through an API interface, and the data storage module is connected to the test screen module through an API interface.
[0169] The test bed module tests the device under test, obtains test data, and transmits the test data to the data acquisition module through the API interface. The data acquisition module obtains the test data of the device under test, converts the test data into feature data and label data, and then calls the API interface to send the feature data and label data to the data storage module; the data storage module stores the feature data and label data, converts the feature data into feature vectors, converts the label data into label vectors, generates sample data based on the feature vectors and label vectors, determines the sample set, and stores the sample set; the classification module calls the API interface to obtain the sample set, uses the sample set to iteratively train the weak classifier, and calculates the model weight of each weak classifier, and generates a classification model based on all weak classifiers and the model weights corresponding to the weak classifiers.
[0170] When the test data needs to be calculated, the classification module calls the API interface, obtains the feature vector from the data storage module, uses the classification model to output the label vector according to the feature vector, and transmits the label vector to the data calculation module through the API interface. The data calculation module calls the API interface, calculates the test data according to the received label vector, obtains the test data calculation result, and transmits the test data calculation result to the data storage module through the API interface. The label vector corresponds to the test level, and the data calculation module performs data calculation on the level corresponding to the value of the label vector according to the label vector.
[0171] The test screen module includes a timing unit, a query unit and a display screen. The timing unit presets a duration ti, and takes ti as a period to periodically send a query signal to the query unit through the Bus. The query unit periodically receives the query signal. After receiving the query signal, it initiates a data call request to the data storage module through the API interface according to the project name list stored in the query unit; the data call request is used to request the data storage module to query the test data list. The data storage module feeds back the test data calculation results corresponding to all project information to the query unit through the API interface according to the project information in the project name list; wherein the test data list stores the test data calculation results. The query unit is connected to the display screen through an HDMI serial line. After the test data calculation results corresponding to all project information are obtained, the data is transmitted through the Bus and displayed on the screen in real time.
[0172] It can be understood that the Bus is a public communication trunk for transmitting information between various functional components of a computer; the API (Application Programming Interface) interface refers to a set of predefined methods and protocols used for communication between software components or systems and allows different applications to interact.
[0173] On the third aspect, based on the same inventive concept, the embodiment of the present disclosure also provides a computer-readable storage medium, storing one or more programs, which, when executed, can implement the aforementioned device test data calculation method.
[0174] Fourthly, based on the same inventive concept, Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure is shown in FIG. Figure 5 As shown, the embodiment of the present disclosure also provides an electronic device, including a processor, a communication interface, the aforementioned computer-readable storage medium and a communication bus. The processor, the communication interface, and the computer-readable storage medium communicate with each other via the communication bus. The processor is used to execute the program stored in the aforementioned computer-readable storage medium.
[0175] It should be noted that the electrical connection between the above-mentioned units does not necessarily mean the connection between lines. An indirect connection method can be applied to the embodiments of the present disclosure as long as the purpose of the present disclosure is achieved.
[0176] Although the present disclosure has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present disclosure.
Claims
1. A method for calculating equipment test data, characterized in that: The method comprises: Acquire test data of the device under test, and generate feature data and label data according to the test data; Convert the feature data into a feature vector, convert the label data into a label vector, generate sample data using the feature vector and the corresponding label vector, and determine a sample set; Iteratively train weak classifiers using the sample set, calculate the model weight of each weak classifier, and generate a classification model based on all weak classifiers and the model weights corresponding to the weak classifiers; The feature vector is input into the classification model, and the classification model outputs a label vector according to the feature vector. The test data is calculated according to the label vector to obtain a test data calculation result.
2. The method according to claim 1, characterized in that The step of acquiring test data of the device under test and generating feature data and label data according to the test data includes: Acquire the test data of the device under test, the test data including project test data, device test data and function module test data, and generate the feature data according to the project test data, device test data and function module test data; The label data is determined according to the test level corresponding to the characteristic data; wherein the test level includes project level, device level and function module level.
3. The method according to claim 1, characterized in that The step of converting the feature data into a feature vector, converting the label data into a label vector, using the feature vector and the corresponding label vector to generate sample data, and determining a sample set includes: Converting the feature data into the feature vector, each component in the feature vector corresponds to a different type of the test data; Converting the label data into the label vector, each component in the label vector corresponds to a different test level; The sample data is generated using the feature vector and the corresponding label vector, and the sample set is determined; wherein the sample data is in vector form.
4. The method according to claim 1, characterized in that: The method of iteratively training weak classifiers using sample sets and calculating the model weight of each weak classifier, and generating a classification model according to all weak classifiers and the model weights corresponding to the weak classifiers, includes: Dividing the sample set into a training set, a validation set and a test set, and setting a sample weight for each sample data in the training set; Iteratively train weak classifiers using the training set, calculate the model weight of each weak classifier, and generate a strong classifier based on all weak classifiers and corresponding model weights; The strong classifier is subjected to a performance test using the validation set and the test set, and the strong classifier that passes the performance test is used as the classification model.
5. The method according to claim 4, characterized in that The sample set is divided into a training set, a validation set and a test set, and the sample weight of each sample data in the training set is set, including: The sample set determines the training set according to the first coefficient, determines the validation set according to the second coefficient, and determines the test set according to the third coefficient; The sample weight of each sample data in the training set is set, and the sample weight calculation formula is: wi=1 / (N*Φ1); Among them, wi is the sample weight of the i-th sample data in the training set, N is the total number of sample data in the training set, and Φ1 is the first coefficient of the training set.
6. The method according to claim 4, characterized in that The method of iteratively training weak classifiers using the training set and calculating the model weight of each weak classifier, and generating a strong classifier according to all weak classifiers and corresponding model weights, includes: Set the number of iterations in the iterative training of weak classifiers, the initial number of weak classifiers, and the learning rate value of weak classifiers; Calculating the classification error rate of the weak classifier for the training set, and determining the model weight of the weak classifier according to the classification error rate; According to the classification result of each sample data in the training set by the weak classifier, the sample weight of each sample data in the training set is updated; The strong classifier is generated according to all weak classifiers and corresponding model weights.
7. The method according to claims 1-6, characterized in that: The label vector includes four cases: When the output label vector is [1, 0, 0], item-level calculation is performed on the test data; When the output label vector is [0, 1, 0], perform device-level calculations on the test data; When the output label vector is [0, 0, 1], the test data is calculated at the functional module level; When the output label vector is [0, 0, 0], there is no need to perform calculations on the test data.
8. A device test data calculation system, characterized in that: The system includes: a data acquisition module, a data storage module, a classification module and a data calculation module; The data acquisition module is used to obtain the test data of the device under test, convert the test data into structured data, and then send it to the data storage module; the test data conversion into structured data includes: generating feature data and label data according to the test data; The data storage module is used to store the feature data and label data, convert the feature data into a feature vector, convert the label data into a label vector, generate sample data according to the feature vector and the label vector, determine a sample set, and store the sample set; and is also used to store the test data calculation results output by the data calculation module; The classification module is used to iteratively train weak classifiers using the sample set, calculate the model weight of each weak classifier, and generate a classification model according to all weak classifiers and the model weights corresponding to the weak classifiers; and is also used to use the classification model to output the label vector according to the feature vector, and transmit the label vector to the data calculation module; The data calculation module is used to calculate the test data according to the received label vector to obtain the test data calculation result, and transmit the test data calculation result to the data storage module.
9. A computer-readable storage medium storing one or more programs, characterized in that: When the one or more programs are executed, the device test data calculation method according to any one of claims 1 to 7 can be implemented.
10. An electronic device comprising a processor, a communication interface, the computer-readable storage medium of claim 9, and a communication bus; wherein: The processor, the communication interface, and the computer-readable storage medium communicate with each other via a communication bus; It is characterized in that The processor is configured to execute a program stored in a computer-readable storage medium.