Router classification method, device, equipment and computer-readable storage medium

By weighting the organizational unique identifier of the router MAC address and using the random forest model classifier, the accuracy and coverage issues of router category identification are solved, and efficient router classification is achieved.

CN119922126BActive Publication Date: 2025-09-30FIBERHOME TELECOMMUNICATION TECHNOLOGIES CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510004085.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-01-02
Publication Date
2025-09-30
Estimated Expiration
2045-01-02

AI Technical Summary

Technical Problem

When identifying router categories in existing technologies, users modify the default name on their own, resulting in identification failures. The expert knowledge base has limited coverage, and not all routers have the ability to send MQTT messages, resulting in a low classification success rate.

Method used

The product identifier is weighted based on the organizational unique identifier in the router's MAC address and classified using the trained random forest model. The weighted product identifier is input into the classifier to determine the router category.

Benefits of technology

It improves the accuracy and coverage of router classification, reduces noise interference, and ensures effective information transfer and identification accuracy on routers from different manufacturers.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119922126B_ABST
    Figure CN119922126B_ABST
Patent Text Reader

Abstract

A router classification method, apparatus, device, and computer-readable storage medium. The method includes: weighting the product identifier in the MAC address of the router to be identified based on the organization-unique identifier in the MAC address of the router to be identified; inputting the weighted product identifier into a classifier, and determining the category of the router to be identified based on the output of the classifier. Through the embodiment of the present application, based on the formulation specification of the MAC address and taking the MAC address of the router to be identified as the basis, a high-coverage router classification is achieved in combination with a classifier; and by weighting the product identifier with the organization-unique identifier, the noise caused by directly using the organization-unique identifier for router classification can be reduced, and the effective information represented by the organization-unique identifier can be transferred to the product identifier, thereby improving the accuracy of router classification.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of artificial intelligence technology, and in particular to a router classification method, apparatus, device, and computer-readable storage medium. Background Art

[0002] Identifying router types is the basis for locating network quality issues and a key technology for operators to ensure user experience. Currently, there are two main methods for identifying router types:

[0003] Solution 1: Predetermine the correspondence between the default router names and router categories to form an expert knowledge base. Subsequently, the router categories can be determined based on the obtained router names.

[0004] Option 2:

[0005] Communicate with the router based on the MQTT protocol, obtain the MQTT message sent by the router, parse the MQTT message, and determine the router type.

[0006] Regarding Solution 1, during actual use of routers, users often modify the default names of routers on their own, which can lead to identification failures. In addition, due to the large number of default names of routers on the market, the coverage of the expert knowledge base is limited. These two reasons lead to a low success rate for router classification based on Solution 1.

[0007] Regarding Solution 2, the router needs to have a specific plug-in to send MQTT messages, but not all routers have this specific plug-in. Therefore, the success rate of router classification based on Solution 2 cannot be guaranteed. Summary of the Invention

[0008] To solve the above technical problems, the present application provides a router classification method, apparatus, device and computer-readable storage medium.

[0009] In a first aspect, an embodiment of the present application provides a method for classifying routers, the method comprising:

[0010] weighting the product identifier in the MAC address of the router to be identified based on the organization unique identifier in the MAC address of the router to be identified;

[0011] The weighted product identifier is input into a classifier, and the category of the router to be identified is determined based on the output of the classifier.

[0012] In conjunction with the first aspect, in one embodiment, the organization-unique identifier includes Q organization-unique identification bytes, the product identifier includes Q product identification bytes, and weighting the product identifier in the MAC address of the router to be identified based on the organization-unique identifier in the MAC address of the router to be identified includes:

[0013] Input Q unique organization identification bytes into the trained fully connected network to obtain an m-dimensional vector corresponding to each product identification byte;

[0014] For each product identification byte of the Q product identification bytes, multiply it by the corresponding m-dimensional vector to obtain a weighted product identification byte.

[0015] In conjunction with the first aspect, in one embodiment, the classifier is a trained random forest model, the trained random forest model includes several first-class decision trees, and inputting the weighted product identifier into the classifier and determining the category of the to-be-identified router based on the output of the classifier includes:

[0016] Inputting Q weighted product identification bytes into each first-category decision tree, and obtaining the first-category voting results output by each first-category decision tree;

[0017] determining a target first-category voting result having the largest number of repetitions from a plurality of first-category voting results;

[0018] The category of the router to be identified is determined based on the target first category voting result.

[0019] In conjunction with the first aspect, in one embodiment, after determining the target first category voting result having the largest number of repetitions from the plurality of first category voting results, the method further includes:

[0020] Determining a first confidence level based on the number of repetitions of the target first category voting result and the total number of first category decision trees;

[0021] detecting whether the first confidence level is greater than or equal to a first threshold;

[0022] If the first confidence level is greater than or equal to a first threshold, the category of the router to be identified is determined based on the target first category voting result.

[0023] In combination with the first aspect, in one embodiment, the trained random forest model further includes several second-type decision trees corresponding to each weighted product identification byte combination, wherein each weighted product identification byte combination includes (QP) weighted product identification bytes, P is the number of noise bytes in the Q product identification bytes that are not used to represent the product category, P<Q, and after detecting whether the first confidence is greater than or equal to the first threshold, further including:

[0024] If the first confidence level is less than the first threshold, selecting a weighted product identification byte combination according to a preset order and inputting it into each corresponding second-category decision tree, and obtaining the second-category voting result output by each second-category decision tree;

[0025] determining a target second category voting result having the largest number of repetitions from a plurality of second category voting results;

[0026] Determining a second confidence level based on the number of repetitions of the target second category voting result and the total number of second category decision trees corresponding to the currently selected weighted product identification byte combination;

[0027] detecting whether the second confidence level is greater than or equal to a second threshold;

[0028] If the second confidence level is greater than or equal to a second threshold, determining the category of the router to be identified based on the target second category voting result;

[0029] If the second confidence level is less than the second threshold, detecting whether all product identification byte combinations have been selected;

[0030] If not, return to executing the step of selecting a weighted product identification byte combination according to a preset order and inputting the weighted product identification byte combination into each corresponding second-category decision tree, and obtaining the second-category voting result output by each second-category decision tree;

[0031] If so, it is determined that the category of the router to be identified is an unknown category.

[0032] In conjunction with the first aspect, in one embodiment, the classifier is a trained random forest model, the trained random forest model including several first-type decision trees and several second-type decision trees corresponding to each weighted product identification byte combination, wherein each weighted product identification byte combination includes (QP) weighted product identification bytes, where P is the number of noise bytes in the Q product identification bytes that are not used to represent the product category, and P<Q. Inputting the weighted product identifier into the classifier and determining the category of the to-be-identified router based on the output of the classifier includes:

[0033] Inputting Q weighted product identification bytes into each first-category decision tree, obtaining first-category voting results output by each first-category decision tree, determining a target first-category voting result having the largest number of repetitions from the plurality of first-category voting results, and determining a first confidence level based on the number of repetitions of the target first-category voting result and the total number of first-category decision trees;

[0034] For each weighted product identification byte combination, input the weighted product identification byte combination into each corresponding second-category decision tree, obtain a second-category voting result output by each second-category decision tree, determine a target second-category voting result having the greatest number of repetitions from the plurality of second-category voting results, and determine a second confidence level corresponding to each weighted product identification byte combination based on the number of repetitions of the target second-category voting result and the total number of second-category decision trees corresponding to the weighted product identification byte combination;

[0035] Selecting a maximum value from the first confidence level and all second confidence levels;

[0036] The category of the router to be identified is determined based on the category voting result corresponding to the maximum value.

[0037] In combination with the first aspect, in one implementation, the number of second-type decision trees corresponding to different weighted product identification byte combinations is the same.

[0038] In a second aspect, an embodiment of the present application provides a router classification device, the router classification device comprising:

[0039] a weighting module, configured to weight the product identifier in the MAC address of the router to be identified based on the organization unique identifier in the MAC address of the router to be identified;

[0040] The classification module is configured to input the weighted product identifier into a classifier, and determine the category of the router to be identified based on an output of the classifier.

[0041] In a third aspect, an embodiment of the present application provides a router classification device, comprising a processor, a memory, and a router classification program stored on the memory and executable by the processor, wherein when the router classification program is executed by the processor, the steps of the router classification method described in the first aspect are implemented.

[0042] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, on which a router classification program is stored. When the router classification program is executed by a processor, the steps of the router classification method described in the first aspect are implemented.

[0043] The beneficial effects of the technical solutions provided in the embodiments of the present application include:

[0044] In an embodiment of the present application, the product identifier in the MAC address of the router to be identified is weighted based on the organization-unique identifier in the MAC address of the router to be identified; the weighted product identifier is input into a classifier, and the category of the router to be identified is determined based on the output of the classifier. Through this embodiment of the present application, based on the formulation specification of MAC addresses, the MAC addresses of the routers to be identified are used as the basis, and the classifier is combined to achieve high-coverage router classification; and by weighting the product identifier with the organization-unique identifier, it can not only reduce the noise caused by directly using the organization-unique identifier for router classification, but also transfer the effective information represented by the organization-unique identifier to the product identifier, thereby improving the accuracy of router classification. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] Figure 1 This is a flow chart of an embodiment of the router classification method of the present application;

[0046] Figure 2 Schematic diagram of a detailed process of step S20 in one embodiment;

[0047] Figure 3 A schematic diagram of a model optimization and deployment process in one embodiment;

[0048] Figure 4 Schematic diagram of an execution scenario of step S20 in another embodiment;

[0049] Figure 5 This is a functional module diagram of an embodiment of a router classification device of the present application;

[0050] Figure 6 This is a schematic diagram of the hardware structure of the router classification device involved in the embodiment of the present application. DETAILED DESCRIPTION

[0051] In order to enable those skilled in the art to better understand the present invention, the following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0052] First, some technical terms in this application are explained to facilitate those skilled in the art to understand this application.

[0053] A MAC address (Media Access Control Address) is a hardware address, also known as a physical address, that uniquely identifies devices on a network. A MAC address is a 48-bit binary number, typically expressed in hexadecimal notation, consisting of six bytes, such as 00:11:22:33:44:55. The first three bytes are the organizationally unique identifier, used to identify the manufacturer; the last three bytes (the product identifier) ​​are assigned by the manufacturer and are used to distinguish between different products or devices from the same manufacturer.

[0054] In order to make the objectives, technical solutions and advantages of this application clearer, the implementation methods of this application will be further described in detail below with reference to the accompanying drawings.

[0055] In a first aspect, an embodiment of the present application provides a method for classifying routers.

[0056] In one embodiment, referring to Figure 1 , Figure 1 This is a flow chart of an embodiment of the router classification method of this application. Figure 1 As shown, the router classification methods include:

[0057] Step S10, weighting the product identifier in the MAC address of the router to be identified based on the organization unique identifier in the MAC address of the router to be identified;

[0058] In this embodiment, based on the current MAC address naming convention, the MAC address consists of an organization-unique identifier and a product identifier, where the organization-unique identifier is the first 3 bytes in the MAC address. For ease of explanation, the first 3 bytes are represented by MAC1, MAC2, and MAC3 respectively; the product identifier is the last 3 bytes in the MAC address. For ease of explanation, the last 3 bytes are represented by MAC4, MAC5, and MAC6 respectively.

[0059] It should be noted that with the development of network technology, the number of bytes corresponding to the organization unique identifier and product identifier or the position in the MAC address may change. Therefore, the above is only an illustrative description and does not constitute a limitation on the solution of this embodiment.

[0060] MAC4, MAC5, and MAC6 are weighted by MAC1, MAC2, and MAC3. MAC1, MAC2, and MAC3 may be mapped through a mapping network to obtain weighted coefficients corresponding to MAC4, MAC5, and MAC6. MAC4, MAC5, and MAC6 are respectively multiplied by the corresponding weighted coefficients to obtain weighted MAC4, MAC5, and MAC6, which are denoted as MAC4', MAC5', and MAC6'.

[0061] Step S20: input the weighted product identifier into a classifier, and determine the category of the router to be identified based on the output of the classifier.

[0062] In this embodiment, as described above, after obtaining MAC4', MAC5' and MAC6', all weighted product identifiers can be input into the classifier, that is, MAC4', MAC5' and MAC6' are input into the classifier, or part of the weighted product identifiers can be input into the classifier, for example, MAC4' and MAC5' are input into the classifier, MAC4' and MAC6' are input into the classifier, and MAC5' and MAC6' are input into the classifier.

[0063] The classifier is obtained through training. A set of samples for training the classifier is constructed based on the MAC address of a router of a known category. For example, it is known that the category of router A is any one of a single-band router (indicated by label 00), a dual-band router (indicated by label 01), and a triple-band router (indicated by label 11). The result obtained by weighting the product identifier in the MAC address based on the organization unique identifier in the MAC address of router A is MAC4_ 样本 '、MAC5_ 样本 ' and MAC6_ 样本 '.

[0064] If the input format of the classifier is all weighted product identifiers, the constructed set of samples is:

[0065] Input = MAC4_ 样本 '、MAC5_ 样本 ' and MAC6_ 样本 '; Label = any one of 00, 01, 11.

[0066] If the input format of the classifier is weighted MAC4 and MAC5, the constructed set of samples is:

[0067] Input = MAC4_ 样本 ' and MAC5_ 样本 '; Label = any one of 00, 01, 11.

[0068] If the input format of the classifier is weighted MAC4 and MAC6, the constructed set of samples is:

[0069] Input = MAC4_ 样本 ' and MAC6_ 样本 '; Label = any one of 00, 01, 11.

[0070] If the input format of the classifier is weighted MAC5 and MAC6, the constructed set of samples is:

[0071] Input = MAC5_ 样本 ' and MAC6_ 样本 '; Label = any one of 00, 01, 11.

[0072] By analogy, a classifier can be obtained by training based on the MAC addresses of all known types of routers and the input formats of the routers. The training process of the classifier is described in the prior art and will not be described in detail here.

[0073] In conjunction with the above description, based on the classifier input format requirements, inputting all and / or some of the weighted product identifiers into the classifier will yield the classifier's output, and the category of the router to be identified will be determined based on the classifier's output. For example, if the classifier is a three-category classifier, its output can only be any one of 00, 01, and 11. After inputting all and / or some of the weighted product identifiers into the classifier, if its output is 00, the category of the router to be identified can be determined as a single-band router. Similarly, if its output is 01, the category of the router to be identified can be determined as a dual-band router. Similarly, if its output is 11, the category of the router to be identified can be determined as a triple-band router.

[0074] Referring to the above explanation about MAC addresses, it can be understood that the first 3 bytes of the MAC address identify the manufacturer information. If it is directly applied to the classification task, it will bring a lot of noise; the last 3 bytes of the MAC address are closely related to the router category, but because the last 3 bytes are allocated by the manufacturer, it may cause the last 3 bytes of the MAC addresses of routers of different categories to be the same. Therefore, using only the last 3 bytes for the classification task may be inaccurate. Based on the above considerations, in the embodiment of the present application, the product identifier is weighted by the organization unique identifier, which can not only reduce the noise caused by directly using the organization unique identifier for router classification, but also transfer the effective information represented by the organization unique identifier to the product identifier, thereby improving the accuracy of router classification; in addition, router classification is realized by the classifier, and only a part of the samples are needed to train the classifier in the early stage, so that the trained classifier learns the MAC address features corresponding to each router category, thereby improving the router classification coverage.

[0075] Furthermore, in one embodiment, the organization-unique identifier includes Q organization-unique identification bytes, the product identifier includes Q product identification bytes, and weighting the product identifier in the MAC address of the router to be identified based on the organization-unique identifier in the MAC address of the router to be identified includes:

[0076] Input Q organization unique identification bytes into the trained fully connected network to obtain the m-dimensional vector corresponding to each product identification byte; for each product identification byte in the Q product identification bytes, multiply it with the corresponding m-dimensional vector to obtain the weighted product identification byte.

[0077] In this embodiment, for ease of description, referring to the current MAC address naming convention, the value of Q is 3.

[0078] The fully connected network has multiple fully connected layers, each fully connected layer has multiple channels, and m is the dimension of the output vector of the fully connected network.

[0079] The fully connected network is trained alongside the aforementioned classifier. During training, the classifier parameters and the fully connected network parameters are adjusted based on the classifier's accuracy on the samples until the training termination criteria are met. Since the goal of training is to improve classification accuracy, MAC1, MAC2, and MAC3 are fed into the trained fully connected network to obtain the m-dimensional vector corresponding to MAC4 (denoted as weight 1), the m-dimensional vector corresponding to MAC5 (denoted as weight 2), and the m-dimensional vector corresponding to MAC6 (denoted as weight 3).

[0080] Multiply MAC4 by weight 1 to get MAC4'; multiply MAC5 by weight 2 to get MAC5'; multiply MAC6 by weight 3 to get MAC6'.

[0081] Furthermore, in one embodiment, the classifier is a trained random forest model, and the trained random forest model includes a plurality of first-class decision trees. Figure 2 , Figure 2 FIG. 1 is a detailed flow chart of step S20 in one embodiment. Figure 2 As shown, step S20 includes:

[0082] Step S201: input Q weighted product identification bytes into each first-category decision tree, and obtain the first-category voting results output by each first-category decision tree;

[0083] In this embodiment, for the sake of convenience, it is assumed that a number of first-type decision trees include decision trees A1 to A2. s0 , s0 is the number of the first type of decision trees, decision tree A1 ~ decision tree A s0 The input format is Q weighted product identification bytes. Each decision tree is used to output a first category voting result based on the input, and the first category voting result is any one of a single-band router, a dual-band router, and a triple-band router.

[0084] Step S202, determining a target first category voting result having the largest number of repetitions from a plurality of first category voting results;

[0085] Step S203: Determine the category of the router to be identified based on the target first category voting result.

[0086] In this embodiment, assuming that s0 is 100, there are a total of 100 first-category voting results. Assuming that 88 first-category voting results are dual-band routers, 10 first-category voting results are tri-band routers, and 2 first-category voting results are single-frequency routers, then the target first-category voting result with the largest number of repetitions is determined to be a dual-band router, and the category of the router to be identified can be determined to be a dual-band router.

[0087] The random forest model is trained through training. The training process is the process of determining the parameters of each decision tree included in the random forest model. Taking the determination of the parameters in a decision tree as an example:

[0088] The specific calculation method of decision tree parameters is based on dividing multiple groups of samples into different subtrees according to their input. When all samples in the subtree belong to the same category, the division is stopped and the parameters of the decision tree at this time are solidified. Referring to the above description, when training and determining any decision tree in the first category, the sample input is MAC4_ 样本 '、MAC5_ 样本 ' and MAC6_ 样本 Among them, commonly used feature partitioning algorithms include ID3, C4.5 and CART, which use information gain, information gain ratio and Gini index as feature selection criteria respectively.

[0089] Information entropy is the most commonly used indicator to measure the geometric purity of a sample. Assume that the proportion of the k-th class of samples in the sample set D is:

[0090] p k (k=1,2,……,n)

[0091] Then the information entropy of the sample set D is defined as:

[0092]

[0093] Assume that a discrete attribute has v possible values ​​{a 1 , a 2 ,......,a v}, if a is used to divide the sample set D, V subsets will be generated, where the vth subset contains all the samples in D whose attribute a has a value of a v The sample is recorded as D v , and calculate D v Considering that different subsets contain different numbers of samples, weights are assigned to the subsets. That is, the more samples a subset has, the greater its influence. Therefore, the information gain obtained by dividing the sample set D by attribute a is calculated as:

[0094]

[0095] The information gain ratio is:

[0096]

[0097] The Gini index is:

[0098]

[0099] Combined with the above description, we can determine decision tree A1 to decision tree A s0 Parameters.

[0100] Reference Figure 3 , Figure 3 Figure 1 is a schematic diagram of the model optimization and deployment process in one embodiment. Figure 3 As shown in the figure, the model is trained using the existing data and then deployed on the target hardware. Specifically, for ease of explanation, the current MAC address naming convention is used as an example:

[0101] First, the upper three MAC addresses are fed into a mapping weighting algorithm to obtain the weighted lower three MAC addresses (see the embodiment of step S10 for details). The lower three MAC addresses are then fed into the improved random forest algorithm. If the output router classification result meets the target accuracy, the model and its parameters are saved. Specifically, n MAC addresses from the training set are fed into the model; n router model predictions are obtained. These n predictions are compared with n actual router models. If m correct predictions are obtained, then m / n represents the model accuracy. This accuracy is then compared with the target accuracy. If it exceeds the target accuracy, the target accuracy is considered achieved. Otherwise, parameters such as the number of decision trees in the improved random forest algorithm are adjusted, and the model parameters of the mapping network (such as the fully connected network described above) are optimized using a backpropagation algorithm.

[0102] Among them, the parameter adjustment of the decision tree includes: using the weighted MAC vector output by the mapping network to input into the improved random forest algorithm to construct a new decision tree; hyperparameters such as the number and depth of decision trees need to be manually adjusted and tried in sequence based on actual conditions and engineering experience; optimizing the model parameters of the mapping network includes: the loss value can be calculated between the results output by the random forest and the actual results, and the mapping network can be backpropagated based on this loss value to optimize its parameters.

[0103] After training is completed, a model with the same structure is created on the target hardware. After importing the fixed weights, the category of the router to be identified can be determined based on the MAC address of the router to be identified.

[0104] Furthermore, in one embodiment, after step S201, the method further includes:

[0105] Determining a first confidence level based on the number of repetitions of the target first category voting results and the total number of first category decision trees; detecting whether the first confidence level is greater than or equal to a first threshold; and determining the category of the router to be identified based on the target first category voting results if the first confidence level is greater than or equal to the first threshold.

[0106] In this embodiment, combined with the above example, the first confidence level = the number of repetitions of the target first category voting result / the total number of first category decision trees = 88 / 100 = 0.88.

[0107] Assuming that the first threshold is set to 0.8, it can be determined that the category of the router to be identified is a dual-band router. The first threshold is set based on actual needs and is only illustrated here.

[0108] Through confidence judgment, the reliability of router category identification results is further guaranteed.

[0109] Furthermore, in one embodiment, the trained random forest model also includes several second-type decision trees corresponding to each weighted product identification byte combination, wherein each weighted product identification byte combination includes (QP) weighted product identification bytes, P is the number of noise bytes in the Q product identification bytes that are not used to represent the product category, and P<Q.

[0110] In this embodiment, taking Q=3 as an example, considering that only two bytes of MAC4, MAC5, and MAC6 may be used to identify the product category, that is, there is a noise byte that is not used to identify the product category, it is necessary to use some weighted product identification bytes to identify the router category. The weighted product identification byte combinations are as follows:

[0111] Combination 1, consisting of MAC4' and MAC5';

[0112] Combination 2, consisting of MAC4' and MAC6';

[0113] Combination 3, consisting of MAC5' and MAC6'.

[0114] Among them, several second-class decision trees corresponding to combination 1 are recorded as decision trees B1~B s1 , the second type of decision trees corresponding to combination 2 are recorded as decision trees C1~C s2, the second type of decision trees corresponding to combination 3 are recorded as decision trees D1~D s3 The values ​​of s1, s2, and s3 represent quantities and should be set according to actual needs.

[0115] Decision tree B1~B s1 The input format is MAC4' and MAC5', determine the decision tree B1~B s1 The process of determining the parameters of decision tree A1 to decision tree A s0 The process of training parameters is similar, the only difference is that the input is MAC4_ 样本 ' and MAC5_ 样本 '.

[0116] Similarly, decision trees C1 to C s2 The input format is MAC4' and MAC6', and the decision tree C1~C s2 The process of determining the parameters of decision tree A1 to decision tree A s0 The process of training parameters is similar, the only difference is that the input is MAC4_ 样本 ' and MAC6_ 样本 '.

[0117] Similarly, decision trees D1 to D s3 The input format is MAC5' and MAC6', and the decision tree D1~D s3 The process of determining the parameters of decision tree A1 to decision tree A s0 The process of training parameters is similar, except that the input is MAC5_ 样本 ' and MAC6_ 样本 '.

[0118] It should be noted that the above values ​​of Q and P are for illustrative purposes only and do not constitute a limitation to this application.

[0119] Based on the above description, after detecting whether the first confidence level is greater than or equal to the first threshold, the method further includes:

[0120] If the first confidence level is less than the first threshold, selecting a weighted product identification byte combination according to a preset order and inputting it into each corresponding second-category decision tree, and obtaining the second-category voting result output by each second-category decision tree;

[0121] determining a target second category voting result having the largest number of repetitions from a plurality of second category voting results;

[0122] Determining a second confidence level based on the number of repetitions of the target second category voting result and the total number of second category decision trees corresponding to the currently selected weighted product identification byte combination;

[0123] detecting whether the second confidence level is greater than or equal to a second threshold;

[0124] If the second confidence level is greater than or equal to a second threshold, determining the category of the router to be identified based on the target second category voting result;

[0125] If the second confidence level is less than the second threshold, detecting whether all product identification byte combinations have been selected;

[0126] If not, return to executing the step of selecting a weighted product identification byte combination according to a preset order and inputting the weighted product identification byte combination into each corresponding second-category decision tree, and obtaining the second-category voting result output by each second-category decision tree;

[0127] If so, it is determined that the category of the router to be identified is an unknown category.

[0128] In this embodiment, the preset order is set based on actual needs. For example, the preset order is:

[0129] First combine 1, then combine 2, and finally combine 3. That is, first input MAC4' and MAC5' into the decision tree B1~B s1 , from decision tree B1 to B s1 The target second category voting result with the largest number of repetitions is determined from the output second category voting results, and the ratio of the number of repetitions of the target second category voting result to the total number of second category decision trees corresponding to combination 1 is calculated to obtain a second confidence level. The second confidence level is then compared with a second threshold. If the second confidence level is greater than or equal to the second threshold, the category of the router to be identified is determined based on the target second category voting result. If the second confidence level is less than the second threshold, MAC4' and MAC6' are input into decision trees C1 to C2. s2 , and so on.

[0130] If the second confidence level corresponding to each combination is less than the second threshold, it means that an accurate category recognition result cannot be obtained by relying on the current random forest model, and the category of the router to be identified is determined to be an unknown category.

[0131] Furthermore, in one embodiment, the number of second-type decision trees corresponding to different weighted product identification byte combinations is the same.

[0132] In this embodiment, because different manufacturers use different naming conventions for the last three digits of the MAC address, the specific position of the noise byte in the product identification byte that is not used to represent the product category is unclear. To avoid errors caused by this situation, it is necessary to ensure that the number of second-type decision trees corresponding to different weighted product identification byte combinations is the same. In other words, the values ​​of s1, s2, and s3 are equal.

[0133] Furthermore, in one embodiment, the classifier is a trained random forest model, and the trained random forest model includes a plurality of first-type decision trees and a plurality of second-type decision trees corresponding to each weighted product identification byte combination, wherein each weighted product identification byte combination includes (QP) weighted product identification bytes, where P is the number of noise bytes in the Q product identification bytes that are not used to represent the product category, and P<Q. Step S20 specifically includes:

[0134] Inputting Q weighted product identification bytes into each first-category decision tree, obtaining first-category voting results output by each first-category decision tree, determining a target first-category voting result having the largest number of repetitions from the plurality of first-category voting results, and determining a first confidence level based on the number of repetitions of the target first-category voting result and the total number of first-category decision trees;

[0135] For each weighted product identification byte combination, input the weighted product identification byte combination into each corresponding second-category decision tree, obtain a second-category voting result output by each second-category decision tree, determine a target second-category voting result having the greatest number of repetitions from the plurality of second-category voting results, and determine a second confidence level corresponding to each weighted product identification byte combination based on the number of repetitions of the target second-category voting result and the total number of second-category decision trees corresponding to the weighted product identification byte combination;

[0136] Selecting a maximum value from the first confidence level and all second confidence levels;

[0137] The category of the router to be identified is determined based on the category voting result corresponding to the maximum value.

[0138] In this embodiment, refer to Figure 4 , Figure 4 FIG. 1 is a schematic diagram of an execution scenario of step S20 in another embodiment. Figure 4 As shown, considering that in some engineering practices, computing resources are sufficient, MAC4', MAC5' and MAC6' can be input into decision trees A1 to A1. s0 ; Input MAC4' and MAC5' into decision tree B1~decision tree B s1 ; Input MAC4' and MAC6' into decision tree C1~decision tree C s2 ; Input MAC5' and MAC6' into decision tree D1~decision tree D s3 .

[0139] According to decision tree A1 to decision tree A s0 The output of the decision tree B1 to the decision tree B1 determines the voting result with the largest number of repetitions and the confidence level of the voting result 1. s1The output of the decision tree C1 to the decision tree C1 determines the voting result with the largest number of repetitions and the confidence level 2 of the voting result 2. s2 The output of , determine the confidence level 3 of voting result 2 and voting result 3 with the largest number of repetitions; according to decision tree D1 ~ decision tree D s3 The output of is used to determine the confidence level 4 of voting result 2 and voting result 4 with the largest number of repetitions.

[0140] The maximum confidence level is selected from confidence levels 1 to 4, and the category of the router to be identified is determined based on the voting result corresponding to the maximum confidence level.

[0141] In a second aspect, an embodiment of the present application further provides a router classification device.

[0142] In one embodiment, referring to Figure 5 , Figure 5 This is a functional module diagram of an embodiment of the router classification device of the present application. Figure 5 As shown, the router classification device includes:

[0143] A weighting module 10 is configured to weight the product identifier in the MAC address of the router to be identified based on the organization unique identifier in the MAC address of the router to be identified;

[0144] The classification module 20 is configured to input the weighted product identifier into a classifier, and determine the category of the router to be identified based on the output of the classifier.

[0145] Furthermore, in one embodiment, the organization unique identifier includes Q organization unique identification bytes, and the product identifier includes Q product identification bytes. The weighting module 10 is configured to:

[0146] Input Q unique organization identification bytes into the trained fully connected network to obtain an m-dimensional vector corresponding to each product identification byte;

[0147] For each product identification byte of the Q product identification bytes, multiply it by the corresponding m-dimensional vector to obtain a weighted product identification byte.

[0148] Furthermore, in one embodiment, the classifier is a trained random forest model, and the trained random forest model includes a plurality of first-class decision trees, and the classification module 20 is used to:

[0149] Inputting Q weighted product identification bytes into each first-category decision tree, and obtaining the first-category voting results output by each first-category decision tree;

[0150] determining a target first-category voting result having the largest number of repetitions from a plurality of first-category voting results;

[0151] The category of the router to be identified is determined based on the target first category voting result.

[0152] Furthermore, in one embodiment, the classification module 20 is configured to:

[0153] Determining a first confidence level based on the number of repetitions of the target first category voting result and the total number of first category decision trees;

[0154] detecting whether the first confidence level is greater than or equal to a first threshold;

[0155] If the first confidence level is greater than or equal to a first threshold, the category of the router to be identified is determined based on the target first category voting result.

[0156] Furthermore, in one embodiment, the trained random forest model further includes a plurality of second-type decision trees corresponding to each weighted product identification byte combination, wherein each weighted product identification byte combination includes (QP) weighted product identification bytes, where P is the number of noise bytes in the Q product identification bytes that are not used to represent the product category, and P<Q. The classification module 20 is further configured to:

[0157] If the first confidence level is less than the first threshold, selecting a weighted product identification byte combination according to a preset order and inputting it into each corresponding second-category decision tree, and obtaining the second-category voting result output by each second-category decision tree;

[0158] determining a target second category voting result having the largest number of repetitions from a plurality of second category voting results;

[0159] Determining a second confidence level based on the number of repetitions of the target second category voting result and the total number of second category decision trees corresponding to the currently selected weighted product identification byte combination;

[0160] detecting whether the second confidence level is greater than or equal to a second threshold;

[0161] If the second confidence level is greater than or equal to a second threshold, determining the category of the router to be identified based on the target second category voting result;

[0162] If the second confidence level is less than the second threshold, detecting whether all product identification byte combinations have been selected;

[0163] If not, return to executing the step of selecting a weighted product identification byte combination according to a preset order and inputting the weighted product identification byte combination into each corresponding second-category decision tree, and obtaining the second-category voting result output by each second-category decision tree;

[0164] If so, it is determined that the category of the router to be identified is an unknown category.

[0165] Furthermore, in one embodiment, the classifier is a trained random forest model, and the trained random forest model includes a plurality of first-type decision trees and a plurality of second-type decision trees corresponding to each weighted product identification byte combination, wherein each weighted product identification byte combination includes (QP) weighted product identification bytes, where P is the number of noise bytes in the Q product identification bytes that are not used to represent the product category, and P<Q. The classification module 20 is configured to:

[0166] Inputting Q weighted product identification bytes into each first-category decision tree, obtaining first-category voting results output by each first-category decision tree, determining a target first-category voting result having the largest number of repetitions from the plurality of first-category voting results, and determining a first confidence level based on the number of repetitions of the target first-category voting result and the total number of first-category decision trees;

[0167] For each weighted product identification byte combination, input the weighted product identification byte combination into each corresponding second-category decision tree, obtain a second-category voting result output by each second-category decision tree, determine a target second-category voting result having the greatest number of repetitions from the plurality of second-category voting results, and determine a second confidence level corresponding to each weighted product identification byte combination based on the number of repetitions of the target second-category voting result and the total number of second-category decision trees corresponding to the weighted product identification byte combination;

[0168] Selecting a maximum value from the first confidence level and all second confidence levels;

[0169] The category of the router to be identified is determined based on the category voting result corresponding to the maximum value.

[0170] Furthermore, in one embodiment, the number of second-type decision trees corresponding to different weighted product identification byte combinations is the same.

[0171] The functional implementation of each module in the above router classification device corresponds to each step in the above router classification method embodiment, and its functions and implementation processes are not repeated here one by one.

[0172] In a third aspect, an embodiment of the present application provides a router classification device, which may be a device with data processing capabilities, such as a personal computer (PC), a laptop computer, or a server.

[0173] Reference Figure 6 , Figure 6 Schematic diagram of the hardware structure of the router classification device involved in the embodiment of the present application. In the embodiment of the present application, the router classification device may include a processor, a memory, a communication interface and a communication bus.

[0174] The communication bus may be of any type and is used to interconnect the processor, memory, and communication interface.

[0175] Communication interfaces include input / output (I / O) interfaces, physical interfaces, and logical interfaces, which interconnect components within the router and other devices (such as other computing devices or user devices). Physical interfaces can be Ethernet, fiber, or ATM interfaces; user devices can be displays or keyboards.

[0176] The memory can be various types of storage media, such as random access memory (RAM), read-only memory (ROM), non-volatile RAM (NVRAM), flash memory, optical storage, hard disk, programmable ROM (PROM), erasable PROM (EPROM), electrically erasable PROM (EEPROM), etc.

[0177] The processor may be a general-purpose processor that can call a router classification program stored in a memory and execute the router classification method provided in the embodiments of the present application. For example, the general-purpose processor may be a central processing unit (CPU). The method executed when the router classification program is called can be referred to in the various embodiments of the router classification method of the present application and will not be further described here.

[0178] Those skilled in the art will understand that Figure 6 The hardware structure shown in the figure does not constitute a limitation to the present application and may include more or fewer components than shown in the figure, or a combination of certain components, or a different arrangement of components.

[0179] In a fourth aspect, an embodiment of the present application also provides a computer-readable storage medium.

[0180] The computer-readable storage medium of the present application stores a router classification program, wherein when the router classification program is executed by a processor, the steps of the router classification method described above are implemented.

[0181] The method implemented when the router classification program is executed can refer to the various embodiments of the router classification method of the present application, and will not be repeated here.

[0182] It should be noted that the serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.

[0183] The terms "including" and "having" and any variations thereof in the specification and claims of this application and the above-mentioned drawings are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but optionally includes steps or units that are not listed, or optionally includes other steps or units inherent to these processes, methods, products or devices. The terms "first", "second" and "third" are used to distinguish different objects, etc., and do not represent a sequence, nor do they limit the "first", "second" and "third" to different types.

[0184] In the description of the embodiments of this application, the words "exemplary," "for example," or "for example" are used to indicate examples, illustrations, or descriptions. Any embodiment or design described as "exemplary," "for example," or "for example" in the embodiments of this application should not be construed as being preferred or advantageous over other embodiments or designs. Rather, the use of words such as "exemplary," "for example," or "for example" is intended to present the relevant concepts in a concrete manner.

[0185] In the description of the embodiments of the present application, unless otherwise specified, “ / ” means or, for example, A / B can mean A or B; “and / or” in the text is merely a description of the association relationship of associated objects, indicating that three relationships may exist, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, in the description of the embodiments of the present application, “multiple” refers to two or more than two.

[0186] In some processes described in the embodiments of the present application, multiple operations or steps are included that appear in a specific order. However, it should be understood that these operations or steps may not be performed in the order in which they appear in the embodiments of the present application or may be performed in parallel. The sequence numbers of the operations are only used to distinguish between different operations, and the sequence numbers themselves do not represent any order of execution. In addition, these processes may include more or fewer operations, and these operations or steps may be performed in sequence or in parallel, and these operations or steps may be combined.

[0187] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus the necessary general hardware platform, of course, it can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes a number of instructions for enabling a terminal device to execute the methods described in each embodiment of the present application.

[0188] The above are only preferred embodiments of the present application and do not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.

Claims

1. A router classification method, characterized in that: The router classification method includes: weighting the product identifier in the MAC address of the router to be identified based on the organization unique identifier in the MAC address of the router to be identified; inputting the weighted product identifier into a classifier, and determining the category of the router to be identified based on an output of the classifier; The organization unique identifier includes Q organization unique identification bytes, the product identifier includes Q product identification bytes, and weighting the product identifier in the MAC address of the router to be identified based on the organization unique identifier in the MAC address of the router to be identified includes: Input Q unique organization identification bytes into the trained fully connected network to obtain an m-dimensional vector corresponding to each product identification byte; For each product identification byte of the Q product identification bytes, multiply it by the corresponding m-dimensional vector to obtain a weighted product identification byte; The classifier is a trained random forest model including a plurality of first-class decision trees. Inputting the weighted product identifier into the classifier and determining the category of the router to be identified based on the output of the classifier include: Inputting Q weighted product identification bytes into each first-category decision tree, and obtaining the first-category voting results output by each first-category decision tree; determining a target first-category voting result having the largest number of repetitions from a plurality of first-category voting results; The category of the router to be identified is determined based on the target first category voting result.

2. The router classification method according to claim 1, wherein: After determining the target first category voting result having the largest number of repetitions from the plurality of first category voting results, the method further includes: Determining a first confidence level based on the number of repetitions of the target first category voting result and the total number of first category decision trees; detecting whether the first confidence level is greater than or equal to a first threshold; If the first confidence level is greater than or equal to a first threshold, the category of the router to be identified is determined based on the target first category voting result.

3. The router classification method according to claim 2, wherein: The trained random forest model further includes a plurality of second-type decision trees corresponding to each weighted product identification byte combination, wherein each weighted product identification byte combination includes (QP) weighted product identification bytes, where P is the number of noise bytes not used to represent the product category in the Q product identification bytes, and P<Q. After detecting whether the first confidence level is greater than or equal to the first threshold, the model further includes: If the first confidence level is less than the first threshold, selecting a weighted product identification byte combination according to a preset order and inputting it into each corresponding second-category decision tree, and obtaining the second-category voting result output by each second-category decision tree; determining a target second category voting result having the largest number of repetitions from a plurality of second category voting results; Determining a second confidence level based on the number of repetitions of the target second category voting result and the total number of second category decision trees corresponding to the currently selected weighted product identification byte combination; detecting whether the second confidence level is greater than or equal to a second threshold; If the second confidence level is greater than or equal to a second threshold, determining the category of the router to be identified based on the target second category voting result; If the second confidence level is less than the second threshold, detecting whether all product identification byte combinations have been selected; If not, return to executing the step of selecting a weighted product identification byte combination according to a preset order and inputting the weighted product identification byte combination into each corresponding second-category decision tree, and obtaining the second-category voting result output by each second-category decision tree; If so, it is determined that the category of the router to be identified is an unknown category.

4. The router classification method according to claim 1, wherein: The classifier is a trained random forest model, comprising a plurality of first-type decision trees and a plurality of second-type decision trees corresponding to each weighted product identification byte combination. Each weighted product identification byte combination comprises (QP) weighted product identification bytes, where P is the number of noise bytes not used to represent the product category in the Q product identification bytes, and P<Q. Inputting the weighted product identifier into the classifier and determining the category of the to-be-identified router based on the output of the classifier comprises: Inputting Q weighted product identification bytes into each first-category decision tree, obtaining first-category voting results output by each first-category decision tree, determining a target first-category voting result having the largest number of repetitions from the plurality of first-category voting results, and determining a first confidence level based on the number of repetitions of the target first-category voting result and the total number of first-category decision trees; For each weighted product identification byte combination, input the weighted product identification byte combination into each corresponding second-category decision tree, obtain a second-category voting result output by each second-category decision tree, determine a target second-category voting result having the greatest number of repetitions from the plurality of second-category voting results, and determine a second confidence level corresponding to each weighted product identification byte combination based on the number of repetitions of the target second-category voting result and the total number of second-category decision trees corresponding to the weighted product identification byte combination; Selecting a maximum value from the first confidence level and all second confidence levels; The category of the router to be identified is determined based on the category voting result corresponding to the maximum value.

5. The router classification method according to claim 3 or 4, characterized in that: The number of second-type decision trees corresponding to different weighted product identification byte combinations is the same.

6. A router classification device, characterized in that: The router classification device includes: a weighting module, configured to weight the product identifier in the MAC address of the router to be identified based on the organization unique identifier in the MAC address of the router to be identified; a classification module, configured to input the weighted product identifier into a classifier, and determine the category of the router to be identified based on an output of the classifier; The organization unique identifier includes Q organization unique identification bytes, and the product identifier includes Q product identification bytes. The weighting module is specifically configured to: Input Q unique organization identification bytes into the trained fully connected network to obtain an m-dimensional vector corresponding to each product identification byte; For each product identification byte of the Q product identification bytes, multiply it by the corresponding m-dimensional vector to obtain a weighted product identification byte; The classifier is a trained random forest model, which includes several first-class decision trees. The classification module is specifically used for: Inputting Q weighted product identification bytes into each first-category decision tree, and obtaining the first-category voting results output by each first-category decision tree; determining a target first-category voting result having the largest number of repetitions from a plurality of first-category voting results; The category of the router to be identified is determined based on the target first category voting result.

7. A router classification device, characterized in that: The router classification device includes a processor, a memory, and a router classification program stored in the memory and executable by the processor, wherein when the router classification program is executed by the processor, the steps of the router classification method according to any one of claims 1 to 5 are implemented.

8. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a router classification program, wherein when the router classification program is executed by a processor, the steps of the router classification method according to any one of claims 1 to 5 are implemented.

Citation Information

Patent Citations

  • WLAN (Wireless Local Area Network) access gateway as well as billing system and method by scenes

    CN101877845A

  • New equipment identification method and device, server and computer readable storage medium

    CN109446791A