A glass type identification method and storage medium
By using a semi-supervised feature selection method, the optimal feature subset is generated by iteratively calculating the probabilities of dissimilar and homologous neighbors of samples. This solves the problem of low accuracy in glass type identification in existing technologies and achieves higher accuracy and lower cost.
Patent Information
- Application Number
- CN202310527946.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-11
- Publication Date
- 2025-11-07
- Estimated Expiration
- 2043-05-11
AI Technical Summary
Existing fully supervised feature selection algorithms are costly, while semi-supervised feature selection algorithms do not consider changes in sample features in the weighted feature space, resulting in low accuracy in glass type identification.
A semi-supervised feature selection method is adopted. The feature weights are calculated by iteratively calculating the probability of the opposite nearest neighbor and the probability of the same nearest neighbor of the sample, generating the optimal feature subset, and then using the nearest neighbor classifier to identify the glass type.
It improves the accuracy of glass type identification, reduces labor costs, and effectively extracts local information through feature weights, thereby improving the accuracy and efficiency of the classification process.
Smart Images

Figure CN116756537B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of feature selection learning, in particular to a glass type identification method and a storage medium. BACKGROUND
[0002] Glass is a common substance in people's life, composed of some oxides containing chemical elements such as sodium, magnesium and aluminum. Glass type identification is to identify different purposes of glass according to refractive index and chemical composition, which has a wide range of applications. For example, glass type identification can be used for crime scene investigation. Researchers analyze the chemical composition of glass to determine the source and nature of the glass, thereby providing clues for criminal investigation. It can also be used in the field of material science. By analyzing the refractive index and oxide content of glass, the physical properties and structural characteristics of glass are explored, thereby optimizing the manufacturing process and application field of glass and promoting the development of material science.
[0003] The key problem of glass type identification method is to accurately and efficiently analyze the relationship between the characteristics and categories of glass. Feature selection algorithm can be applied for analysis. For example, full-supervised feature selection algorithm is used to analyze the correlation between features and class labels to evaluate the relationship between features and categories. However, in practical applications, the acquisition of labels often requires a large amount of human cost, so the cost is huge. Therefore, using semi-supervised feature selection algorithm is a better choice. For semi-supervised feature selection, a Relief feature selection method based on hypothesis interval and constraint pair has been proposed. This method uses pairwise constraints to calculate the interval of features in the original feature space, thereby evaluating the importance of features, but this method does not consider the change of samples in the weighted feature space. Therefore, there is a problem of local information uncertainty, which leads to low accuracy in the process of glass type identification. SUMMARY
[0004] To this end, the technical problem to be solved by the present application is to overcome the problem of high cost required by the existing full-supervised feature selection algorithm in the prior art, and the problem of local information uncertainty caused by not considering the change of sample features in the weighted feature space in the current semi-supervised feature selection, which leads to low accuracy in the process of glass type identification.
[0005] To solve the above technical problems, the present application provides a glass type identification method, characterized in that it comprises:
[0006] S1: Obtain feature data of multiple different feature categories of known glass types as a data set, label a part of data in the data set according to its known glass type, called labeled data set, and the data not labeled in the data set as unlabeled data set, and generate a set of connected constraint pairs C according to the data in the labeled data set:
[0007] C={(xi , x j ) x i and x j are different kinds of glass} ;
[0008] S2: initialize feature weight w and feature margin vector z of all feature categories, set iteration parameters, calculate feature weight w by iteration method, and the iteration calculation specifically includes:
[0009] S21: calculate for each pair of unconnectable constraint pairs (x i , x j ), including:
[0010] find k samples closest to x i in the unlabeled data set as the neighbor sample set NH(x i ) of x i and k samples closest to x j as the neighbor sample set NH(x j ) of x j ;
[0011] calculate the probability that each sample x j in the set NH(x t ) is the out-class neighbor of x i in the weight space w;
[0012] calculate the probability that each sample x i in the set NH(x t ) is the in-class neighbor of x i in the weight space w;
[0013] update the feature margin vector z of the constraint pair (x i , x j ) by using the out-class neighbor probability and in-class neighbor probability of all samples calculated for the constraint pair (x L , x l );
[0014] S22: calculate the feature weight w after each iteration by using the feature margin vector z of all constraint pairs obtained;
[0015] S23: end the loop after reaching the iteration loop end condition, and output the feature weight w after iteration;
[0016] sort and select the feature category optimal subset according to the weight size of the feature categories in the feature weight w after iteration;
[0017] reduce the data set by using the obtained feature category optimal subset to obtain the reduced sample data set;
[0018] S3: Construct a nearest neighbor classifier. Use the reduced sample dataset as the training set to train the nearest neighbor classifier. Use the trained nearest neighbor classifier to classify the unknown glass feature data and obtain the type of unknown glass.
[0019] Furthermore, the step of labeling a portion of the dataset according to its known glass type, referred to as a labeled dataset, and the unlabeled portion of the dataset as an unlabeled dataset, specifically involves:
[0020] Let the dataset be X, where the data sample of the i-th glass block is denoted as... Label a small portion of the glass dataset and denote it as X. L ={x1, x2, ..., x l} represents a labeled dataset, denoted by Y. L ={y1, y2, ..., y l} represents a set of tags containing tagged data;
[0021] Let X U ={x l+1 x l+2 , ..., x l+u If} is an unlabeled dataset, then X = {X} L X U Let l + u = n, which means that there are a total of n glass samples in the dataset X, of which l are labeled and u are unlabeled.
[0022] Furthermore, the initialization of feature weights w and feature margin vector z for all feature categories, and the setting of iteration parameters, specifically involves: initializing the weight vector set. d represents the number of feature categories and the feature margin vector set. The maximum number of iterations T, kernel width σ, stopping criterion θ, required nearest neighbor value k, and number of features m to be selected are set in this invention.
[0023] Furthermore, the set NH(x) is calculated. j Each sample x in ) t It is x i The calculation of the probability of the opposite nearest neighbor in the weight space w is as follows:
[0024]
[0025] Where w(t-1) represents the weight obtained in the previous iteration, ||x t || w(t-1) =x t1 w1+x t2 w2+…+x td wd .
[0026] Furthermore, the set NH(x) is calculated. i Each sample x in ) t It is x i The specific probability of similar nearest neighbors in the weight space w is:
[0027]
[0028] Where w(t-1) represents the weight obtained in the previous iteration, ||x t || w(t-1) =x t1 w1+x t2 w2+…+x td w d .
[0029] Furthermore, by utilizing the constraint pair (x) i x j The calculated probabilities of the different-class nearest neighbors and the same-class nearest neighbors for all samples are used to update the calculation of this constraint pair (x). i x j The feature margin vector z is specifically:
[0030]
[0031] Furthermore, the specific steps for calculating the feature weight w after each iteration using the feature interval vector z of all obtained constraint pairs are as follows:
[0032]
[0033] Furthermore, the loop termination condition is ||w(t)-w(t-1)||<θ, or the maximum number of iterations T is reached.
[0034] Furthermore, the step of reducing the dataset using the optimal subset of obtained features to obtain the reduced sample dataset specifically involves: filtering the original dataset according to the selected features, and using the filtered feature data subset as the reduced sample dataset, denoted as X′={x′1,x′2,...,x′ n},in
[0035] A storage medium, characterized in that: a computer program is stored on the storage medium, and when the computer program is executed by a processor, it implements the steps of the glass type identification method described above.
[0036] The technical solution of the present invention has the following advantages compared with the prior art:
[0037] The glass type recognition method provided by the application uses a semi-supervised feature selection method in the process of feature selection of the glass, saves the labor cost required for labeling the data, and obtains the selected features and the weight of the selected features by calculating the weight of the features in the process of feature selection through iterative calculation of the heterogeneous neighbor probability and the homogeneous neighbor probability of the sample, which is more effective in extracting local information through the weight of the features in the process of classification, so that the application has higher accuracy and lower cost in the process of glass classification. BRIEF DESCRIPTION OF DRAWINGS
[0038] In order to make the content of the application more easily understood, the application will be further described in detail below according to specific embodiments of the application and in combination with the drawings, in which:
[0039] Figure 1 is a general flowchart of a glass type recognition method provided by an embodiment of the application;
[0040] Figure 2 is an iterative flowchart of feature calculation in the embodiment of the application;
[0041] Figure 3 is a relationship between the method of the second embodiment of the application and the number of Relief-SC feature subsets and the correct rate of glass data classification. DETAILED DESCRIPTION
[0042] The application will be further described below in combination with the drawings and specific embodiments, so that those skilled in the art can better understand the application and implement it, but the embodiments are not limiting to the application.
[0043] Referring to Figure 1 , the flow of the first embodiment of the application is shown in the figure:
[0044] The application provides a glass type recognition method. The method uses a constraint pair to calculate the weight of the features of a sample in a weighted feature space. The application considers the processing of abnormal data and simultaneously uses a constraint pair to generate an optimal feature subset.
[0045] The method mainly includes three steps. First, the data set is preprocessed to normalize the original data and generate a constraint pair. Then, the feature weight is calculated to select an optimal feature subset. Finally, the selected feature subset is used to train a classifier to classify the glass categories. The specific steps include:
[0046] S1: Preprocess the data set: collect d features of the existing glass and form a data set in a numerical form, denoted as X, wherein the i-th glass data sample is denoted as Label a small portion of the glass dataset and denote it as X. L ={x1, x2, ..., x l} represents a labeled dataset, denoted by Y. L ={y1, y2, ..., y l} represents a set of labels containing labeled data. Let X U ={x l+1 x l+2 , ..., x l+u If} is an unlabeled dataset, then X = {X} L X U Let l + u = n, representing that there are a total of n glass samples in dataset X, of which l are labeled and u are unlabeled.
[0047] use Represents the feature matrix of the glass dataset, where It is the j-th eigenvector and is normalized to the interval [0, 1].
[0048] Based on the labeled glass data set X L Generate a set C of pairs of non-connectable constraint pairs, i.e.
[0049] C={(x i x j )|x i and x j They are different types of glass.
[0050] S2: Calculate the feature weights:
[0051] Initialize weight vector and feature margin vector The maximum number of iterations T, kernel width σ, stopping criterion θ, required nearest neighbor value k, and number of features m to be selected are set in this invention. The steps of the feature selection module are as follows:
[0052] In iterative calculations, such as Figure 2 As shown:
[0053] S21: For each pair of non-connectable constraint pairs (x i x j Perform the following operations:
[0054] Find k pairs of data that are related to x in an unlabeled dataset. i The nearest sample is x i The nearest neighbor sample set NH(x) i ) and k pairs with x j The nearest sample is x j The nearest neighbor sample set NH(x)j );
[0055] The dissimilar neighbor probability of sample x j in the set NH(x t is x i The dissimilar neighbor probability of sample x i in the set NH(x t is x i The similar neighbor probability of sample x t in the set NH(x w(t-1) is x t1 w1+x t2 w2+…+x td w d ;
[0056]
[0057] The dissimilar neighbor probability of sample x i in the set NH(x t is x i The similar neighbor probability of sample x t in the set NH(x w(t-1) is x t1 w1+x t2 w2+…+x td w d ;
[0058]
[0059] wherein w(t-1) represents the weight obtained in the last iteration, ||x t || w(t-1) =x t1 w1+x t2 w2+…+x td w d ;
[0060] Update the feature interval vector:
[0061]
[0062] S22 calculate to get the tth feature weight w(t);
[0063] S23: if ||w(t)-w(t-1)||<θ or the maximum number of cycles is reached, end the cycle and return w to get the weight w after iteration.
[0064] Sort the feature weight values in w and select the top m feature categories with the highest feature weights;
[0065] In the feature selection process, the dissimilar neighbor probability and the similar neighbor probability of the sample are calculated by iteratively calculating the weight of the feature, and the selected feature and the weight of the selected feature are obtained. In the process of classification, the local information is more effectively extracted through the weight of the feature.
[0066] Perform feature selection on the original data set X to form a reduced sample data set, denoted as wherein
[0067] S3: Collect unknown glass data to form a glass data sample According to the weight vector w of the selected features selected according to the above features, the sample data x is subjected to feature selection, so as to generate a reduced sample data Finally, the nearest neighbor classifier is used to classify the unknown glass data by taking X' as the training data.
[0068] Embodiment two: the application is tested on the UCl data set Glass, which is a data set for glass classification. The application extracts and analyzes the features of the glass data, and then classifies the glass. The data set contains a total of 214 data samples, each of which represents a type of glass. Each type of glass has 9 attributes, namely: refractive index value, sodium, magnesium, aluminum, silicon, potassium, calcium, barium and iron content. There are 7 categories of glass, namely: non-float manufactured building glass, float manufactured building glass, non-float manufactured vehicle glass, container glass, tableware glass and headlight glass. The specific implementation steps are as follows:
[0069] Preprocessing of the data set: collect the d features of the existing glass and form a data set by numerical value, denoted as X, where the i-th glass data sample is denoted as Label a small part of the glass data set, denoted as X L ={x1, x2,..., x l} as the labeled data set, and Y L ={y1, y2,..., y l} represents the label set of the labeled data. Let X U ={x l+1 , x l+2 ,..., x l+u} be the unlabeled data set, then X={X L , X U}. Let l+u=n, indicating that there are n glass samples in the data set X, of which there are l labeled data and u unlabeled data.
[0070] Let represent the feature matrix of the glass data set, where is the j-th feature vector and is normalized to the interval [0, 1].
[0071] According to the labeled glass data set X L , generate the set of cannot-connect constraints C, that is
[0072] C={(x i , x j )|x i and x j are different types of glass}
[0073] In the embodiment, the total number of samples n = 214, the number of features d = 9 are set. And 40 pairs of unconnectable constraint pairs are randomly generated, the sample set appearing in the constraint pair as the labeled sample set X L , the rest of the sample set as the unlabeled sample set X U .
[0074] Initialize the weight vector and the feature interval vector The maximum number of iterations T = 40, the kernel width σ = 0.1, and the stopping criterion θ = 0.00001 of the application are set, the required neighbor value k = 5 and the selected number of features m = 8. The steps of the feature selection module are as follows:
[0075] For t = 1:40:
[0076] For each pair of unconnectable constraint pairs (x i , x j ), the following operations are performed:
[0077] In the unlabeled data set X U , find 5 samples closest to x i and 5 samples closest to x j . Using the 5 samples with neighbor relationship with x i get the neighbor sample set NH(x i ) of x i , and similarly get the neighbor sample set NH(x j ) of x j . NH(x j ) is regarded as the dissimilar neighbor sample set of x i .
[0078] Calculate the dissimilar neighbor probability of sample x j in set NH(x t ) is x i in weight space w:
[0079]
[0080] Calculate the similar neighbor probability of sample x i in set NH(x t ) is x i in weight space w:
[0081]
[0082] where w(t-1) represents the weight obtained by the last iteration, ||x t || w(t-1) = x t1 w1+xt2 w2+…+x td w d
[0083] Update the feature margin vector:
[0084]
[0085] calculate z + = [max(z1, 0), ..., max(z)] d ,0)], to obtain the feature weight w(t) for the tth time;
[0086] If ||w(t)-w(t-1)|| < 0.00001 or the maximum number of iterations (40) is reached, the loop ends, w is returned, and the weight w after iteration is obtained;
[0087] Sort the feature weight values in w and select the top 8 features with the highest feature weights.
[0088] Feature selection is performed on the original dataset X to form a reduced sample dataset, denoted as X′={x′1,x′2,...,x′ n},in
[0089] This invention is tested on the Glass dataset. Based on the target feature subset obtained from the aforementioned feature selection template, feature selection is performed on sample data x to generate a reduced sample dataset. The nearest neighbor classifier is used to classify the glass data using X′ as the training data.
[0090] In this embodiment, the number of new users is set to 21, and the glass data category analysis module is repeated 100 times to obtain the glass data category analysis results. A 10-fold cross-validation method is used, and the average of the ten rounds of experiments is taken as the experimental result. Figure 3 As shown. Summary Figure 3 Table 1 shows the highest accuracy and standard deviation of the present invention compared to the feature selection method based on hypothesis interval and constraint pairs (Relief-SC). Compared to Relief-SC, the present invention considers the changes of samples in the weighted feature space, thus achieving higher classification accuracy.
[0091] Table 1 Comparison of identification results between the method of this invention and the Relief-SC method.
[0092]
[0093] The selected features and the weights of the selected features are obtained by iteratively calculating the dissimilar neighbor probability and the similar neighbor probability of the sample in the feature selection process, the local information is more clearly extracted by the weight of the feature in the classification process, the accuracy of the glass classification process is higher, and the cost is lower.
[0094] The present application is described with reference to flowcharts and / or block diagrams of the method and the computer program product according to embodiments of the present application. It is understood that each flow and / or block in the flowcharts can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general purpose computer, a special purpose computer, an embedded processor, or other programmable data processing apparatus to produce a machine, so that the instructions, which are executed via the processor of the computer or other programmable data processing apparatus, generate a means for implementing the functions specified in the flowcharts and / or block diagrams. Figure 1 The functions specified in the flowcharts and / or block diagrams can be implemented by one flow or multiple flows.
[0095] These computer program instructions can also be stored in a computer readable memory capable of directing the computer or other programmable data processing apparatus to work in a specific way, so that the instructions stored in the computer readable memory produce a product including instruction means, which implements the functions specified in the flowcharts and / or block diagrams. Figure 1 The functions specified in the flowcharts and / or block diagrams can be implemented by one flow or multiple flows.
[0096] These computer program instructions can also be loaded into a computer or other programmable data processing apparatus, so that a series of operation steps are executed on the computer or other programmable data processing apparatus to produce a computer implemented process, so that the instructions executed on the computer or other programmable data processing apparatus provide steps for implementing the functions specified in the flowcharts and / or block diagrams. Figure 1 The functions specified in the flowcharts and / or block diagrams can be implemented by one flow or multiple flows.
Claims
1. A glass type identification method characterized by: The method comprises the following steps: S1: obtaining feature data of a plurality of different feature categories of a known glass type, taking the feature data as a data set, labeling part of the data in the data set according to the known glass type of the part of the data, taking the labeled data set as a labeled data set, taking the data in the data set that is not labeled as an unlabeled data set, generating a constraint pair set C that cannot be connected according to the data in the labeled data set: C = {(x i ,x j )|x i and x j are different kinds of glass}; S2: initializing feature weights w and a feature interval vector z of all feature categories, setting an iteration parameter, calculating the feature weights w by using an iteration method, and the iteration calculation specifically comprises the following steps: S21: Calculate for each pair of non-connecting constraints pair (x i ,x j ) comprising: Find k nearest samples to x i as the nearest neighbor sample set NH(x i ) and k samples closest to x i as the nearest neighbor sample set NH(x j ); calculate the dissimilar neighbor probability of each sample x j in the set NH(x j ) under the weight space w j is x t i Compute the probability of each sample x i in the set NH(x t ) being a near neighbor of x i in the weight space w where w(t-1) represents the weight obtained by the last iteration, ||x t ‖ w(t-1) = x t1 w1+ x t2 w2+…+x td w d ; σ is the kernel width; d is the number of feature categories; The feature margin vector z for the constraint pair (x i ,x j ) is updated using the hetero-neighborhood probability and the homo-neighborhood probability of all samples computed for the constraint pair (x i ,x j ): S22: Calculate the feature weight w after each iteration using the obtained feature gap vector z of all constraint pairs: z + = [max(z d , 0)] ; S23: ending the loop after reaching an iteration loop end condition, and outputting the feature weights w after the iteration; sorting and selecting a feature category optimal subset according to the weight size of the different category features in the feature weights w after the iteration; reducing the data set by using the feature category optimal subset obtained to obtain a reduced sample data set; S3: constructing a nearest neighbor classifier, taking the reduced sample data set as a training set to train the nearest neighbor classifier, and classifying unknown glass feature data by using the trained nearest neighbor classifier to obtain the type of the unknown glass.
2. The method of claim 1, wherein: The part of the data in the data set is labeled according to the known glass type of the part of the data, and the labeled data set is taken as a labeled data set, and the data in the data set that is not labeled is taken as an unlabeled data set, and the specific process is as follows: The dataset is represented as X, where the ith block of glass data samples is represented as A small portion of the glass dataset is labeled, denoted as X L = {x1, x2,..., x l} is the set of labeled data, and Y L = {y1, y2,..., y l} is the set of labels for the labeled data. Let X U ={x l+1 ,x l+2 ,…,x l+u} be the unlabeled data set, then X = {X L ,X U}, let l + u = n, indicating that there are n blocks of glass samples in the data set X, of which there are l labeled data and u unlabeled data.
3. The method of claim 1, wherein: The feature weight w and the feature interval vector z of all feature categories are initialized, and the iteration parameters are set, specifically: initializing the weight vector set d is the number of feature categories, and the feature interval vector set The maximum iteration number T of the application, the kernel width σ, the stop criterion θ, the required neighbor value k and the selected feature number m are set.
4. The method of claim 1, wherein: The loop end condition is ‖w(t)-w(t-1)‖<θ, or the maximum iteration number T is reached.
5. The method of claim 1, wherein: The reduced sample data set obtained by using the obtained feature optimal subset is specifically: screening the original data set according to the selected features, taking the screened feature data subset as the reduced sample data set, denoted as X' = {x ′ 1,x ′ 2,…,x ′ n}, wherein 6. A storage medium characterized by: The storage medium stores a computer program, and the computer program is executed by the processor to realize the steps of the glass type identification method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Radar echo signal classification method, device and equipment
CN115795290A