AI-based business traffic switching methods and related equipment
By discretizing historical monitoring data and applying decision tree models, the problem of low accuracy in business traffic switching was solved, enabling automatic and accurate switching of business traffic and ensuring business stability and high availability.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHINA PING AN PROPERTY INSURANCE CO LTD
- Filing Date
- 2022-09-21
- Publication Date
- 2026-05-26
AI Technical Summary
The current technology has a relatively simple triggering method for business traffic switching, resulting in low switching accuracy, inability to achieve precise control, and the possibility of switching errors.
Historical monitoring data is collected, discretized, and a decision tree model is constructed. Based on real-time discrete monitoring data and the decision tree model, the anomaly level is obtained, and corresponding switching measures are executed to achieve automatic switching of business traffic.
It improves the accuracy of business traffic switching, ensuring accurate switching of business traffic under abnormal conditions and guaranteeing the normal operation of the business.
Smart Images

Figure CN115562934B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of artificial intelligence technology, and in particular to a business traffic switching method, apparatus, electronic device and storage medium based on artificial intelligence. Background Technology
[0002] Information technology is widely used in various scenarios such as insurance, banking, and e-commerce to achieve different business functions. In different application systems, to ensure stability and high availability, multiple backup environments, including local, remote, and disaster recovery environments, need to be built. When the business traffic in the application system becomes too large, exceeding the capacity of the operating environment, or when the operating environment malfunctions, the business traffic is switched to other backup environments to ensure the normal operation of the application system.
[0003] Currently, relevant data on business traffic is often monitored, and the monitoring results are compared with pre-set warning thresholds as a trigger for business traffic switching. However, this triggering method for business traffic switching is relatively simple and cannot achieve precise control of traffic switching. There are cases where business traffic switching errors occur, resulting in low accuracy of business traffic switching. Summary of the Invention
[0004] In view of the above, it is necessary to propose a service traffic switching method and related equipment based on artificial intelligence to solve the technical problem of how to improve the switching accuracy of service traffic. The related equipment includes an artificial intelligence-based service traffic switching device, electronic equipment and storage medium.
[0005] This application provides a service traffic switching method based on artificial intelligence, the method comprising:
[0006] Collect multiple historical monitoring data points for preset services within a historical period, and discretize the historical monitoring data to obtain historical discrete monitoring data, wherein the historical monitoring data includes at least one monitoring attribute.
[0007] The historical discrete monitoring data and the anomaly level label of each historical discrete monitoring data are stored as a training set.
[0008] A decision tree model is built based on the training set;
[0009] Obtain real-time discrete monitoring data of the preset service, and obtain the anomaly level of the preset service based on the real-time discrete monitoring data and the decision tree model;
[0010] Perform the switching measures corresponding to the anomaly level on the service traffic of the preset service to obtain the switching result.
[0011] In some embodiments, before discretizing the historical monitoring data to obtain historical discrete monitoring data, the method further includes:
[0012] Each monitoring attribute is classified based on its value range to obtain a classification result, which includes continuous attributes and discrete attributes.
[0013] Obtain the value range of the target continuous attribute, where the target continuous attribute is any one of all continuous attributes;
[0014] The value range is divided into a preset number of sub-ranges, and each sub-range includes at least one value;
[0015] Assign an index label as a unique identifier to each subrange to obtain a discrete mapping relationship of the target continuous attribute, wherein the discrete mapping relationship includes at least a mapping pair between a subrange and an index label;
[0016] Iterate through all continuous attributes to obtain the discrete mapping relationship for each continuous attribute.
[0017] In some embodiments, the process of discretizing the historical monitoring data to obtain historical discrete monitoring data includes:
[0018] Obtain the attribute values of all continuous attributes in the target monitoring data, where the target monitoring data is any historical monitoring data.
[0019] Based on the attribute values and discrete mapping relationship of the same continuous attribute, the index label corresponding to the attribute value is obtained, and the index label is used as the discrete value of the continuous attribute in the target monitoring data;
[0020] The discrete value of each continuous attribute is obtained by examining all continuous attributes in the target monitoring data.
[0021] The discrete values of all continuous attributes and the attribute values of all discrete attributes are used as the historical discrete monitoring data corresponding to the target monitoring data.
[0022] Iterate through all historical monitoring data to obtain the historical discrete monitoring data corresponding to each historical monitoring data point.
[0023] In some embodiments, building a decision tree model based on the training set includes:
[0024] A1, count all different values of the same monitoring attribute in the training set to obtain the discrete value range of each monitoring attribute;
[0025] A2, calculate the Gini coefficient for each value in all discrete value ranges based on the training set, and calculate the Gini coefficient for each monitoring attribute based on the Gini coefficients for all values in the same discrete value range;
[0026] A3, select the monitoring attribute corresponding to the minimum value of the Gini coefficient as the target attribute, and use the target attribute as node information to obtain new nodes;
[0027] A4. Draw a first directed edge starting from the newly added node, and use the minimum value of the Gini coefficient in the discrete value range of the target attribute as the segmentation value of the first directed edge; if there are remaining values in the discrete value range of the target attribute other than the segmentation value of the first directed edge, then draw a second directed edge starting from the newly added node, and use all remaining values as the segmentation value of the second directed edge;
[0028] A5. Based on the segmentation value of the target directed edge, filter all historical discrete monitoring data in the training set to obtain a training subset of the target directed edge. The target directed edge is either the first directed edge or the second directed edge, and the training set is the parent training set of the training subset.
[0029] A6. If all the Gini coefficients of the segmentation values of the target directed edge are 0, it means that all anomaly level labels in the training subset are the same, and the anomaly level label is used as the endpoint of the target directed edge; if at least one of the Gini coefficients of the segmentation values of the target directed edge is not 0, the training subset is used as a new training set and steps A1 to A3 are repeated to obtain new nodes, and the new nodes are used as the endpoints of the target directed edge.
[0030] A7. Traverse all directed edges to obtain the endpoint of each directed edge. If the endpoints of all directed edges are anomaly level labels, then obtain the initial decision tree model. If at least one directed edge has a new node as its endpoint, then execute steps A4 to A7 for each new node until the initial decision tree model is obtained.
[0031] A8. Prune the initial decision tree model to obtain a new decision tree model. The input of the decision tree model is discrete monitoring data, and the output is the anomaly level corresponding to the discrete monitoring data.
[0032] In some embodiments, the Gini coefficients satisfy the following relationship:
[0033]
[0034] Where n represents the number of different anomaly levels in the anomaly level label. This represents the number of historical discrete monitoring data in the training set where the value of monitoring attribute P is j. This represents the number of historical discrete monitoring data with anomaly level label i in the training set where the monitoring attribute P has a value of j; Gini(P|P=j) is the Gini coefficient for the value j in the discrete range of the monitoring attribute P.
[0035] The Gini coefficient satisfies the following relationship:
[0036]
[0037] Where N(P) is the number of all values in the discrete range of the monitored attribute P. The number of historical discrete monitoring data in the training set with the value j of monitoring attribute P is represented by ∑Num; Gini(P|P=j) represents the Gini coefficient of monitoring attribute P with the value j in the discrete range of monitoring attribute P, and Gibi(P) is the Gini coefficient of monitoring attribute P.
[0038] In some embodiments, when the number of monitoring attributes corresponding to the minimum value of the Gini coefficient is two or more, selecting the monitoring attribute corresponding to the minimum value of the Gini coefficient as the target attribute further includes:
[0039] a. Select all monitoring attributes corresponding to the minimum value of the Gini coefficient as candidate attributes;
[0040] b. Determine whether the training set has a parent training set;
[0041] c. If the training set does not have a parent training set, then any one of the candidate attributes shall be used as the target attribute.
[0042] d. If the training set has a parent training set, calculate the Gini coefficient of each of the candidate attributes in the parent training set and obtain the minimum value of all Gini coefficients. If the minimum value corresponds to a candidate attribute, use the candidate attribute as the target attribute. If the minimum value corresponds to two or more candidate attributes, use the parent training set as a new training set and repeat steps b to d until the target attribute is obtained.
[0043] In some embodiments, obtaining real-time discrete monitoring data of the preset service and determining the anomaly level of the preset service based on the real-time discrete monitoring data and the decision tree model includes:
[0044] Collect real-time monitoring data of the preset service within the current unit time, and discretize the real-time monitoring data to obtain real-time discrete monitoring data;
[0045] The real-time discrete monitoring data is input into the decision tree model to obtain the initial anomaly level for the current unit of time;
[0046] Obtain the initial anomaly level for a consecutive preset number of unit time periods. When all initial anomaly levels are the same, the initial anomaly level is taken as the anomaly level of the preset service.
[0047] This application embodiment also provides a service traffic switching device based on artificial intelligence, the device comprising:
[0048] A discretization unit is used to collect multiple historical monitoring data of a preset service within a historical period, and to discretize the historical monitoring data to obtain historical discrete monitoring data, wherein the historical monitoring data includes at least one monitoring attribute.
[0049] A storage unit is used to store the historical discrete monitoring data and the anomaly level label of each historical discrete monitoring data as a training set.
[0050] A building unit is used to build a decision tree model based on the training set;
[0051] An anomaly detection unit is used to acquire real-time discrete monitoring data of the preset service, and to obtain the anomaly level of the preset service based on the real-time discrete monitoring data and the decision tree model.
[0052] The switching unit is used to perform switching measures corresponding to the anomaly level on the service traffic of the preset service to obtain the switching result.
[0053] This application embodiment also provides an electronic device, the electronic device comprising:
[0054] Memory, storing at least one instruction;
[0055] The processor executes the instructions stored in the memory to implement the AI-based service traffic switching method.
[0056] This application also provides a computer-readable storage medium storing at least one instruction, which is executed by a processor in an electronic device to implement the AI-based service traffic switching method.
[0057] In summary, this application discretizes all monitoring data of a preset service to obtain discrete monitoring data, and obtains the accurate anomaly level of the preset service based on the decision tree model and the discrete monitoring data. Then, it executes the corresponding switching measures for the service traffic of the preset service to obtain the switching result, thereby realizing automatic switching of service traffic and improving the switching accuracy of service traffic. Attached Figure Description
[0058] Figure 1 This is a flowchart of a preferred embodiment of the AI-based business traffic switching method involved in this application.
[0059] Figure 2 This is a schematic diagram of the decision tree model involved in this application.
[0060] Figure 3 This is a schematic diagram of the business traffic switching process involved in this application.
[0061] Figure 4 This is a functional block diagram of a preferred embodiment of the AI-based service traffic switching device involved in this application.
[0062] Figure 5 This is a schematic diagram of the structure of an electronic device that represents a preferred embodiment of the AI-based service traffic switching method involved in this application. Detailed Implementation
[0063] To better understand the purpose, features, and advantages of this application, a detailed description of the application is provided below with reference to the accompanying drawings and specific embodiments. It should be noted that, unless otherwise specified, the embodiments and features described in the embodiments of this application can be combined with each other. Numerous specific details are set forth in the following description to provide a thorough understanding of this application; the described embodiments are only a part of the embodiments of this application, and not all of them.
[0064] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the stated features. In the description of this application, "a plurality of" means two or more, unless otherwise explicitly specified.
[0065] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. The term "and / or" as used herein includes any and all combinations of one or more of the associated listed items.
[0066] This application provides a service traffic switching method based on artificial intelligence, which can be applied to one or more electronic devices. An electronic device is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions. Its hardware includes, but is not limited to, microprocessors, application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), digital signal processors (DSPs), embedded devices, etc.
[0067] Electronic devices can be any electronic product that allows human-computer interaction with a customer, such as personal computers, tablets, smartphones, personal digital assistants (PDAs), game consoles, interactive network television (IPTV), smart wearable devices, etc.
[0068] Electronic devices may also include network devices and / or client devices. The network devices include, but are not limited to, a single network server, a server group consisting of multiple network servers, or a cloud based on cloud computing consisting of a large number of hosts or network servers.
[0069] The networks in which electronic devices are located include, but are not limited to, the Internet, wide area networks, metropolitan area networks, local area networks, and virtual private networks (VPNs).
[0070] like Figure 1 The diagram shown is a flowchart of a preferred embodiment of the AI-based service traffic switching method of this application. The order of steps in this flowchart can be changed, and some steps can be omitted, depending on different requirements.
[0071] The AI-based business traffic switching method provided in this application embodiment can be applied to application systems in various scenarios such as insurance, banking, and e-commerce, and thus can be applied to products in these scenarios.
[0072] S10: Collect multiple historical monitoring data of preset services within a historical period, and discretize the historical monitoring data to obtain historical discrete monitoring data. The historical monitoring data includes at least one monitoring attribute.
[0073] In an optional embodiment, the preset service is a business function implemented by a preset application system. For example, when the preset application system is an intelligent customer service system, the preset service is an intelligent question and answer service; when the preset application system is an electronic transaction system, the preset service is an electronic payment service.
[0074] In this optional embodiment, the historical monitoring data is monitoring data related to the preset service collected within any unit of time in history. The monitoring data includes multiple monitoring attributes and can reflect the operational status of the preset service in the business operating environment. The unit of time can be 1 minute. For example, the monitoring data includes four monitoring attributes: the number of service requests collected within a unit of time, the average response time, the number of abnormal requests, and the system-level attributes. That is, a single piece of historical monitoring data includes four monitoring attributes and their values.
[0075] In an optional implementation, before discretizing the historical monitoring data to obtain historical discrete monitoring data, the method further includes:
[0076] Each monitoring attribute is classified based on its value range to obtain a classification result, which includes continuous attributes and discrete attributes.
[0077] Obtain the value range of the target continuous attribute, where the target continuous attribute is any one of all continuous attributes;
[0078] The value range is divided into a preset number of sub-ranges, and each sub-range includes at least one value;
[0079] Assign an index label as a unique identifier to each subrange to obtain a discrete mapping relationship of the target continuous attribute, wherein the discrete mapping relationship includes at least a mapping pair between a subrange and an index label;
[0080] Iterate through all continuous attributes to obtain the discrete mapping relationship for each continuous attribute.
[0081] The index labels can be integer data or character data, and this application does not impose any restrictions; each continuous attribute corresponds to a discrete mapping relationship.
[0082] In this optional embodiment, the classification of each monitoring attribute based on its value range to obtain a classification result includes:
[0083] If the value range of the monitored attribute is continuous, then the monitored attribute is a continuous attribute.
[0084] If the value range of the monitoring attribute is discrete, then the monitoring attribute is a discrete attribute.
[0085] For example, assume the monitoring data includes four monitoring attributes: the number of business requests collected per unit time, average response time, abnormal request volume, and system level. For the business request volume and system level in the monitoring data, the system level ranges from {"Level 1", "Level 2", "Level 3"}, and the business request volume ranges from 0 to 1. Therefore, the system level is a discrete attribute, and the business request volume is a continuous attribute. For the business request volume, the range is divided into three sub-ranges: the first sub-range is [0, 2000), corresponding to the index label "small amount"; the second sub-range is [2000, 5000), corresponding to the index label "moderate"; and the third sub-range is [5000, +∞), corresponding to the index label "frequent". Thus, mapping pairs between the three sub-ranges "[0, 2000), small amount", "[2000, 5000), moderate", and "[5000, +∞), frequent" and the index labels are obtained. These three mapping pairs are used as the discrete mapping relationship for the business request volume.
[0086] In an optional embodiment, the step of discretizing the historical monitoring data to obtain historical discrete monitoring data includes:
[0087] Obtain the attribute values of all continuous attributes in the target monitoring data, where the target monitoring data is any historical monitoring data.
[0088] Based on the attribute values and discrete mapping relationship of the same continuous attribute, the index label corresponding to the attribute value is obtained, and the index label is used as the discrete value of the continuous attribute in the target monitoring data;
[0089] The discrete value of each continuous attribute is obtained by examining all continuous attributes in the target monitoring data.
[0090] The discrete values of all continuous attributes and the attribute values of all discrete attributes are used as the historical discrete monitoring data corresponding to the target monitoring data.
[0091] Iterate through all historical monitoring data to obtain the historical discrete monitoring data corresponding to each historical monitoring data point.
[0092] In this optional embodiment, for all continuous attributes in the target monitoring data, the discrete mapping relationship and attribute value of the same continuous attribute are obtained. The discrete mapping relationship includes at least one mapping pair of sub-range and index label. The sub-range where the attribute value is located is determined. Based on the mapping pair in the discrete mapping relationship, the index label corresponding to the sub-range is obtained. Then, the index label is used as the discrete value of the continuous attribute.
[0093] In this way, multiple historical discrete monitoring data were obtained, providing a data foundation for building a decision tree model.
[0094] S11, store the historical discrete monitoring data and the anomaly level label of each historical discrete monitoring data as a training set.
[0095] In one optional embodiment, an anomaly level label is obtained for each historical discrete monitoring data point. The anomaly level label indicates the degree of anomaly in the business operating environment under that historical discrete monitoring data. The anomaly level label is obtained manually. The number of anomaly levels is at least two, but the specific number is not limited in this application.
[0096] For example, when there are 2 anomaly levels, the anomaly levels are 0 and 1, where 0 indicates that the business operating environment is normal and 1 indicates that the business operating environment is abnormal; when there are 3 anomaly levels, the anomaly levels are 0, 1 and 2, where 0 indicates that the business operating environment is normal and the larger the value, the greater the degree of anomaly in the business operating environment.
[0097] In this optional embodiment, all historical discrete monitoring data and the anomaly level label of each historical discrete monitoring data are stored to obtain a training set.
[0098] In this way, the anomaly level label of each historical discrete monitoring data is obtained through manual annotation, and the training set is used to train the decision tree model.
[0099] S12, Build a decision tree model based on the training set.
[0100] In an optional embodiment, building the decision tree model based on the training set includes:
[0101] A1, count all different values of the same monitoring attribute in the training set to obtain the discrete value range of each monitoring attribute;
[0102] A2, calculate the Gini coefficient for each value in all discrete value ranges based on the training set, and calculate the Gini coefficient for each monitoring attribute based on the Gini coefficients for all values in the same discrete value range;
[0103] In this optional embodiment, the Gini coefficients satisfy the following relation:
[0104]
[0105] Where n represents the number of different anomaly levels in the anomaly level label. This represents the number of historical discrete monitoring data in the training set where the value of monitoring attribute P is j. This represents the number of historical discrete monitoring data with anomaly level label i in the training set where the monitoring attribute P has a value of j; Gini(P|P=j) is the Gini coefficient for the value j in the discrete range of the monitoring attribute P.
[0106] It should be noted that the Gini coefficient reflects the degree of interference of the value of the monitoring attribute with the anomaly level detection. The larger the Gini coefficient, the greater the interference of the value of the monitoring attribute with the anomaly level detection, and the less effective information is provided in the anomaly level detection process. When the Gini coefficient of a monitoring attribute is 0, it means that an accurate anomaly level can be obtained based on the value of the monitoring attribute.
[0107] In this optional embodiment, the Gini coefficient satisfies the following relationship:
[0108]
[0109] Where N(P) is the number of all values in the discrete range of the monitored attribute P. The number of historical discrete monitoring data in the training set with the value j of monitoring attribute P is represented by ∑Num; Gini(P|P=j) represents the Gini coefficient of monitoring attribute P with the value j in the discrete range of monitoring attribute P, and Gibi(P) is the Gini coefficient of monitoring attribute P.
[0110] It should be noted that the Gini coefficient reflects the degree of interference of monitoring attributes with anomaly level detection. The larger the Gini coefficient, the greater the interference of monitoring attributes with anomaly level detection, and the less effective information is provided in the anomaly level detection process. When the Gini coefficient of a monitoring attribute is 0, it means that an accurate anomaly level can be obtained based on that monitoring attribute.
[0111] A3, select the monitoring attribute corresponding to the minimum value of the Gini coefficient as the target attribute, and use the target attribute as node information to obtain new nodes;
[0112] A4. Draw a first directed edge starting from the newly added node, and use the minimum value of the Gini coefficient in the discrete value range of the target attribute as the segmentation value of the first directed edge; if there are remaining values in the discrete value range of the target attribute other than the segmentation value of the first directed edge, then draw a second directed edge starting from the newly added node, and use all remaining values as the segmentation value of the second directed edge;
[0113] In this optional embodiment, when the minimum value of the Gini coefficient in the discrete value range of the target attribute corresponds to two or more values, all values are used as the segmentation values of the first directed edge; that is, the segmentation values of the first directed edge can be one or more. It should be noted that the segmentation values of the second directed edge can also be one or more.
[0114] For example, suppose the discrete range of the target attribute has four values, denoted as A, B, C, and D, and the Gini coefficients corresponding to the four values are 0.48, 0.365, 0.5, and 0.365, respectively; then the splitting values of the first directed edge are B and D, and the splitting values of the second directed edge are A and C.
[0115] A5. Based on the segmentation value of the target directed edge, filter all historical discrete monitoring data in the training set to obtain a training subset of the target directed edge. The target directed edge is either the first directed edge or the second directed edge, and the training set is the parent training set of the training subset.
[0116] In this optional embodiment, the target directed edge has one or more segmentation values. In the training set, all historical discrete monitoring data whose target attribute value is equal to any one of the segmentation values of the target directed edge are used as the training subset of the target directed edge.
[0117] A6. If all the Gini coefficients of the segmentation values of the target directed edge are 0, it means that all anomaly level labels in the training subset are the same, and the anomaly level label is used as the endpoint of the target directed edge; if at least one of the Gini coefficients of the segmentation values of the target directed edge is not 0, the training subset is used as a new training set and steps A1 to A3 are repeated to obtain new nodes, and the new nodes are used as the endpoints of the target directed edge.
[0118] A7. Traverse all directed edges to obtain the endpoint of each directed edge. If the endpoints of all directed edges are anomaly level labels, then obtain the initial decision tree model. If at least one directed edge has a new node as its endpoint, then execute steps A4 to A7 for each new node until the initial decision tree model is obtained.
[0119] A8. Prune the initial decision tree model to obtain a new decision tree model. The input of the decision tree model is discrete monitoring data, and the output is the anomaly level corresponding to the discrete monitoring data.
[0120] In this optional embodiment, since there may be abnormal and distorted data and low-probability data in the training set, abnormal nodes will be introduced into the initial decision tree model, thereby reducing the accuracy of the output results of the decision tree model. This application uses a post-pruning method to delete abnormal nodes on the initial decision tree model to obtain the decision tree model. The post-pruning method can be an existing cost complexity pruning, minimum error pruning, pessimistic error pruning, etc., and this application does not impose any restrictions.
[0121] Using a training set with 4 monitored attributes and 3 anomaly levels as an example, the structural diagram of the decision tree model is shown below. Figure 2 As shown. In Figure 2 In the target attribute, the value range of target attribute 1 includes four values: A1, B1, C1, and D1; the value range of target attribute 2 includes three values: A2, B2, and C2; the value range of target attribute 3 includes two values: A3 and B3; and the value range of target attribute 4 includes two values: A4 and B4.
[0122] In an optional embodiment, regarding step A3 above, when the number of monitoring attributes corresponding to the minimum value of the Gini coefficient is two or more, selecting the monitoring attribute corresponding to the minimum value of the Gini coefficient as the target attribute further includes:
[0123] a. Select all monitoring attributes corresponding to the minimum value of the Gini coefficient as candidate attributes;
[0124] b. Determine whether the training set has a parent training set;
[0125] c. If the training set does not have a parent training set, then any one of the candidate attributes shall be used as the target attribute.
[0126] d. If the training set has a parent training set, calculate the Gini coefficient of each of the candidate attributes in the parent training set and obtain the minimum value of all Gini coefficients. If the minimum value corresponds to a candidate attribute, use the candidate attribute as the target attribute. If the minimum value corresponds to two or more candidate attributes, use the parent training set as a new training set and repeat steps b to d until the target attribute is obtained.
[0127] For example, assuming there are three candidate attributes: average response time, abnormal request volume, and system level, and a parent training set exists, the Gini coefficients of average response time, abnormal request volume, and system level in the parent training set are calculated as 0.216, 0.216, and 0.2, respectively. The minimum value of all Gini coefficients is 0.2, and the minimum value corresponds to only one candidate attribute, "system level". Then, system level is selected as the target attribute.
[0128] Thus, a decision tree model is built based on the training set, and the decision tree model can obtain an accurate anomaly level.
[0129] S13, obtain real-time discrete monitoring data of the preset service, and obtain the anomaly level of the preset service based on the real-time discrete monitoring data and the decision tree model.
[0130] In an optional embodiment, after the decision tree model is built, it can be used to detect the operating status of the preset service in the business operating environment and obtain the anomaly level of the preset service.
[0131] In an optional embodiment, the step of acquiring real-time discrete monitoring data of the preset service and obtaining the anomaly level of the preset service based on the real-time discrete monitoring data and the decision tree model includes:
[0132] Collect real-time monitoring data of the preset service within the current unit time, and discretize the real-time monitoring data to obtain real-time discrete monitoring data;
[0133] The real-time discrete monitoring data is input into the decision tree model to obtain the initial anomaly level for the current unit of time;
[0134] Obtain the initial anomaly level for a consecutive preset number of unit time periods. When all initial anomaly levels are the same, the initial anomaly level is taken as the anomaly level of the preset service.
[0135] Preferably, the preset quantity is 3.
[0136] In this way, the initial anomaly level of the preset service is obtained by monitoring the operation status of the preset service in the business operation environment. When the initial anomaly level is the same for multiple consecutive units of time, the anomaly level of the preset service is obtained, thus ensuring the accuracy of the anomaly level of the preset service.
[0137] S14, perform the switching measures corresponding to the anomaly level on the service traffic of the preset service to obtain the switching result.
[0138] In an optional embodiment, each anomaly level corresponds to a switching measure, thereby switching all or part of the service traffic of the preset service to the backup environment according to the anomaly level, so as to ensure the normal operation of the preset service.
[0139] For example, when there are two anomaly levels, the anomaly levels are 0 and 1. An anomaly level of 0 indicates that the business operating environment is normal, and the corresponding switching measure is not to switch the business traffic; an anomaly level of 1 indicates that the business operating environment is abnormal, and the corresponding switching measure is to switch the business traffic to the backup environment.
[0140] In another example, when there are 3 anomaly levels, the anomaly levels are 0, 1 and 2. The higher the value of the anomaly level, the greater the degree of anomaly in the business operating environment. The switching measure corresponding to anomaly level 0 is not to switch business traffic; the switching measure corresponding to anomaly level 1 is to switch 50% of business traffic to the backup environment; and the switching measure corresponding to anomaly level 2 is to switch all business traffic to the backup environment.
[0141] Please see Figure 3 This is a schematic diagram of the service traffic switching process involved in this application. In this optional embodiment, after obtaining the switching measures corresponding to the anomaly level, the switching measures are executed on the service traffic of the preset service. First, the interface information such as the domain name and IP address of the backup environment is extracted, and there is at least one backup environment; further, based on the interface information and the switching measures, the service traffic is switched to the backup environment to obtain the switching result.
[0142] In this way, corresponding switching measures are implemented for the business traffic of preset services according to different anomaly levels, so as to realize the automatic switching of business traffic and ensure the normal operation of preset services.
[0143] As can be seen from the above technical solutions, this application obtains discrete monitoring data by discretizing all monitoring data of the preset service, and obtains the accurate anomaly level of the preset service based on the decision tree model and the discrete monitoring data. The switching measures corresponding to the anomaly level are then executed on the service traffic of the preset service to obtain the switching result, thereby realizing the automatic switching of service traffic and improving the switching accuracy of service traffic.
[0144] Please see Figure 4 , Figure 4 This is a functional block diagram of a preferred embodiment of the AI-based service traffic switching device of this application. The AI-based service traffic switching device 11 includes a discretization unit 110, a storage unit 111, a construction unit 112, an anomaly detection unit 113, and a switching unit 114. The module / unit referred to in this application refers to a series of computer-readable instruction segments that can be executed by the processor 13 and perform a fixed function, and are stored in the memory 12. In this embodiment, the functions of each module / unit will be described in detail in subsequent embodiments.
[0145] In an optional embodiment, the discretization unit 110 is used to collect multiple historical monitoring data of a preset service within a historical period, and to discretize the historical monitoring data to obtain historical discrete monitoring data, wherein the historical monitoring data includes at least one monitoring attribute.
[0146] In an optional embodiment, the preset service is a business function implemented by a preset application system. For example, when the preset application system is an intelligent customer service system, the preset service is an intelligent question and answer service; when the preset application system is an electronic transaction system, the preset service is an electronic payment service.
[0147] In this optional embodiment, the historical monitoring data is monitoring data related to the preset service collected within any unit of time in history. The monitoring data includes multiple monitoring attributes and can reflect the operational status of the preset service in the business operating environment. The unit of time can be 1 minute. For example, the monitoring data includes four monitoring attributes: the number of service requests collected within a unit of time, the average response time, the number of abnormal requests, and the system-level attributes. That is, a single piece of historical monitoring data includes four monitoring attributes and their values.
[0148] In an optional implementation, before discretizing the historical monitoring data to obtain historical discrete monitoring data, the method further includes:
[0149] Each monitoring attribute is classified based on its value range to obtain a classification result, which includes continuous attributes and discrete attributes.
[0150] Obtain the value range of the target continuous attribute, where the target continuous attribute is any one of all continuous attributes;
[0151] The value range is divided into a preset number of sub-ranges, and each sub-range includes at least one value;
[0152] Assign an index label as a unique identifier to each subrange to obtain a discrete mapping relationship of the target continuous attribute, wherein the discrete mapping relationship includes at least a mapping pair between a subrange and an index label;
[0153] Iterate through all continuous attributes to obtain the discrete mapping relationship for each continuous attribute.
[0154] The index labels can be integer data or character data, and this application does not impose any restrictions; each continuous attribute corresponds to a discrete mapping relationship.
[0155] In this optional embodiment, the classification of each monitoring attribute based on its value range to obtain a classification result includes:
[0156] If the value range of the monitored attribute is continuous, then the monitored attribute is a continuous attribute.
[0157] If the value range of the monitoring attribute is discrete, then the monitoring attribute is a discrete attribute.
[0158] In an optional embodiment, the step of discretizing the historical monitoring data to obtain historical discrete monitoring data includes:
[0159] Obtain the attribute values of all continuous attributes in the target monitoring data, where the target monitoring data is any historical monitoring data.
[0160] Based on the attribute values and discrete mapping relationship of the same continuous attribute, the index label corresponding to the attribute value is obtained, and the index label is used as the discrete value of the continuous attribute in the target monitoring data;
[0161] The discrete value of each continuous attribute is obtained by examining all continuous attributes in the target monitoring data.
[0162] The discrete values of all continuous attributes and the attribute values of all discrete attributes are used as the historical discrete monitoring data corresponding to the target monitoring data.
[0163] Iterate through all historical monitoring data to obtain the historical discrete monitoring data corresponding to each historical monitoring data point.
[0164] In this optional embodiment, for all continuous attributes in the target monitoring data, the discrete mapping relationship and attribute value of the same continuous attribute are obtained. The discrete mapping relationship includes at least one mapping pair of sub-range and index label. The sub-range where the attribute value is located is determined. Based on the mapping pair in the discrete mapping relationship, the index label corresponding to the sub-range is obtained. Then, the index label is used as the discrete value of the continuous attribute.
[0165] In an optional embodiment, storage unit 111 is used to store the historical discrete monitoring data and the anomaly level label of each historical discrete monitoring data as a training set.
[0166] In one optional embodiment, an anomaly level label is obtained for each historical discrete monitoring data point. The anomaly level label indicates the degree of anomaly in the business operating environment under that historical discrete monitoring data. The anomaly level label is obtained manually. The number of anomaly levels is at least two, but the specific number is not limited in this application.
[0167] In this optional embodiment, all historical discrete monitoring data and the anomaly level label of each historical discrete monitoring data are stored to obtain a training set.
[0168] In an optional embodiment, the building unit 112 is used to build a decision tree model based on the training set.
[0169] In an optional embodiment, building the decision tree model based on the training set includes:
[0170] A1, count all different values of the same monitoring attribute in the training set to obtain the discrete value range of each monitoring attribute;
[0171] A2, calculate the Gini coefficient for each value in all discrete value ranges based on the training set, and calculate the Gini coefficient for each monitoring attribute based on the Gini coefficients for all values in the same discrete value range;
[0172] In this optional embodiment, the Gini coefficients satisfy the following relation:
[0173]
[0174] Where n represents the number of different anomaly levels in the anomaly level label. This represents the number of historical discrete monitoring data in the training set where the value of monitoring attribute P is j. This represents the number of historical discrete monitoring data with anomaly level label i in the training set where the monitoring attribute P has a value of j; Gini(P|P=j) is the Gini coefficient for the value j in the discrete range of the monitoring attribute P.
[0175] It should be noted that the Gini coefficient reflects the degree of interference of the value of the monitoring attribute with the anomaly level detection. The larger the Gini coefficient, the greater the interference of the value of the monitoring attribute with the anomaly level detection, and the less effective information is provided in the anomaly level detection process. When the Gini coefficient of a monitoring attribute is 0, it means that an accurate anomaly level can be obtained based on the value of the monitoring attribute.
[0176] In this optional embodiment, the Gini coefficient satisfies the following relationship:
[0177]
[0178] Where N(P) is the number of all values in the discrete range of the monitored attribute P. ∑Num represents the number of historical discrete monitoring data in the training set where the monitoring attribute P has a value of j; Gini(P|P=j) represents the Gini coefficient of the monitoring attribute P with a value of j in the discrete range of the monitoring attribute P, and Gini(P) is the Gini coefficient of the monitoring attribute P.
[0179] It should be noted that the Gini coefficient reflects the degree of interference of monitoring attributes with anomaly level detection. The larger the Gini coefficient, the greater the interference of monitoring attributes with anomaly level detection, and the less effective information is provided in the anomaly level detection process. When the Gini coefficient of a monitoring attribute is 0, it means that an accurate anomaly level can be obtained based on that monitoring attribute.
[0180] A3, select the monitoring attribute corresponding to the minimum value of the Gini coefficient as the target attribute, and use the target attribute as node information to obtain new nodes;
[0181] A4. Draw a first directed edge starting from the newly added node, and use the minimum value of the Gini coefficient in the discrete value range of the target attribute as the segmentation value of the first directed edge; if there are remaining values in the discrete value range of the target attribute other than the segmentation value of the first directed edge, then draw a second directed edge starting from the newly added node, and use all remaining values as the segmentation value of the second directed edge;
[0182] In this optional embodiment, when the minimum value of the Gini coefficient in the discrete value range of the target attribute corresponds to two or more values, all values are used as the segmentation values of the first directed edge; that is, the segmentation values of the first directed edge can be one or more. It should be noted that the segmentation values of the second directed edge can also be one or more.
[0183] For example, suppose the discrete range of the target attribute has four values, denoted as A, B, C, and D, and the Gini coefficients corresponding to the four values are 0.48, 0.365, 0.5, and 0.365, respectively; then the splitting values of the first directed edge are B and D, and the splitting values of the second directed edge are A and C.
[0184] A5. Based on the segmentation value of the target directed edge, filter all historical discrete monitoring data in the training set to obtain a training subset of the target directed edge. The target directed edge is either the first directed edge or the second directed edge, and the training set is the parent training set of the training subset.
[0185] In this optional embodiment, the target directed edge has one or more segmentation values. In the training set, all historical discrete monitoring data whose target attribute value is equal to any one of the segmentation values of the target directed edge are used as the training subset of the target directed edge.
[0186] A6. If all the Gini coefficients of the segmentation values of the target directed edge are 0, it means that all anomaly level labels in the training subset are the same, and the anomaly level label is used as the endpoint of the target directed edge; if at least one of the Gini coefficients of the segmentation values of the target directed edge is not 0, the training subset is used as a new training set and steps A1 to A3 are repeated to obtain new nodes, and the new nodes are used as the endpoints of the target directed edge.
[0187] A7. Traverse all directed edges to obtain the endpoint of each directed edge. If the endpoints of all directed edges are anomaly level labels, then obtain the initial decision tree model. If at least one directed edge has a new node as its endpoint, then execute steps A4 to A7 for each new node until the initial decision tree model is obtained.
[0188] A8. Prune the initial decision tree model to obtain a new decision tree model. The input of the decision tree model is discrete monitoring data, and the output is the anomaly level corresponding to the discrete monitoring data.
[0189] In this optional embodiment, since the training set may contain abnormal and distorted data and low-probability data, abnormal nodes will be introduced into the initial decision tree model, thereby reducing the accuracy of the decision tree model's output. This application uses a post-pruning method to remove abnormal nodes from the initial decision tree model to obtain the decision tree model. The post-pruning method can employ existing cost complexity pruning, minimum error pruning, pessimistic error pruning, etc., and this application is not limited to any particular method. Taking a training set with 4 monitored attributes and 3 abnormal levels as an example, the structural diagram of the decision tree model is shown below. Figure 2 As shown.
[0190] In an optional embodiment, regarding step A3 above, when the number of monitoring attributes corresponding to the minimum value of the Gini coefficient is two or more, selecting the monitoring attribute corresponding to the minimum value of the Gini coefficient as the target attribute further includes:
[0191] a. Select all monitoring attributes corresponding to the minimum value of the Gini coefficient as candidate attributes;
[0192] b. Determine whether the training set has a parent training set;
[0193] c. If the training set does not have a parent training set, then any one of the candidate attributes shall be used as the target attribute.
[0194] d. If the training set has a parent training set, calculate the Gini coefficient of each of the candidate attributes in the parent training set and obtain the minimum value of all Gini coefficients. If the minimum value corresponds to a candidate attribute, use the candidate attribute as the target attribute. If the minimum value corresponds to two or more candidate attributes, use the parent training set as a new training set and repeat steps b to d until the target attribute is obtained.
[0195] In an optional embodiment, the anomaly detection unit 113 is used to acquire real-time discrete monitoring data of the preset service, and obtain the anomaly level of the preset service based on the real-time discrete monitoring data and the decision tree model.
[0196] In an optional embodiment, after the decision tree model is built, it can be used to detect the operating status of the preset service in the business operating environment and obtain the anomaly level of the preset service.
[0197] In an optional embodiment, the step of acquiring real-time discrete monitoring data of the preset service and obtaining the anomaly level of the preset service based on the real-time discrete monitoring data and the decision tree model includes:
[0198] Collect real-time monitoring data of the preset service within the current unit time, and discretize the real-time monitoring data to obtain real-time discrete monitoring data;
[0199] The real-time discrete monitoring data is input into the decision tree model to obtain the initial anomaly level for the current unit of time;
[0200] Obtain the initial anomaly level for a consecutive preset number of unit time periods. When all initial anomaly levels are the same, the initial anomaly level is taken as the anomaly level of the preset service.
[0201] Preferably, the preset quantity is 3.
[0202] In an optional embodiment, the switching unit 114 is used to perform switching measures corresponding to the anomaly level on the service traffic of the preset service to obtain the switching result.
[0203] In an optional embodiment, each anomaly level corresponds to a switching measure, thereby switching all or part of the service traffic of the preset service to the backup environment according to the anomaly level, so as to ensure the normal operation of the preset service.
[0204] As can be seen from the above technical solutions, this application obtains discrete monitoring data by discretizing all monitoring data of the preset service, and obtains the accurate anomaly level of the preset service based on the decision tree model and the discrete monitoring data. The switching measures corresponding to the anomaly level are then executed on the service traffic of the preset service to obtain the switching result, thereby realizing the automatic switching of service traffic and improving the switching accuracy of service traffic.
[0205] Please see Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. The electronic device 1 includes a memory 12 and a processor 13. The memory 12 is used to store computer-readable instructions, and the processor 13 executes the computer-readable instructions stored in the memory to implement the AI-based service traffic switching method described in any of the above embodiments.
[0206] In an optional embodiment, the electronic device 1 further includes a bus and a computer program stored in the memory 12 and executable on the processor 13, such as an AI-based traffic switching program.
[0207] Figure 5 Only electronic device 1 with memory 12 and processor 13 is shown. It will be understood by those skilled in the art that... Figure 5 The structure shown does not constitute a limitation on the electronic device 1, and may include fewer or more components than shown, or combine certain components, or have different component arrangements.
[0208] Combination Figure 1 The memory 12 in the electronic device 1 stores a plurality of computer-readable instructions to implement an artificial intelligence-based service traffic switching method, and the processor 13 can execute the plurality of instructions to achieve:
[0209] Collect multiple historical monitoring data points for preset services within a historical period, and discretize the historical monitoring data to obtain historical discrete monitoring data, wherein the historical monitoring data includes at least one monitoring attribute.
[0210] The historical discrete monitoring data and the anomaly level label of each historical discrete monitoring data are stored as a training set.
[0211] A decision tree model is built based on the training set;
[0212] Obtain real-time discrete monitoring data of the preset service, and obtain the anomaly level of the preset service based on the real-time discrete monitoring data and the decision tree model;
[0213] Perform the switching measures corresponding to the anomaly level on the service traffic of the preset service to obtain the switching result.
[0214] Specifically, the processor 13's implementation method for the above instructions can be found in [reference needed]. Figure 1 The descriptions of the relevant steps in the corresponding embodiments are not repeated here.
[0215] Those skilled in the art will understand that the schematic diagram is merely an example of electronic device 1 and does not constitute a limitation on electronic device 1. Electronic device 1 can be a bus-type structure or a star-type structure. Electronic device 1 may also include more or fewer other hardware or software than shown in the diagram, or different component arrangements. For example, electronic device 1 may also include input / output devices, network access devices, etc.
[0216] It should be noted that electronic device 1 is only an example. Other existing or future electronic products that are suitable for this application should also be included within the scope of protection of this application and are incorporated herein by reference.
[0217] The memory 12 includes at least one type of readable storage medium, which can be non-volatile or volatile. The readable storage medium includes flash memory, portable hard drives, multimedia cards, card-type memory (e.g., SD or DX memory), magnetic storage, magnetic disks, optical disks, etc. In some embodiments, the memory 12 can be an internal storage unit of the electronic device 1, such as a portable hard drive of the electronic device 1. In other embodiments, the memory 12 can also be an external storage device of the electronic device 1, such as a plug-in portable hard drive, smart media card (SMC), secure digital (SD) card, flash card, etc., equipped on the electronic device 1. The memory 12 can be used not only to store application software and various types of data installed on the electronic device 1, such as the code of an AI-based business traffic switching program, but also to temporarily store data that has been output or will be output.
[0218] In some embodiments, the processor 13 may be composed of integrated circuits, such as a single packaged integrated circuit or multiple integrated circuits packaged with the same or different functions, including combinations of one or more central processing units (CPUs), microprocessors, digital processing chips, graphics processors, and various control chips. The processor 13 is the control unit of the electronic device 1, connecting various components of the electronic device 1 via various interfaces and lines. It executes programs or modules stored in the memory 12 (e.g., executing AI-based business traffic switching programs) and calls data stored in the memory 12 to perform various functions and process data in the electronic device 1.
[0219] The processor 13 executes the operating system of the electronic device 1 and various installed applications. The processor 13 executes these applications to implement the steps in the various AI-based service traffic switching method embodiments described above, for example... Figure 1 The steps are shown.
[0220] For example, the computer program may be divided into one or more modules / units, which are stored in the memory 12 and executed by the processor 13 to complete this application. The one or more modules / units may be a series of computer-readable instruction segments capable of performing a specific function, which describe the execution process of the computer program in the electronic device 1. For example, the computer program may be divided into a discretization unit 110, a storage unit 111, a construction unit 112, an anomaly detection unit 113, and a switching unit 114.
[0221] The integrated unit implemented as a software functional module described above can be stored in a computer-readable storage medium. This software functional module, stored in a storage medium, includes several instructions to cause a computer device (which may be a personal computer, computer equipment, or network device, etc.) or processor to execute portions of the AI-based service traffic switching method described in the various embodiments of this application.
[0222] If the modules / units integrated in electronic device 1 are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments can also be implemented by a computer program instructing related hardware devices. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above.
[0223] The computer program includes computer program code, which may be in the form of source code, object code, executable file, or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording media, USB flash drive, portable hard drive, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory, and other memory.
[0224] Furthermore, the computer-readable storage medium may primarily include a stored program area and a stored data area, wherein the stored program area may store the operating system, an application program required for at least one function, etc.; and the stored data area may store data created based on the use of blockchain nodes, etc.
[0225] The blockchain referred to in this application is a novel application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanisms, and encryption algorithms. Essentially, a blockchain is a decentralized database, a chain of data blocks linked together using cryptographic methods. Each data block contains information about a batch of network transactions, used to verify the validity of the information (anti-counterfeiting) and generate the next block. A blockchain can include an underlying blockchain platform, a platform product service layer, and an application service layer.
[0226] The bus can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This bus can be divided into address bus, data bus, control bus, etc. For ease of representation, in... Figure 5 The symbol is represented by only one arrow, but this does not indicate that there is only one bus or one type of bus. The bus is configured to enable communication between the memory 12 and at least one processor 13, etc.
[0227] This application also provides a computer-readable storage medium (not shown), which stores computer-readable instructions. These computer-readable instructions are executed by a processor in an electronic device to implement the AI-based service traffic switching method described in any of the above embodiments.
[0228] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of modules is only a logical functional division, and other division methods may be used in actual implementation.
[0229] The modules described as separate components may or may not be physically separate. The components shown as modules may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.
[0230] Furthermore, the functional modules in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or in the form of hardware plus software functional modules.
[0231] Furthermore, it is clear that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices described in the specification may also be implemented by a single unit or device through software or hardware. Terms such as "first," "second," etc., are used to indicate names and do not indicate any specific order.
[0232] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application and are not intended to limit it. Although this application has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of this application without departing from the spirit and scope of the technical solutions of this application.
Claims
1. A business traffic switching method based on artificial intelligence, characterized in that, The method includes: Collect multiple historical monitoring data points for preset services within a historical period, and discretize the historical monitoring data to obtain historical discrete monitoring data, wherein the historical monitoring data includes at least one monitoring attribute. The historical discrete monitoring data and the anomaly level label of each historical discrete monitoring data are stored as a training set. A decision tree model is built based on the training set, including: A1, statistically analyzing all different values of the same monitoring attribute in the training set to obtain the discrete value range of each monitoring attribute; A2, calculating the Gini coefficient of each value in all discrete value ranges based on the training set, and calculating the Gini coefficient of each monitoring attribute based on the Gini coefficients of all values in the same discrete value range; A3, selecting the monitoring attribute corresponding to the minimum value of the Gini coefficient as the target attribute, and using the target attribute as node information to obtain new nodes; A4, drawing a first directed edge starting from the new node, and using the value corresponding to the minimum value of the Gini coefficient in the discrete value range of the target attribute as the splitting value of the first directed edge; if there are remaining values in the discrete value range of the target attribute other than the splitting value of the first directed edge, then drawing a second directed edge starting from the new node, and using all remaining values as the splitting value of the second directed edge; A5, filtering all historical discrete monitoring data in the training set based on the splitting value of the target directed edge to obtain a training subset of the target directed edge. The target directed edge is either the first directed edge or the second directed edge, and the training set is the parent training set of the training subset; A6, if the Gini coefficient of the segmentation value of the target directed edge is 0, it means that all anomaly level labels in the training subset are the same, and the anomaly level label is used as the endpoint of the target directed edge; if at least one of the Gini coefficients of the segmentation value of the target directed edge is not 0, the training subset is used as a new training set and steps A1 to A3 are repeated to obtain new nodes, and the new nodes are used as the endpoints of the target directed edges; A7, all directed edges are traversed to obtain the endpoint of each directed edge. If the endpoints of all directed edges are anomaly level labels, the initial decision tree model is obtained; if at least one directed edge endpoint is a new node, steps A4 to A7 are executed for each new node until the initial decision tree model is obtained; A8, the initial decision tree model is pruned to obtain a decision tree model. The input of the decision tree model is discrete monitoring data, and the output is the anomaly level corresponding to the discrete monitoring data. Obtain real-time discrete monitoring data of the preset service, and obtain the anomaly level of the preset service based on the real-time discrete monitoring data and the decision tree model; Perform the switching measures corresponding to the anomaly level on the service traffic of the preset service to obtain the switching result.
2. The service traffic switching method based on artificial intelligence as described in claim 1, characterized in that, Before performing discretization processing on the historical monitoring data to obtain historical discrete monitoring data, the method further includes: Each monitoring attribute is classified based on its value range to obtain a classification result, which includes continuous attributes and discrete attributes. Obtain the value range of the target continuous attribute, where the target continuous attribute is any one of all continuous attributes; The value range is divided into a preset number of sub-ranges, and each sub-range includes at least one value; Assign an index label as a unique identifier to each subrange to obtain a discrete mapping relationship of the target continuous attribute, wherein the discrete mapping relationship includes at least a mapping pair between a subrange and an index label; Iterate through all continuous attributes to obtain the discrete mapping relationship for each continuous attribute.
3. The service traffic switching method based on artificial intelligence as described in claim 2, characterized in that, The process of discretizing the historical monitoring data to obtain historical discrete monitoring data includes: Obtain the attribute values of all continuous attributes in the target monitoring data, where the target monitoring data is any historical monitoring data. Based on the attribute values and discrete mapping relationship of the same continuous attribute, the index label corresponding to the attribute value is obtained, and the index label is used as the discrete value of the continuous attribute in the target monitoring data; The discrete value of each continuous attribute is obtained by examining all continuous attributes in the target monitoring data. The discrete values of all continuous attributes and the attribute values of all discrete attributes are used as the historical discrete monitoring data corresponding to the target monitoring data. Iterate through all historical monitoring data to obtain the historical discrete monitoring data corresponding to each historical monitoring data point.
4. The service traffic switching method based on artificial intelligence as described in claim 1, characterized in that, The Gini coefficients satisfy the following relationship: Where n represents the number of different anomaly levels in the anomaly level label. This represents the number of historical discrete monitoring data in the training set where the value of monitoring attribute P is j. This represents the number of historical discrete monitoring data with anomaly level label i in the training set, where the value of monitoring attribute P is j. The Gini coefficient is the value j within the discrete range of values of the monitored attribute P. The Gini coefficient satisfies the following relationship: in, The number of all values within the discrete range of monitored attribute P. This represents the number of historical discrete monitoring data in the training set where the value of monitoring attribute P is j. This indicates the number of historical discrete monitoring data in the training set; This represents the Gini coefficient for value j within the discrete range of values of the monitored attribute P. Let Gini coefficient be the value of the monitored attribute P.
5. The service traffic switching method based on artificial intelligence as described in claim 1, characterized in that, When there are two or more monitoring attributes corresponding to the minimum value of the Gini coefficient, the step of selecting the monitoring attribute corresponding to the minimum value of the Gini coefficient as the target attribute further includes: a. Select all monitoring attributes corresponding to the minimum value of the Gini coefficient as candidate attributes; b. Determine whether the training set has a parent training set; c. If the training set does not have a parent training set, then any one of the candidate attributes shall be used as the target attribute. d. If the training set has a parent training set, calculate the Gini coefficient of each of the candidate attributes in the parent training set and obtain the minimum value of all Gini coefficients. If the minimum value corresponds to a candidate attribute, use the candidate attribute as the target attribute. If the minimum value corresponds to two or more candidate attributes, use the parent training set as a new training set and repeat steps b to d until the target attribute is obtained.
6. The service traffic switching method based on artificial intelligence as described in claim 1, characterized in that, The step of acquiring real-time discrete monitoring data of the preset service and obtaining the anomaly level of the preset service based on the real-time discrete monitoring data and the decision tree model includes: Collect real-time monitoring data of the preset service within the current unit time, and discretize the real-time monitoring data to obtain real-time discrete monitoring data; The real-time discrete monitoring data is input into the decision tree model to obtain the initial anomaly level for the current unit of time; Obtain the initial anomaly level for a consecutive preset number of unit time periods. When all initial anomaly levels are the same, the initial anomaly level is taken as the anomaly level of the preset service.
7. A service traffic switching device based on artificial intelligence, characterized in that, The apparatus includes a module that implements the AI-based service traffic switching method as described in any one of claims 1 to 6, and the apparatus includes: A discretization unit is used to collect multiple historical monitoring data of a preset service within a historical period, and to discretize the historical monitoring data to obtain historical discrete monitoring data, wherein the historical monitoring data includes at least one monitoring attribute. A storage unit is used to store the historical discrete monitoring data and the anomaly level label of each historical discrete monitoring data as a training set. A building unit is used to build a decision tree model based on the training set; An anomaly detection unit is used to acquire real-time discrete monitoring data of the preset service, and to obtain the anomaly level of the preset service based on the real-time discrete monitoring data and the decision tree model. The switching unit is used to perform switching measures corresponding to the anomaly level on the service traffic of the preset service to obtain the switching result.
8. An electronic device, characterized in that, The electronic device includes: Memory, which stores computer-readable instructions; and The processor executes computer-readable instructions stored in the memory to implement the AI-based service traffic switching method as described in any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-readable instructions, which, when executed by a processor, implement the AI-based service traffic switching method as described in any one of claims 1 to 6.