Fault optical cable prediction method and device, electronic equipment and storage medium
By adjusting the imbalance rate of the sample set and selecting discriminative parameter features, a target sample set is constructed, and the optical cable classification model is trained. This solves the problem of sample imbalance in optical cable fault prediction and improves the prediction accuracy and efficiency of faulty optical cables.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHINA MOBILE (XIONGAN) ICT CO LTD
- Filing Date
- 2022-04-15
- Publication Date
- 2026-04-24
AI Technical Summary
In existing technologies, because optical cable failure events are low-probability events, the number of failed optical cable samples is significantly less than the number of non-faulty optical cable samples, resulting in sample imbalance, which reduces the classification accuracy of optical cable classification models and makes it difficult to accurately predict failed optical cables.
By adjusting the imbalance rate of the sample set, selecting discriminative parameter features, adjusting the number of optical cable samples, constructing a target sample set, and training the optical cable classification model, the classification accuracy of the model can be improved.
It improves the prediction accuracy of faulty optical cables, reduces sample balancing processing time and its adverse impact on model performance, and enhances the prediction efficiency of the optical cable classification model.
Smart Images

Figure CN116975674B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of optical fiber communication technology, and in particular to a method, apparatus, electronic device, and storage medium for predicting faulty optical cables. Background Technology
[0002] With the continuous development of information technology, fiber optic communication technology is being used more and more widely in the information age of the Internet of Things. As the basic physical network of the Internet, the fiber optic cable network plays an irreplaceable supporting role for various service networks. Ensuring the reliable operation of the fiber optic cable network is crucial for the smooth transmission of all kinds of information. Therefore, fault prediction of fiber optic cables, that is, determining whether a fiber optic cable is faulty, is of paramount importance.
[0003] In existing technologies, optical cable classification models are typically used to predict faulty optical cables. These models require training with a sample set containing parameter features of both faulty and non-faulty optical cable samples before application.
[0004] However, since fiber optic cable failures are low-probability events, the number of faulty fiber optic cable samples in the sample set will be significantly less than the number of non-faulty fiber optic cable samples. This will result in a severe imbalance in the number of samples of different categories in the sample set, which will reduce the classification accuracy of the trained fiber optic cable classification model and make it difficult to accurately predict faulty fiber optic cables. Summary of the Invention
[0005] This invention provides a method, apparatus, electronic device, and storage medium for predicting faulty optical cables, in order to overcome the deficiencies in the prior art.
[0006] This invention provides a method for predicting faulty optical cables, comprising:
[0007] Obtain the parameter feature values of the optical cable to be predicted;
[0008] The parameter feature values of the optical cable to be predicted are input into the optical cable classification model to obtain the prediction result of whether the optical cable to be predicted is a faulty optical cable.
[0009] The optical cable classification model is trained based on a target sample set. The target sample set is obtained through the following process: the sample imbalance rate of the initial sample set is adjusted based on the number of discriminative parameter features among the optical cable samples carrying category labels in the initial sample set to obtain a target imbalance rate, and the first number of optical cable samples carrying target category labels in the initial sample set is adjusted based on the target imbalance rate.
[0010] The category label includes a fault label or a non-fault label, the target category label is the fault label, the initial sample set contains the parameter feature values corresponding to the optical cable samples, and the discriminative parameter feature refers to the parameter feature used to distinguish optical cable samples carrying different category labels.
[0011] According to a method for predicting faulty optical cables provided by the present invention, the method further includes:
[0012] Based on the parameter feature values corresponding to the optical cable sample, a feature vector corresponding to each parameter feature is constructed, and the label vector of the optical cable sample is determined.
[0013] The correlation between the feature vector and the label vector is determined using the Pearson test.
[0014] Based on the correlation, the discriminative parameter features are selected from the parameter features.
[0015] According to the present invention, a method for predicting faulty optical cables includes selecting the discriminative parameter features from the parameter features based on the correlation, comprising:
[0016] For any parameter feature, the test statistic of the t-distribution is calculated based on the correlation between the feature vector corresponding to the parameter feature and the label vector.
[0017] If the test statistic is less than a preset threshold, then any parameter feature is determined to be the discriminative parameter feature.
[0018] According to the present invention, a method for predicting faulty optical cables includes adjusting the sample imbalance rate of the initial sample set based on the number of discriminative parameter features among optical cable samples carrying category labels in the initial sample set to obtain a target imbalance rate, comprising:
[0019] The penalty term is determined based on the number of the distinguishing parameter features;
[0020] Based on the penalty term, the sample imbalance rate is adjusted to obtain the target imbalance rate.
[0021] According to the present invention, a method for predicting faulty optical cables, wherein adjusting the sample imbalance rate based on the penalty term to obtain the target imbalance rate includes:
[0022] The target imbalance rate is obtained by calculating the difference between the sample imbalance rate and the penalty term.
[0023] According to a faulty optical cable prediction method provided by the present invention, adjusting the first number of optical cable samples carrying target category labels in the initial sample set based on the target imbalance rate includes:
[0024] Based on the target imbalance rate, calculate the equivalent number of optical cable samples carrying the non-faulty tag in the initial sample set;
[0025] Based on the equivalent quantity, a second quantity of optical cable samples carrying the fault tag is determined after adjustment, and the second quantity of optical cable samples carrying the fault tag is added to the initial sample set.
[0026] According to the present invention, a method for predicting faulty optical cables includes obtaining parameter feature values of the optical cable to be predicted, comprising:
[0027] Obtain the non-numerical parameter feature information of the optical cable to be predicted;
[0028] The non-numerical parameter features are One-Hot encoded to obtain the parameter feature values corresponding to the non-numerical parameter feature information.
[0029] The present invention also provides a fault optical cable prediction device, comprising:
[0030] The acquisition module is used to acquire the parameter feature values of the optical cable to be predicted;
[0031] The prediction module is used to input the parameter feature values of the optical cable to be predicted into the optical cable classification model, and obtain the prediction result of whether the optical cable to be predicted is a faulty optical cable output by the optical cable classification model.
[0032] The optical cable classification model is trained based on a target sample set. The target sample set is obtained through the following process: the sample imbalance rate of the initial sample set is adjusted based on the number of discriminative parameter features among the optical cable samples carrying category labels in the initial sample set to obtain a target imbalance rate, and the first number of optical cable samples carrying target category labels in the initial sample set is adjusted based on the target imbalance rate.
[0033] The category label includes a fault label or a non-fault label, the target category label is the fault label, the initial sample set contains the parameter feature values corresponding to the optical cable samples, and the discriminative parameter feature refers to the parameter feature used to distinguish optical cable samples carrying different category labels.
[0034] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the fault optical cable prediction method as described above.
[0035] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the faulty optical cable prediction method as described above.
[0036] The present invention also provides a computer program product, including a computer program that, when executed by a processor, implements the faulty optical cable prediction method as described above.
[0037] The faulty optical cable prediction method, apparatus, electronic device, and storage medium provided by this invention predict whether an optical cable to be predicted is faulty through an optical cable classification model, thereby improving prediction efficiency. The target sample set used during the training of the optical cable classification model is adjusted by utilizing the number of discriminative parameter features among optical cable samples carrying category labels in the initial sample set to obtain a target imbalance rate. This target imbalance rate is then used to adjust the first number of optical cable samples carrying the target category label in the initial sample set, which improves the classification accuracy of the trained optical cable classification model, thereby improving the prediction accuracy of faulty optical cables. Furthermore, introducing the target imbalance rate to adjust the first number, compared to directly adjusting the first number based on the difference in the number of optical cable samples with different category labels in the initial sample set, requires fewer optical cable samples with the target category label. This not only reduces the time required to balance the optical cable samples but also mitigates the adverse effects of the increased optical cable samples on the performance of the optical cable classification model. Attached Figure Description
[0038] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, those skilled in the art can obtain other drawings based on the drawings described below without creative effort.
[0039] Figure 1 This is a flowchart of the faulty optical cable prediction method provided by the present invention;
[0040] Figure 2 This is a schematic diagram illustrating how the imbalance rate IR changes with the number of optical cable samples p, as provided by this invention.
[0041] Figure 3 This is a schematic diagram of the structure of the fault optical cable prediction device provided by the present invention;
[0042] Figure 4 This is a schematic diagram of the structure of the electronic device provided by the present invention. Detailed Implementation
[0043] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.
[0044] Since fiber optic cable failures are low-probability events, the number of faulty fiber optic cable samples in the sample set used to train the fiber optic cable classification model is significantly less than the number of non-faulty fiber optic cable samples. This will result in a severe imbalance in the number of samples of different categories in the sample set, which will reduce the classification accuracy of the trained fiber optic cable classification model and make it difficult to accurately predict faulty fiber optic cables.
[0045] Currently, the traditional metric for measuring class imbalance between faulty and non-faulty optical cable samples is the imbalance rate (IR), which is the ratio of the number of non-faulty optical cable samples (majority class) to the number of faulty optical cable samples (minority class). IR is defined as:
[0046]
[0047] Where, N maj N represents the number of non-faulty optical cable samples. min Let represent the number of faulty optical cable samples. Clearly, when IR = 1, the sample set is perfectly balanced. When IR > 1, the larger the IR, the greater the imbalance in the sample set.
[0048] In an imbalanced sample set, two sample sets with the same imbalance rate but different numbers of fiber optic cable samples may have very different classification performances. That is, although these two sample sets have the same imbalance rate, the sample set with more discriminative features has better classification performance, so they cannot be said to have the same degree of imbalance. Similarly, when predicting faulty fiber optic cables, if the fault-to-non-fault ratio of two types of fiber optic cables is the same and IR is used as the metric, the same sample balancing method is applied to both types of cables, i.e., increasing or decreasing the corresponding number of samples. However, in reality, because one type of fiber optic cable has more discriminative features between faulty and non-faulty samples than the other, the time spent on sample balancing for the faulty fiber optic cable sample set will be less than for the other type. Therefore, this invention provides a faulty fiber optic cable prediction method that adjusts the imbalance rate in the sample set, thereby adjusting the number of faulty fiber optic cable samples in the sample set to make the number of fiber optic cable samples carrying different category labels more balanced.
[0049] Figure 1This is a flowchart of a faulty optical cable prediction method provided in an embodiment of the present invention, such as... Figure 1 As shown, the method includes:
[0050] S1, obtain the parameter feature values of the optical cable to be predicted;
[0051] S2, input the parameter feature values of the optical cable to be predicted into the optical cable classification model, and obtain the prediction result of whether the optical cable to be predicted is a faulty optical cable output by the optical cable classification model;
[0052] The optical cable classification model is trained based on a target sample set. The target sample set is obtained through the following process: the sample imbalance rate of the initial sample set is adjusted based on the number of discriminative parameter features among the optical cable samples carrying category labels in the initial sample set to obtain a target imbalance rate, and the first number of optical cable samples carrying target category labels in the initial sample set is adjusted based on the target imbalance rate.
[0053] The category label includes a fault label or a non-fault label, the target category label is the fault label, the initial sample set contains the parameter feature values corresponding to the optical cable samples, and the discriminative parameter feature refers to the parameter feature used to distinguish optical cable samples carrying different category labels.
[0054] Specifically, the fault optical cable prediction method provided in this embodiment of the invention is executed by a fault optical cable prediction device, which can be configured in a server. The server can be a local server or a cloud server. The local server can be a computer, etc., and this embodiment of the invention does not make specific limitations on this.
[0055] First, step S1 is executed to obtain the parameter characteristic values of the optical cable to be predicted. The optical cable to be predicted refers to the optical cable whose fault status needs to be determined. The parameter characteristic values refer to the numerical representation of the parameter characteristics, which may include hundreds of parameters such as the optical cable's rated tensile strength, bending radius, outer sheath thickness, outer sheath dielectric strength, outer sheath insulation resistance, inner dielectric strength of the outer sheath, armor and metal reinforcing core, line class, manufacturer, outer diameter, traction end radius, traction length, traction tension, reserved length, termination date, laying type, type, number of optical fiber cores inside the cable, structural method, transmission conductor, and medium condition.
[0056] Parameter features can include numerical parameter features and non-numerical parameter features. For numerical parameter features, their values can be obtained directly. For fractional parameter features, their information can be obtained intelligently. At this time, their information can be converted into value form through conventional methods. The specific method used for conversion is not limited here.
[0057] Then, step S2 is executed, where the parameter feature values of the optical cable to be predicted are input into the optical cable classification model. The optical cable classification model analyzes the parameter feature values of the optical cable to be predicted, and obtains and outputs the prediction result of whether the optical cable to be predicted is a faulty optical cable. This prediction result can include whether the optical cable to be predicted is a faulty optical cable or not. These two prediction results can be marked separately. For example, the optical cable to be predicted as a faulty optical cable can be marked as 1, and the optical cable to be predicted as not a faulty optical cable can be marked as 0. Other marking methods can also be used.
[0058] Understandably, the fiber optic cable classification model can be a machine learning model, such as a support vector machine model, a decision tree model, or a k-nearest neighbor algorithm model. The fiber optic cable classification model can be trained using a target sample set, which can be determined by an initial sample set. This initial sample set is the sample set before adjustment using the target imbalance rate, and the target sample set is the sample set after adjustment using the target imbalance rate.
[0059] The initial sample set may include parameter feature values corresponding to optical cable samples carrying category labels. Category labels may include fault labels and non-fault labels. Optical cable samples may include faulty optical cable samples carrying fault labels and non-faulty optical cable samples carrying non-fault labels. The sample imbalance rate of the initial sample set can be calculated using the aforementioned IR calculation formula.
[0060] Discriminating parameters are the features used to distinguish optical cable samples carrying different category labels. They play a crucial role in differentiating different categories of optical cable samples in an imbalanced sample set, and a sample set with more discriminative parameters exhibits better classification performance. Discriminating parameters can include at least 15 items such as the optical cable's bending radius, line class, manufacturer, outer diameter, traction end radius, traction length, traction tension, reserved length, termination date, laying type, category, number of optical fiber cores, structural method, transmission conductor, and medium condition. Non-discriminating parameters include the optical cable's rated tensile strength, outer sheath thickness, outer sheath dielectric strength, outer sheath insulation resistance, and dielectric strength of the inner sheath, as well as the presence of armor and metal reinforcing cores.
[0061] For example, suppose there are two sample sets A and B, where the sample size distributions for different classes are the same. Then, using existing metrics, we will obtain the same degree of class imbalance because these metrics only consider the class distributions. Now, if more discriminative features are added to A than to B, we can expect A to have better classification performance than B because the added discriminative features introduce valuable discriminative information.
[0062] When different discriminative parameter features are added to an imbalanced sample set, the following experiments can demonstrate the changes and trends in classification performance.
[0063] Simulation Experiment 1: Experiments were conducted under various fiber optic cable sample sizes and different reference indices (IRs). The sample size p ranged from {2, 10, 50, 100, 500, 1000}, and the IR ranged from {5, 10, 50, 100, 500}. In other words, given an IR, the classification performance of sample sets with six different p values was studied. In the experiments, a normal distribution N(μ) was used... maj ,∑ maj ) and N(μ min ,∑ min ) represents the majority and minority class distributions. It can be assumed that, under a fixed variance, μ min and μ maj The greater the difference between them, the stronger the discriminative power of the features. Four comparative experiments can be conducted as follows: 1) Add p-2 non-discriminative features to both the p-dimensional minority and majority classes; 2) Add (p-2)*10% non-discriminative features to both the p-dimensional minority and majority classes; 3) Add (p-2)*50% non-discriminative features to both the p-dimensional minority and majority classes; 4) Add (p-2)*90% non-discriminative features to both the p-dimensional minority and majority classes.
[0064] It should be noted that if the number of added non-discriminative parameter features is an integer, and the calculated value is a decimal, then it needs to be rounded up.
[0065] Simulation Experiment 2: Adding Discriminative and Non-Discriminative Features with Different Mixing Ratios. In real-world data, features are usually not as discriminative or non-discriminative as in Simulation Experiment 1. Here, we simulate data with a mixture of discriminative and non-discriminative features to study the changes in classification performance as the mixing ratio changes. The experimental setup remains the same, conducted under various fiber optic cable sample sizes and different indices (IRs). The sample size p ranges from {2, 10, 50, 100, 500, 1000}, and the IR ranges from {5, 10, 50, 100, 500}. In other words, given an IR, we study the classification performance of sample sets with six different p values. In the experiment, we added k% discriminative features and (100-k)% non-discriminative features, where k ranges from {10, 50, 90}.
[0066] The above experiments lead to the following conclusions:
[0067] First, for sample sets with the same IR but different sample numbers p of optical cables, the classification performance is different. Considering the negative correlation between the imbalance rate and the classification performance, it is not appropriate to use the same IR to describe the imbalance rate of these sample sets.
[0068] Second, the more discriminative features there are, the better the classification performance. This is because discriminative features can provide more discriminative information, thereby increasing the differences between categories and achieving better classification.
[0069] Therefore, the sample imbalance rate of the initial sample set can be adjusted by the number of discriminative parameter features among the optical cable samples carrying category labels in the initial sample set, so as to obtain the target imbalance rate.
[0070] Discriminative parameters can be determined by the correlation between the parameters of the optical cable samples and the category labels, or they can be given directly; no specific limitation is made here.
[0071] Subsequently, the initial number of optical cable samples carrying the target category label in the initial sample set can be adjusted using the target imbalance rate to obtain the target sample set. Here, the target category label is the fault label; that is, the initial number of faulty optical cable samples in the initial sample set needs to be adjusted using the target imbalance rate. The resulting target sample set will have a roughly equal number of optical cable samples carrying different category labels, which can be the same or different. However, optical cable samples carrying different category labels contribute equally to the training of the optical cable classification model.
[0072] The faulty optical cable prediction method provided in this embodiment of the invention first obtains the parameter feature values of the optical cable to be predicted; then, it inputs these parameter feature values into an optical cable classification model to obtain the prediction result of whether the optical cable to be predicted is a faulty optical cable. Using an optical cable classification model to predict whether the optical cable to be predicted is a faulty optical cable can improve prediction efficiency. The target sample set used during the training of the optical cable classification model is obtained by adjusting the sample imbalance rate of the initial sample set using the number of discriminative parameter features between optical cable samples carrying category labels in the initial sample set, thus obtaining a target imbalance rate. This target imbalance rate is then used to adjust the first number of optical cable samples carrying target category labels in the initial sample set, thereby improving the classification accuracy of the trained optical cable classification model and consequently improving the prediction accuracy of faulty optical cables. Moreover, by introducing a target imbalance rate to adjust the first quantity, compared to the scheme that directly adjusts the first quantity by the difference in the number of optical cable samples with different category labels in the initial sample set, the number of optical cable samples with the target category label is less. This not only reduces the time required to balance the optical cable samples, but also reduces the adverse impact of the increased optical cable samples on the performance of the optical cable classification model.
[0073] This adverse effect refers to the fact that the method of increasing the number of optical cable samples is usually to synthesize or resample the parameter feature values corresponding to the optical cable samples carrying the target category label. The optical cable samples obtained in this way will amplify the characteristics of the optical cable samples carrying the target category label in the target sample set, thereby affecting the performance of the optical cable classification model.
[0074] Based on the above embodiments, the faulty optical cable prediction method provided in this embodiment of the invention further includes:
[0075] Based on the parameter feature values corresponding to the optical cable sample, a feature vector corresponding to each parameter feature is constructed, and the label vector of the optical cable sample is determined.
[0076] The correlation between the feature vector and the label vector is determined using the Pearson test.
[0077] Based on the correlation, the discriminative parameter features are selected from the parameter features.
[0078] Specifically, in this embodiment of the invention, the discriminative parameter feature can be determined using the Pearson test. The Pearson test can effectively detect the correlation between two feature vectors. If the correlation between a feature vector and a label vector is non-zero, then this parameter feature can be considered a discriminative parameter feature.
[0079] When determining the discriminative parameter features, we can first construct the feature vector corresponding to each parameter feature based on the parameter feature values corresponding to the optical cable sample, and then determine the label vector corresponding to the feature vector.
[0080] Suppose there are N optical cable samples in the initial sample set, and each optical cable sample has p parameter features. Then the initial sample set can be represented as follows: Where, x i =[x 1i ,x 2i ,...,x pi ] T ∈R p×1 And y i ∈{-1,1}. Define the feature vector corresponding to the j-th parameter feature as x. j =[x j1 ,x j2 ,...,x jN ] T (j=1,2,...,p), the label vector of the optical cable sample is y=[y1,y2,...,y N ].
[0081] Then, the Pearson test is used to determine the eigenvector x. j With the label vector y = [y1, y2, ..., y N The correlation between [the two entities] can be represented by the Pearson correlation coefficient, which can be expressed as ρ. j .
[0082] Subsequently, based on correlation, discriminative parameter features can be selected from each parameter feature, and the number of discriminative parameter features can be determined. In this embodiment of the invention, all parameter features corresponding to feature vectors that are correlated with the label vector can be used as discriminative parameter features.
[0083] In this embodiment of the invention, the discriminative parameter features are determined by using the Pearson test method, which can improve the accuracy of the discriminative parameter features, thereby improving the performance of the optical cable classification model and the accuracy of the prediction results.
[0084] Based on the above embodiments, the faulty optical cable prediction method provided in this embodiment of the invention, wherein selecting the discriminative parameter features from the parameter features based on the correlation, includes:
[0085] For any parameter feature, the test statistic of the t-distribution is calculated based on the correlation between the feature vector corresponding to the parameter feature and the label vector.
[0086] If the test statistic is less than a preset threshold, then any parameter feature is determined to be the discriminative parameter feature.
[0087] Specifically, in this embodiment of the invention, when selecting the discriminative parameter features from each parameter feature through correlation, for any parameter feature, the test statistic of the t-distribution can be calculated by the correlation between the feature vector corresponding to the parameter feature and the label vector.
[0088] Taking any parameter feature as the j-th parameter feature as an example, the feature vector corresponding to any parameter feature is the j-th feature vector x. j The test statistic t of the t-distribution j It can be represented as:
[0089]
[0090] Among them, t j It follows a t-distribution with N-2 degrees of freedom.
[0091] Next, the relationship between the test statistic and a preset threshold is determined. This preset threshold can be set as needed, for example, it can be set to |t|. N-2,1-α If the test statistic is less than the preset threshold, i.e., t...j <|t N-2,1-α At this point, we reject the null hypothesis H0 and choose the alternative hypothesis H1, that is, we assume that the eigenvector x j The corresponding parametric features are discriminative parametric features. We define them as the number of discriminative features in a certain class. Therefore, any parametric feature can be determined to be a discriminative parametric feature.
[0092] For each of the parameter features, the above process is performed, that is, the Pearson test is applied to each parameter feature, and the number of times H0 is rejected is counted (p). * Then, it can be determined that all discriminative parameter features are selected from each parameter feature.
[0093] Here, p is the number of times H0 is rejected. * This refers to the number of distinguishing features.
[0094] In this embodiment of the invention, the discriminative parameter features are determined by calculating the test statistic of the t-distribution, which simplifies the determination process and improves the accuracy of the number of discriminative parameter features obtained.
[0095] Based on the above embodiments, the faulty optical cable prediction method provided in this embodiment of the invention, wherein adjusting the sample imbalance rate of the initial sample set based on the number of discriminative parameter features among optical cable samples carrying category labels in the initial sample set to obtain a target imbalance rate, includes:
[0096] The penalty term is determined based on the number of the distinguishing parameter features;
[0097] Based on the penalty term, the sample imbalance rate is adjusted to obtain the target imbalance rate.
[0098] Specifically, in this embodiment of the invention, in obtaining the target imbalance rate, a penalty term can first be determined by the number of discriminative parameter features. This penalty term can be expressed as: λlog(p * ), where is a parameter that controls the importance of the penalty item.
[0099] The penalty term can adjust the impact of the number of fiber optic cable samples in the initial sample set on the classification performance of the trained fiber optic cable classification model. In particular, in some extreme cases, there may be p... * =0, in this case, log(p) * ) is undefined. To resolve this issue, in p * When p = 0, * Set to p * =1.
[0100] Subsequently, the sample imbalance rate of the initial sample set can be adjusted according to the penalty term. That is, a penalty term can be introduced on the basis of the sample imbalance rate of the initial sample set to obtain the target imbalance rate IR'.
[0101] Clearly, for an initial sample set with a fixed IR, the adjusted IR' decreases as the discriminative parameter features increase. Therefore, the adjusted IR' has a better negative correlation with the classification performance of the trained optical cable classification model, because the classification performance of the optical cable classification model increases with p. * It gets better as a result of the increase.
[0102] In this embodiment of the invention, a penalty term is constructed by the number of discriminative parameter features, thereby obtaining the target imbalance rate. This can make the target imbalance rate lower than the initial sample imbalance rate. Therefore, by adjusting the first quantity in conjunction with the target imbalance rate, the imbalance of the initial sample set can be offset with a small adjustment to the first quantity, so that the imbalance of the target sample set is 0.
[0103] Based on the above embodiments, the faulty optical cable prediction method provided in this embodiment of the invention, wherein adjusting the sample imbalance rate based on the penalty term to obtain the target imbalance rate, includes:
[0104] The target imbalance rate is obtained by calculating the difference between the sample imbalance rate and the penalty term.
[0105] Specifically, the target imbalance rate can be expressed as:
[0106] IR′=IR-λlog(p * )
[0107] In this embodiment of the invention, the target imbalance rate is determined by calculating the difference between the sample imbalance rate and the penalty term, which simplifies the calculation process of the target imbalance rate and improves efficiency.
[0108] Based on the above embodiments, the faulty optical cable prediction method provided in this embodiment of the invention, wherein adjusting the first number of optical cable samples carrying target category labels in the initial sample set based on the target imbalance rate includes:
[0109] Based on the target imbalance rate, calculate the equivalent number of optical cable samples carrying the non-faulty tag in the initial sample set;
[0110] Based on the equivalent quantity, a second quantity of optical cable samples carrying the fault tag is determined after adjustment, and the second quantity of optical cable samples carrying the fault tag is added to the initial sample set.
[0111] Specifically, in this embodiment of the invention, when adjusting the first number of optical cable samples carrying the target category label in the initial sample set, the equivalent number of optical cable samples carrying the non-fault label in the initial sample set can be calculated first based on the target imbalance rate.
[0112] Let x be the equivalent number of optical cable samples carrying non-faulty tags in the initial sample set, and N be the initial number of optical cable samples carrying target category tags in the initial sample set. min Then we have:
[0113]
[0114] Then we have:
[0115] x = IR′ * N min
[0116] Subsequently, the equivalent quantity x can be directly used as the second quantity of optical cable samples carrying fault tags after adjustment, and the second quantity of optical cable samples carrying fault tags can be added to the initial sample set. The addition can be done using the SMOTE method, such as synthesis or resampling, without specific limitations here.
[0117] For example, if the initial sample set involves 3852 optical cable samples, of which 201 are faulty and 3651 are non-faulty, and the faulty samples account for only 5.2% of the total sample, the sample imbalance rate is:
[0118]
[0119] The adjusted target imbalance rate is:
[0120]
[0121] The equivalent quantity is:
[0122] x = IR′ * N min =16.99 * 201 = 3415
[0123] Subsequently, parameter feature values corresponding to 3415 faulty optical cable samples can be added to the initial sample set to obtain the target sample set. In the target sample set, the number of faulty optical cable samples and the number of non-faulty optical cable samples each account for approximately 50%, achieving data balance.
[0124] If the method is directly based on the difference in the number of faulty and non-faulty optical cable samples in the initial sample set, then parameter feature values corresponding to 3450 faulty optical cable samples need to be added to the initial sample set. Therefore, the method provided in this embodiment of the invention can reduce the number of optical cable samples added to the initial sample set.
[0125] It is understandable that there are 7267 optical cable samples in the target sample set, and 80% of the optical cable samples can be randomly selected to form the training samples, while the remaining 20% of the optical cable samples can form the test samples.
[0126] In this embodiment of the invention, a specific method for determining the second quantity is provided, which can reduce the number of samples that need to be added and reduce the adverse impact of the added samples on the performance of the optical cable classification model.
[0127] Based on the above embodiments, the faulty optical cable prediction method provided in this embodiment of the invention includes, in the step of obtaining the parameter feature values of the optical cable to be predicted, the following:
[0128] Obtain the non-numerical parameter feature information of the optical cable to be predicted;
[0129] The non-numerical parameter features are One-Hot encoded to obtain the parameter feature values corresponding to the non-numerical parameter feature information.
[0130] Specifically, in this embodiment of the invention, when obtaining the parameter feature values of the optical cable to be predicted, the non-numerical parameter feature information of the optical cable to be predicted can be obtained first. This non-numerical parameter feature information refers to features that cannot be directly represented by numerical values. At this time, the non-numerical parameter features can be One-Hot encoded to obtain the parameter feature values corresponding to the non-numerical parameter feature information. That is, through One-Hot encoding, the non-numerical parameter feature information can be converted into numerical parameter feature values.
[0131] One-Hot encoding is a representation of categorical variables as binary vectors. This first requires mapping categorical values to integer values. Then, each integer value is represented as a binary vector, which is zero except for its index, and is labeled as 1.
[0132] like Figure 2 As shown, the imbalance rate IR varies with the number of optical cable samples p. Figure 2 Curve 1 represents IR = 100, curve 2 represents the sample imbalance rate, and curve 3 represents the target imbalance rate. As the number of optical cable samples in the sample set increases, the adjusted IR' gradually decreases. This means that the imbalance of the sample set is decreasing, thereby reducing the number of samples to be sampled during oversampling or undersampling.
[0133] After obtaining the target sample set, the fiber optic cable classification model can be trained using the training samples in the target sample set. The table below shows the prediction results of the fiber optic cable classification model obtained using the test samples:
[0134] Table 1. Prediction results of the optical cable classification model
[0135] Number of faulty optical cable samples Number of non-faulty optical cable samples True value 41 676 Predicted value 33 684
[0136] In this embodiment of the invention, the F1 score is used to measure the prediction results of the optical cable classification model. The F1 score is a metric for classification problems, which is the harmonic mean of precision and recall, with a maximum value of 1 and a minimum value of 0. Its expression is:
[0137]
[0138] Wherein, precision represents the accuracy (the percentage of optical cable samples predicted as non-faulty optical cables that are actually non-faulty optical cables), and recall represents the recall (the percentage of faulty optical cable samples that were predicted as faulty optical cables by the optical cable classification model).
[0139] The sample imbalance ratio (IR) before imbalance adjustment was 18.16, and the target imbalance ratio (IR') after adjustment was 16.99. The adjusted F1-score reached 71.89%, an improvement of 0.86% compared to the original F1-score. This demonstrates that, without increasing hardware or software costs, the preprocessing method for predicting faulty optical cables established in this embodiment not only reduces the time spent on oversampling samples during imbalance sample processing but also improves the prediction accuracy of faulty optical cables. Therefore, the optical cable classification model in this embodiment can provide some assistance in predicting faulty optical cables.
[0140] With the advent of the information age, the development of various industries is now closely related to communication technology. Therefore, both businesses and individuals have high requirements for communication levels, and the communication industry is developing rapidly. The quality of communication technology is directly related to the maintenance of current optical fiber cables. The optical fiber cable classification model in this invention can not only be used for fault detection of optical fiber cables, but also for predicting various signal faults. For example, signal problems in BeiDou positioning and signal faults in 5G transmission can be effectively predicted using the optical fiber cable classification model in this invention, alerting personnel to take action and reducing the occurrence of safety accidents. It has certain commercial value in signal fault prediction and optical fiber cable fault prediction.
[0141] like Figure 3 As shown, based on the above embodiments, this embodiment of the invention provides a fault optical cable prediction device, comprising:
[0142] The acquisition module 31 is used to acquire the parameter feature values of the optical cable to be predicted;
[0143] The prediction module 32 is used to input the parameter feature values of the optical cable to be predicted into the optical cable classification model, and obtain the prediction result of whether the optical cable to be predicted is a faulty optical cable output by the optical cable classification model.
[0144] The optical cable classification model is trained based on a target sample set. The target sample set is obtained through the following process: the sample imbalance rate of the initial sample set is adjusted based on the number of discriminative parameter features among the optical cable samples carrying category labels in the initial sample set to obtain a target imbalance rate, and the first number of optical cable samples carrying target category labels in the initial sample set is adjusted based on the target imbalance rate.
[0145] The category label includes a fault label or a non-fault label, the target category label is the fault label, the initial sample set contains the parameter feature values corresponding to the optical cable samples, and the discriminative parameter feature refers to the parameter feature used to distinguish optical cable samples carrying different category labels.
[0146] Based on the above embodiments, the faulty optical cable prediction device provided in this embodiment of the invention further includes a distinguishing parameter feature selection module, used for:
[0147] Based on the parameter feature values corresponding to the optical cable sample, a feature vector corresponding to each parameter feature is constructed, and the label vector of the optical cable sample is determined.
[0148] The correlation between the feature vector and the label vector is determined using the Pearson test.
[0149] Based on the correlation, the discriminative parameter features are selected from the parameter features.
[0150] Based on the above embodiments, the faulty optical cable prediction device provided in this embodiment of the invention, wherein the distinguishing parameter feature selection module is specifically used for:
[0151] For any parameter feature, the test statistic of the t-distribution is calculated based on the correlation between the feature vector corresponding to the parameter feature and the label vector.
[0152] If the test statistic is less than a preset threshold, then any parameter feature is determined to be the discriminative parameter feature.
[0153] Based on the above embodiments, the faulty optical cable prediction device provided in this embodiment of the invention further includes an adjustment module, used for:
[0154] The penalty term is determined based on the number of the distinguishing parameter features;
[0155] Based on the penalty term, the sample imbalance rate is adjusted to obtain the target imbalance rate.
[0156] Based on the above embodiments, the faulty optical cable prediction device provided in this embodiment of the invention, wherein the adjustment module is specifically used for:
[0157] The target imbalance rate is obtained by calculating the difference between the sample imbalance rate and the penalty term.
[0158] Based on the above embodiments, in the fault optical cable prediction device provided in this embodiment of the invention, the adjustment module is further used for:
[0159] Based on the target imbalance rate, calculate the equivalent number of optical cable samples carrying the non-faulty tag in the initial sample set;
[0160] Based on the equivalent quantity, a second quantity of optical cable samples carrying the fault tag is determined after adjustment, and the second quantity of optical cable samples carrying the fault tag is added to the initial sample set.
[0161] Based on the above embodiments, the faulty optical cable prediction device provided in this embodiment of the invention, wherein the acquisition module is specifically used for:
[0162] Obtain the non-numerical parameter feature information of the optical cable to be predicted;
[0163] The non-numerical parameter features are One-Hot encoded to obtain the parameter feature values corresponding to the non-numerical parameter feature information.
[0164] Specifically, the functions of each module in the fault optical cable prediction device provided in this embodiment of the invention correspond one-to-one with the operation flow of each step in the above-mentioned method-like embodiments, and the achieved effects are also the same. For details, please refer to the above embodiments, and this will not be repeated in this embodiment of the invention.
[0165] Figure 4 An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 4As shown, the electronic device may include: a processor 410, a communication interface 420, a memory 430, and a communication bus 440, wherein the processor 410, the communication interface 420, and the memory 430 communicate with each other through the communication bus 440. The processor 410 can call logic instructions in the memory 430 to execute the faulty optical cable prediction method provided in the above embodiments. The method includes: obtaining parameter feature values of the optical cable to be predicted; inputting the parameter feature values of the optical cable to be predicted into an optical cable classification model to obtain a prediction result of whether the optical cable to be predicted is a faulty optical cable output by the optical cable classification model; wherein, the optical cable classification model is trained based on a target sample set; the target sample set is obtained through the following process: adjusting the sample imbalance rate of the initial sample set based on the number of discriminative parameter features between optical cable samples carrying category labels in the initial sample set to obtain a target imbalance rate, and adjusting the first number of optical cable samples carrying target category labels in the initial sample set based on the target imbalance rate; the category label includes a fault label or a non-fault label, the target category label is the fault label, the initial sample set contains parameter feature values corresponding to the optical cable samples, and the discriminative parameter features refer to parameter features used to distinguish optical cable samples carrying different category labels.
[0166] Furthermore, the logical instructions in the aforementioned memory 430 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, essentially, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0167] On the other hand, the present invention also provides a computer program product, which includes a computer program that can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the faulty optical cable prediction method provided in the above embodiments. The method includes: obtaining parameter feature values of the optical cable to be predicted; inputting the parameter feature values of the optical cable to be predicted into an optical cable classification model to obtain a prediction result of whether the optical cable to be predicted is a faulty optical cable output by the optical cable classification model; wherein, the optical cable classification model is trained based on a target sample set; the target sample set is... The following process is used to obtain the target imbalance rate: based on the number of discriminative parameter features among optical cable samples carrying category labels in the initial sample set, the sample imbalance rate of the initial sample set is adjusted to obtain the target imbalance rate. Based on the target imbalance rate, the first number of optical cable samples carrying target category labels in the initial sample set is adjusted. The category labels include fault labels or non-fault labels, the target category label is the fault label, and the initial sample set contains parameter feature values corresponding to the optical cable samples. The discriminative parameter features refer to the parameter features used to distinguish optical cable samples carrying different category labels.
[0168] In another aspect, the present invention also provides a non-transitory computer-readable storage medium storing a computer program thereon. When executed by a processor, the computer program is implemented to perform the faulty optical cable prediction method provided in the above embodiments. The method includes: obtaining parameter feature values of the optical cable to be predicted; inputting the parameter feature values of the optical cable to be predicted into an optical cable classification model to obtain a prediction result of whether the optical cable to be predicted is a faulty optical cable output by the optical cable classification model; wherein, the optical cable classification model is trained based on a target sample set; the target sample set is obtained through the following process: adjusting the sample imbalance rate of the initial sample set based on the number of discriminative parameter features among optical cable samples carrying category labels in the initial sample set to obtain a target imbalance rate, and adjusting the first number of optical cable samples carrying target category labels in the initial sample set based on the target imbalance rate; the category label includes a fault label or a non-fault label, the target category label is the fault label, the initial sample set contains parameter feature values corresponding to the optical cable samples, and the discriminative parameter features refer to parameter features used to distinguish optical cable samples carrying different category labels.
[0169] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0170] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0171] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for predicting faulty optical cables, characterized in that, include: Obtain the parameter feature values of the optical cable to be predicted; The parameter feature values of the optical cable to be predicted are input into the optical cable classification model to obtain the prediction result of whether the optical cable to be predicted is a faulty optical cable. The optical cable classification model is trained based on a target sample set. The target sample set is obtained through the following process: based on the number of discriminative parameter features among optical cable samples carrying category labels in the initial sample set, a penalty term is determined; based on the penalty term, the sample imbalance rate of the initial sample set is adjusted to obtain a target imbalance rate; and based on the target imbalance rate, a first number of optical cable samples carrying target category labels in the initial sample set is adjusted. The optical cable classification model is a support vector machine model, a decision tree model, or a k-nearest neighbor algorithm model. The penalty term is expressed as: , It is a parameter that controls the importance of penalty terms. It is the number of distinguishing features; The category label includes a fault label or a non-fault label, the target category label is the fault label, the initial sample set contains the parameter feature values corresponding to the optical cable samples, and the discriminative parameter feature refers to the parameter feature used to distinguish optical cable samples carrying different category labels. The acquisition of parameter feature values of the optical cable to be predicted includes: Obtain the non-numerical parameter feature information of the optical cable to be predicted; The non-numerical parameter feature information is One-Hot encoded to obtain the parameter feature value corresponding to the non-numerical parameter feature information.
2. The method for predicting faulty optical cables according to claim 1, characterized in that, The method further includes: Based on the parameter feature values corresponding to the optical cable sample, a feature vector corresponding to each parameter feature is constructed, and the label vector of the optical cable sample is determined. The correlation between the feature vector and the label vector is determined using the Pearson test. Based on the correlation, the discriminative parameter features are selected from the parameter features.
3. The method for predicting faulty optical cables according to claim 2, characterized in that, The step of selecting the discriminative parameter feature from the parameter features based on the correlation includes: For any parameter feature, the test statistic of the t-distribution is calculated based on the correlation between the feature vector corresponding to the parameter feature and the label vector. If the test statistic is less than a preset threshold, then any parameter feature is determined to be the discriminative parameter feature.
4. The method for predicting faulty optical cables according to claim 1, characterized in that, The step of adjusting the sample imbalance rate based on the penalty term to obtain the target imbalance rate includes: The target imbalance rate is obtained by calculating the difference between the sample imbalance rate and the penalty term.
5. The method for predicting faulty optical cables according to any one of claims 1-4, characterized in that, The step of adjusting the first number of optical cable samples carrying the target category label in the initial sample set based on the target imbalance rate includes: Based on the target imbalance rate, calculate the equivalent number of optical cable samples carrying the non-faulty tag in the initial sample set; Based on the equivalent quantity, a second quantity of optical cable samples carrying the fault tag is determined after adjustment, and the second quantity of optical cable samples carrying the fault tag is added to the initial sample set.
6. A faulty optical cable prediction device, characterized in that, include: The acquisition module is used to acquire the parameter feature values of the optical cable to be predicted; The prediction module is used to input the parameter feature values of the optical cable to be predicted into the optical cable classification model, and obtain the prediction result of whether the optical cable to be predicted is a faulty optical cable output by the optical cable classification model. The optical cable classification model is trained based on a target sample set. The target sample set is obtained through the following process: based on the number of discriminative parameter features among optical cable samples carrying category labels in the initial sample set, a penalty term is determined; based on the penalty term, the sample imbalance rate of the initial sample set is adjusted to obtain a target imbalance rate; and based on the target imbalance rate, a first number of optical cable samples carrying target category labels in the initial sample set is adjusted. The optical cable classification model is a support vector machine model, a decision tree model, or a k-nearest neighbor algorithm model. The penalty term is expressed as: , It is a parameter that controls the importance of penalty terms. It is the number of distinguishing features; The category label includes a fault label or a non-fault label, the target category label is the fault label, the initial sample set contains the parameter feature values corresponding to the optical cable samples, and the discriminative parameter feature refers to the parameter feature used to distinguish optical cable samples carrying different category labels. The acquisition of parameter feature values of the optical cable to be predicted includes: Obtain the non-numerical parameter feature information of the optical cable to be predicted; The non-numerical parameter features are One-Hot encoded to obtain the parameter feature values corresponding to the non-numerical parameter feature information.
7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the faulty optical cable prediction method as described in any one of claims 1 to 5.
8. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the faulty optical cable prediction method as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Unbalanced sample data preprocessing method and device and computer equipment
CN109325118A
Medical image classification method and system, medium and electronic terminal
CN112784884A