CN115562934A - Service flow switching method based on artificial intelligence and related equipment - Google Patents

Service flow switching method based on artificial intelligence and related equipment Download PDF

Info

Publication number
CN115562934A
CN115562934A CN202211152305.5A CN202211152305A CN115562934A CN 115562934 A CN115562934 A CN 115562934A CN 202211152305 A CN202211152305 A CN 202211152305A CN 115562934 A CN115562934 A CN 115562934A
Authority
CN
China
Prior art keywords
monitoring data
attribute
discrete
historical
monitoring
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211152305.5A
Other languages
Chinese (zh)
Inventor
钱学广
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Property and Casualty Insurance Company of China Ltd
Original Assignee
Ping An Property and Casualty Insurance Company of China Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Property and Casualty Insurance Company of China Ltd filed Critical Ping An Property and Casualty Insurance Company of China Ltd
Priority to CN202211152305.5A priority Critical patent/CN115562934A/en
Publication of CN115562934A publication Critical patent/CN115562934A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3065Monitoring arrangements determined by the means or processing involved in reporting the monitored data
    • G06F11/3072Monitoring arrangements determined by the means or processing involved in reporting the monitored data where the reporting involves data filtering, e.g. pattern matching, time or event triggered, adaptive or policy-based reporting

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The application provides a service flow switching method and device based on artificial intelligence, an electronic device and a storage medium, wherein the service flow switching method based on artificial intelligence comprises the following steps: acquiring a plurality of pieces of historical monitoring data of preset services in historical time, and discretizing the historical monitoring data to obtain historical discrete monitoring data, wherein the historical monitoring data comprises at least one monitoring attribute; storing the historical discrete monitoring data and the abnormal grade label of each piece of historical discrete monitoring data to serve as a training set; building a decision tree model based on the training set; acquiring real-time discrete monitoring data of the preset service, and obtaining the abnormal grade of the preset service based on the real-time discrete monitoring data and the decision tree model; and executing the switching measure corresponding to the abnormal grade on the service flow of the preset service to obtain a switching result. The method and the device realize automatic switching of the service flow and improve switching precision of the service flow.

Description

Service flow switching method based on artificial intelligence and related equipment
Technical Field
The present application relates to the field of artificial intelligence technologies, and in particular, to a method and an apparatus for switching traffic based on artificial intelligence, an electronic device, and a storage medium.
Background
The information technology is widely applied to various scenes such as insurance, banks, e-commerce and the like to realize different business functions. In application systems in different scenes, in order to ensure the stability and high availability of the application systems, multiple sets of standby environments such as the same city, remote places, disaster tolerance and the like need to be built. When the service flow in the application system is too large to exceed the load which can be borne by the service operation environment or the service operation environment is abnormal, the service flow is switched to other standby environments to ensure the normal operation of the service in the application system.
At present, related data of service traffic is often monitored, and a monitoring result is compared with a preset warning threshold value to serve as a triggering mode of service traffic switching.
Disclosure of Invention
In view of the foregoing, it is necessary to provide a service traffic switching method based on artificial intelligence and related devices, so as to solve the technical problem of how to improve the switching accuracy of service traffic, where the related devices include a service traffic switching apparatus based on artificial intelligence, an electronic device, and a storage medium.
The application provides a service flow switching method based on artificial intelligence, which comprises the following steps:
acquiring a plurality of pieces of historical monitoring data of preset services in historical time, and performing discretization processing on the historical monitoring data to obtain historical discrete monitoring data, wherein the historical monitoring data comprises at least one monitoring attribute;
storing the historical discrete monitoring data and the abnormal grade label of each piece of historical discrete monitoring data to serve as a training set;
building a decision tree model based on the training set;
acquiring real-time discrete monitoring data of the preset service, and obtaining the abnormal grade of the preset service based on the real-time discrete monitoring data and the decision tree model;
and executing the switching measure corresponding to the abnormal grade on the service flow of the preset service to obtain a switching result.
In some embodiments, before the discretizing the historical monitoring data to obtain the historical discrete monitoring data, the method further includes:
classifying each monitoring attribute based on the value range of the monitoring attribute to obtain a classification result, wherein the classification result comprises a continuous attribute and a discrete attribute;
acquiring a value range of a target continuous type attribute, wherein the target continuous type attribute is any one of all continuous type attributes;
dividing the value range into a preset number of sub-ranges, wherein the sub-ranges comprise at least one value;
allocating an index tag as a unique identifier for each sub-range to obtain a discrete mapping relation of the target continuous type attribute, wherein the discrete mapping relation at least comprises a mapping pair of the sub-range and the index tag;
and traversing all the continuous type attributes to obtain the discrete mapping relation of each continuous type attribute.
In some embodiments, the discretizing the historical monitoring data to obtain historical discretizing monitoring data includes:
acquiring attribute values of all continuous attributes in target monitoring data, wherein the target monitoring data is any piece of historical monitoring data;
acquiring an index tag corresponding to the attribute value based on the attribute value and the discrete mapping relation of the same continuous attribute, and taking the index tag as the discrete value of the continuous attribute in the target monitoring data;
obtaining a discrete value of each continuous type attribute through all continuous type attributes in the target monitoring data;
taking the discrete values of all continuous attributes and the attribute values of all discrete attributes as historical discrete monitoring data corresponding to the target monitoring data;
and traversing all historical monitoring data to obtain historical discrete monitoring data corresponding to each piece of historical monitoring data.
In some embodiments, said building a decision tree model based on said training set comprises:
a1, counting all different values of the same monitoring attribute in the training set to obtain a discrete value range of each monitoring attribute;
a2, calculating the kini sub-coefficient of each value in all discrete value ranges based on the training set, and calculating the kini coefficient of each monitoring attribute based on the kini sub-coefficients of all values in the same discrete value range;
a3, selecting a monitoring attribute corresponding to the minimum value of the kini coefficient as a target attribute, and taking the target attribute as node information to obtain a newly added node;
a4, drawing a first directed edge by taking the newly added node as a starting point, and taking a value corresponding to the minimum value of the kini coefficient in the discrete value range of the target attribute as a tangent value of the first directed edge; if the residual values except for the split value of the first directed edge exist in the discrete value range of the target attribute, drawing a second directed edge by taking the newly added node as a starting point, and taking all the residual values as the split value of the second directed edge;
a5, screening all historical discrete monitoring data in the training set based on the segmentation value of the target directed edge to obtain a training subset of the target directed edge, wherein the target directed edge is any one of the first directed edge and the second directed edge, and the training set is a parent training set of the training subset;
a6, if the number of the kini subsystems of the segmentation values of the target directed edge is 0, all the abnormal grade labels in the training subset are the same, and the abnormal grade labels are used as the end points of the target directed edge; if at least one of the kinson coefficients of the segmentation value of the target directed edge is not 0, repeating the steps A1 to A3 by taking the training subset as a new training set to obtain a new node, and taking the new node as the terminal point of the target directed edge;
a7, traversing all the directed edges to obtain the end point of each directed edge, and if the end points of all the directed edges are all abnormal grade labels, obtaining an initial decision tree model; if the end point of at least one directed edge is a newly added node, executing the steps A4 to A7 aiming at each newly added node until an initial decision tree model is obtained;
and A8, pruning the initial decision tree model to obtain a decision tree model, wherein the input of the decision tree model is discrete monitoring data, and the output of the decision tree model is the abnormal level corresponding to the discrete monitoring data.
In some embodiments, the number of kini subsystems satisfies the relationship:
Figure BDA0003856901660000031
wherein n represents the number of different exception levels in the exception level tag,
Figure BDA0003856901660000032
representing the quantity of historical discrete monitoring data with j of the value of the monitoring attribute P in the training set;
Figure BDA0003856901660000033
representing the number of abnormal grade labels i in the historical discrete monitoring data with j of the value of the monitoring attribute P in the training set; gini (P | P = j) is a kini coefficient of a value j in a discrete value range of the monitoring attribute P;
the kini coefficient satisfies the relation:
Figure BDA0003856901660000034
wherein N (P) is the number of all values in the discrete value range of the monitoring attribute P,
Figure BDA0003856901660000035
representing the quantity of historical discrete monitoring data with j of the value of the monitoring attribute P in the training set; sigma Num represents the number of historical discrete monitoring data in the training set; gini (P | P = j) represents a kini coefficient of a value j in a discrete value range of the monitoring property P, and Gibi (P) is a kini coefficient of the monitoring property P.
In some embodiments, when the number of the monitoring attributes corresponding to the minimum value of the kini coefficients is two or more, the selecting the monitoring attribute corresponding to the minimum value of the kini coefficients as the target attribute further includes:
a, taking all monitoring attributes corresponding to the minimum value of the kini coefficient as alternative attributes;
b, judging whether the training set has a father training set;
c, if the training set does not have a parent training set, taking any one of the alternative attributes as a target attribute;
d, if the training set has a father training set, calculating the kini coefficient of each alternative attribute in the father training set and obtaining the minimum value of all the kini coefficients, if the minimum value corresponds to one alternative attribute, taking the alternative attribute as a target attribute, if the minimum value corresponds to two or more alternative attributes, taking the father training set as a new training set, and repeatedly executing the steps b to d until the target attribute is obtained.
In some embodiments, the obtaining real-time discrete monitoring data of the preset service and obtaining the abnormal level of the preset service based on the real-time discrete monitoring data and the decision tree model includes:
collecting real-time monitoring data of the preset service in current unit time, and performing discretization processing on the real-time monitoring data to obtain real-time discrete monitoring data;
inputting the real-time discrete monitoring data into the decision tree model to obtain the initial abnormal level of the current unit time;
and acquiring initial abnormal levels of a preset number of continuous unit time, and taking the initial abnormal levels as the abnormal levels of the preset service when all the initial abnormal levels are the same.
The embodiment of the present application further provides a device for switching service traffic based on artificial intelligence, where the device includes:
the system comprises a discretization unit, a service monitoring unit and a service monitoring unit, wherein the discretization unit is used for acquiring a plurality of historical monitoring data of preset services in historical time, and performing discretization processing on the historical monitoring data to obtain historical discretization monitoring data, and the historical monitoring data comprises at least one monitoring attribute;
the storage unit is used for storing the historical discrete monitoring data and the abnormal grade label of each piece of historical discrete monitoring data to be used as a training set;
the building unit is used for building a decision tree model based on the training set;
the anomaly detection unit is used for acquiring real-time discrete monitoring data of the preset service and obtaining the anomaly grade of the preset service based on the real-time discrete monitoring data and the decision tree model;
and the switching unit is used for executing the switching measures corresponding to the abnormal levels on the service flow of the preset service so as to obtain a switching result.
An embodiment of the present application further provides an electronic device, where the electronic device includes:
a memory storing at least one instruction;
and the processor executes the instructions stored in the memory to realize the artificial intelligence based service flow switching method.
The embodiment of the present application further provides a computer-readable storage medium, where at least one instruction is stored in the computer-readable storage medium, and the at least one instruction is executed by a processor in an electronic device to implement the artificial intelligence based service traffic switching method.
In summary, in the present application, all monitoring data of the preset service are discretized to obtain discrete monitoring data, an accurate abnormal level of the preset service is obtained based on the decision tree model and the discrete monitoring data, and a switching measure corresponding to the abnormal level is performed on the service traffic of the preset service to obtain a switching result, so that automatic switching of the service traffic is realized, and the switching precision of the service traffic is improved.
Drawings
Fig. 1 is a flow chart of a preferred embodiment of the artificial intelligence based service traffic switching method according to the present application.
Fig. 2 is a schematic structural diagram of a decision tree model to which the present application relates.
Fig. 3 is a flow chart illustrating a service traffic switching according to the present application.
Fig. 4 is a functional block diagram of a preferred embodiment of an artificial intelligence based traffic switching apparatus to which the present application relates.
Fig. 5 is a schematic structural diagram of an electronic device according to a preferred embodiment of the artificial intelligence-based service traffic switching method according to the present application.
Detailed Description
For a clearer understanding of the objects, features and advantages of the present application, reference is made to the following detailed description of the present application along with the accompanying drawings and specific examples. It should be noted that the embodiments and features of the embodiments of the present application may be combined with each other without conflict. In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present application, and the described embodiments are merely some, but not all embodiments of the present application.
Furthermore, the terms "first", "second" and "first" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, features defined as "first" and "second" may explicitly or implicitly include one or more of the described features. In the description of the present application, "a plurality" means two or more unless specifically limited otherwise.
Unless defined otherwise, 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 in the description of the present application herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. As used herein, the term "and/or" includes any and all combinations of one or more of the associated listed items.
The embodiment of the present Application provides a service flow switching method based on artificial intelligence, which may be applied to one or more electronic devices, where an electronic device is a device capable of automatically performing numerical calculation and/or information processing according to a preset or stored instruction, and hardware of the electronic device includes, but is not limited to, a microprocessor, an Application Specific Integrated Circuit (ASIC), a Programmable Gate Array (FPGA), a Digital Signal Processor (DSP), an embedded device, and the like.
The electronic device may be any electronic product capable of performing human-computer interaction with a client, for example, a Personal computer, a tablet computer, a smart phone, a Personal Digital Assistant (PDA), a game machine, an Internet Protocol Television (IPTV), an intelligent wearable device, and the like.
The electronic device may also include a network device and/or a client device. The network device includes, but is not limited to, a single network server, a server group consisting of a plurality of network servers, or a Cloud Computing (Cloud Computing) based Cloud consisting of a large number of hosts or network servers.
The Network where the electronic device is located includes, but is not limited to, the internet, a wide area Network, a metropolitan area Network, a local area Network, a Virtual Private Network (VPN), and the like.
Fig. 1 is a flow chart of a preferred embodiment of the service traffic switching method based on artificial intelligence according to the present application. The order of the steps in the flow chart may be changed and some steps may be omitted according to different needs.
The service flow switching method based on artificial intelligence provided by the embodiment of the application can be applied to application systems in various scenes such as insurance, banks, e-commerce and the like, and the method can be applied to products in the scenes.
S10, collecting a plurality of pieces of historical monitoring data of preset services in historical time, and discretizing the historical monitoring data to obtain historical discrete monitoring data, wherein the historical monitoring data comprises at least one monitoring attribute.
In an optional embodiment, the preset service is a service 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; and when the preset application system is an electronic transaction system, the preset service is an electronic payment service.
In this optional embodiment, the historical monitoring data is monitoring data related to a preset service, which is collected in any unit time in the historical time, the monitoring data includes multiple monitoring attributes, and the monitoring data may reflect an operation condition of the preset service in a service operation environment. Wherein the unit time may be 1 minute. Illustratively, the monitoring data includes four monitoring attributes of a service request volume, an average response time, an abnormal request volume and a system level collected in a unit time, that is, one piece of historical monitoring data includes four monitoring attributes and attribute values thereof.
In an optional implementation, before discretizing the historical monitoring data to obtain historical discrete monitoring data, the method further includes:
classifying each monitoring attribute based on the value range of the monitoring attribute to obtain a classification result, wherein the classification result comprises a continuous attribute and a discrete attribute;
acquiring a value range of a target continuous type attribute, wherein the target continuous type attribute is any one of all continuous type attributes;
dividing the value range into a preset number of sub-ranges, wherein the sub-ranges comprise at least one value;
allocating an index tag as a unique identifier for each sub-range to obtain a discrete mapping relation of the target continuous type attribute, wherein the discrete mapping relation at least comprises a mapping pair of the sub-range and the index tag;
and traversing all the continuous type attributes to obtain the discrete mapping relation of each continuous type attribute.
The index tag may be integer data or character data, and the application is not limited; each continuous attribute corresponds to a discrete mapping relationship.
In this optional embodiment, the classifying each monitoring attribute based on the value range of the monitoring attribute to obtain a classification result includes:
if the value range of the monitoring attribute is continuous, the monitoring attribute is a continuous attribute;
and if the value range of the monitoring attribute is discrete, the monitoring attribute is a discrete attribute.
For example, it is assumed that the monitoring data includes four monitoring attributes, i.e., a service request amount collected in a unit time, an average response time, an abnormal request amount, and a system level. For the service request volume and the system level in the monitoring data, the value range of the system level is { "first level", "second level", or "third level", and the value range of the service request volume is not less than 0, so the system level is a discrete attribute, and the service request volume is a continuous attribute. Aiming at the service request volume, dividing the value range of the service request volume into three sub-ranges: the first sub-range is [0, 2000), the corresponding index tags are small; the second sub-range is [2000, 5000), and the corresponding index tag is general; the third sub-range is [5000, + ∞ ]), and the corresponding index tag is frequent; then "[0, 2000), a small amount", "[2000, 5000), generally" and "[5000, + ∞)", frequently "mapping pairs of three sub-ranges and index tags are obtained as discrete mapping relationships of the service request amount.
In an optional embodiment, the discretizing the historical monitoring data to obtain the historical discrete monitoring data includes:
acquiring attribute values of all continuous attributes in target monitoring data, wherein the target monitoring data is any piece of historical monitoring data;
acquiring an index tag corresponding to the attribute value based on the attribute value and the discrete mapping relation of the same continuous attribute, and taking the index tag as the discrete value of the continuous attribute in the target monitoring data;
obtaining a discrete value of each continuous type attribute through all continuous type attributes in the target monitoring data;
taking the discrete values of all continuous attributes and the attribute values of all discrete attributes as historical discrete monitoring data corresponding to the target monitoring data;
and traversing all historical monitoring data to obtain historical discrete monitoring data corresponding to each piece of historical monitoring data.
In this optional embodiment, a discrete mapping relationship and an attribute value of the same continuity attribute are obtained for all continuity attributes in the target monitoring data, where the discrete mapping relationship includes at least one mapping pair of a sub-range and an index tag, a sub-range where the attribute value is located is determined, an index tag corresponding to the sub-range is obtained based on the mapping pair in the discrete mapping relationship, and then the index tag is used as a discrete value of the continuity attribute.
Therefore, a plurality of historical discrete monitoring data are obtained, and a data basis is provided for building a decision tree model.
S11, storing the historical discrete monitoring data and the abnormal grade label of each piece of historical discrete monitoring data to serve as a training set.
In an optional embodiment, an exception level tag of each piece of historical discrete monitoring data is obtained, where the exception level tag of the historical discrete monitoring data indicates an exception degree of a service operating environment under the historical discrete monitoring data, and the obtaining method of the exception level tag is artificially labeled. The number of the abnormal levels is at least two, and the specific number is not limited in the application.
Illustratively, when the number of the exception levels is 2, the exception levels are 0 and 1, where 0 represents that the service operation environment is normal, and 1 represents that the service operation environment is abnormal; when the number of the abnormal levels is 3, the abnormal levels are 0, 1 and 2, wherein 0 represents that the service operation environment is normal, and the larger the numerical value is, the larger the abnormal degree of the service operation environment is.
In this alternative embodiment, all the historical discrete monitoring data and the abnormal level label of each piece of historical discrete monitoring data are stored to obtain a training set.
Therefore, the abnormal grade label of each historical discrete monitoring data is obtained through a manual labeling method, and a training set is obtained and used for training the decision tree model.
And S12, building a decision tree model based on the training set.
In an optional embodiment, the building a decision tree model based on the training set includes:
a1, counting all different values of the same monitoring attribute in the training set to obtain a discrete value range of each monitoring attribute;
a2, calculating the kini sub-coefficient of each value in all discrete value ranges based on the training set, and calculating the kini coefficient of each monitoring attribute based on the kini sub-coefficients of all values in the same discrete value range;
in this alternative embodiment, the number of kini subsystems satisfies the relationship:
Figure BDA0003856901660000071
wherein n represents the number of different exception levels in the exception level label,
Figure BDA0003856901660000072
representing the quantity of historical discrete monitoring data with j of the value of the monitoring attribute P in the training set;
Figure BDA0003856901660000073
representing the number of abnormal grade labels i in the historical discrete monitoring data with j of the value of the monitoring attribute P in the training set; gini (P | P = j) is the kini coefficient for the value j in the discrete value range of the monitored property P.
It should be noted that the number of the kini subsystems reflects the degree of interference of the value of the monitoring attribute on the abnormal level detection, and the larger the number of the kini subsystems is, the larger the degree of interference of the value of the monitoring attribute on the abnormal level detection is, and the less effective information is provided in the abnormal level detection process; when the value of the monitoring attribute is 0, it indicates that an accurate abnormal level can be obtained according to the value of the monitoring attribute.
In this alternative embodiment, the kini coefficient satisfies the relationship:
Figure BDA0003856901660000074
wherein N (P) is the number of all values in the discrete value range of the monitoring attribute P,
Figure BDA0003856901660000081
representing the quantity of historical discrete monitoring data with j of the value of the monitoring attribute P in the training set; sigma Num represents the number of historical discrete monitoring data in the training set; gini (P | P = j) represents a kini coefficient of a value j in a discrete value range of the monitoring property P, and Gibi (P) is a kini coefficient of the monitoring property P.
It should be noted that the kini coefficient reflects the degree of interference of the monitoring attribute on the abnormal level detection, and a larger kini coefficient indicates a larger degree of interference of the monitoring attribute on the abnormal level detection, and provides less effective information in the abnormal level detection process, and when a monitoring attribute kini coefficient is 0, indicates that an accurate abnormal level can be obtained according to the monitoring attribute.
A3, selecting a monitoring attribute corresponding to the minimum value of the kini coefficient as a target attribute, and taking the target attribute as node information to obtain a newly added node;
a4, drawing a first directed edge by taking the newly added node as a starting point, and taking a value corresponding to the minimum value of the kini coefficient in the discrete value range of the target attribute as a tangent value of the first directed edge; if the residual values except for the split value of the first directed edge exist in the discrete value range of the target attribute, drawing a second directed edge by taking the newly added node as a starting point, and taking all the residual values as the split value of the second directed edge;
in this optional embodiment, when the values corresponding to the minimum value of the kini coefficient in the discrete value range of the target attribute are two or more, all the values are taken as the cut values of the first directed edge, that is, the cut values of the first directed edge may be one or more. It should be noted that the cut value of the second directed edge may also be one or more.
Exemplarily, it is assumed that the discrete value range of the target attribute has 4 values, which are respectively marked as a, B, C, and D, and the kini coefficients corresponding to the 4 values are 0.48, 0.365, 0.5, and 0.365 in sequence; the tangent values of the first directed edge are B and D, and the tangent values of the second directed edge are a and C.
A5, screening all historical discrete monitoring data in the training set based on the segmentation value of the target directed edge to obtain a training subset of the target directed edge, wherein the target directed edge is any one of the first directed edge and the second directed edge, and the training set is a parent training set of the training subset;
in this optional embodiment, the number of the tangent values of the target directional edge is one or more, and in the training set, all the historical discrete monitoring data of which the value of the target attribute is equal to any one tangent value of the target directional edge are used as the training subset of the target directional edge.
A6, if the number of the kini subsystems of the segmentation values of the target directed edge is 0, indicating that all abnormal grade labels in the training subset are the same, and taking the abnormal grade labels as the end points of the target directed edge; if at least one of the kinson coefficients of the segmentation value of the target directed edge is not 0, repeating the steps A1 to A3 by taking the training subset as a new training set to obtain a new node, and taking the new node as the terminal point of the target directed edge;
a7, traversing all the directed edges to obtain the end point of each directed edge, and if the end points of all the directed edges are all abnormal grade labels, obtaining an initial decision tree model; if the end point of at least one directed edge is a newly added node, executing the steps A4 to A7 aiming at each newly added node until an initial decision tree model is obtained;
and A8, pruning the initial decision tree model to obtain a decision tree model, wherein the input of the decision tree model is discrete monitoring data, and the output of the decision tree model is an abnormal grade corresponding to the discrete monitoring data.
In the optional embodiment, abnormal distortion data and small probability data may exist in the training set, and an abnormal node may be introduced into the initial decision tree model, so that accuracy of an output result of the decision tree model is reduced.
Taking a training set with the number of monitoring attributes being 4 and the number of anomaly levels being 3 as an example, a structural diagram of the decision tree model is shown in fig. 2. In fig. 2, the value range of the target attribute 1 includes four values, i.e., A1, B1, C1, and D1; the value range of the target attribute 2 comprises three values of A2, B2 and C2; the value range of the target attribute 3 comprises two values of A3 and B3; the value range of the target attribute 4 includes two values of A4 and B4.
In an optional embodiment, for the step A3, when the number of the monitoring attributes corresponding to the minimum value of the kini coefficients is two or more, the selecting the monitoring attribute corresponding to the minimum value of the kini coefficients as the target attribute further includes:
a, taking all monitoring attributes corresponding to the minimum value of the kini coefficient as alternative attributes;
b, judging whether the training set has a father training set;
c, if the training set does not have a father training set, taking any one of the alternative attributes as a target attribute;
d, if the training set has a father training set, calculating the kini coefficient of each alternative attribute in the father training set and obtaining the minimum value of all the kini coefficients, if the minimum value corresponds to one alternative attribute, taking the alternative attribute as a target attribute, if the minimum value corresponds to two or more alternative attributes, taking the father training set as a new training set, and repeatedly executing the steps b to d until the target attribute is obtained.
Exemplarily, the number of the candidate attributes is assumed to be 3, which are respectively the average response time, the abnormal request amount and the system level, and a parent training set exists; calculating the average response time, the abnormal request amount and the kini coefficient of the system level in the father training set respectively, wherein the keny coefficients are 0.216, 0.216 and 0.2; and acquiring the minimum value of all the Gini coefficients as 0.2, wherein the minimum value only corresponds to one alternative attribute of 'system level', and taking the system level as a target attribute.
Therefore, the decision tree model is built based on the training set, and the decision tree model can obtain accurate abnormal levels.
S13, acquiring real-time discrete monitoring data of the preset service, and obtaining the abnormal grade of the preset service based on the real-time discrete monitoring data and the decision tree model.
In an optional embodiment, after the decision tree model is built, the decision tree model may be used to detect the operation state of the preset service in a service operation environment, so as to obtain the abnormal level of the preset service.
In an optional embodiment, the obtaining real-time discrete monitoring data of the preset service, and obtaining an exception level of the preset service based on the real-time discrete monitoring data and the decision tree model includes:
collecting real-time monitoring data of the preset service in current unit time, and performing discretization processing on the real-time monitoring data to obtain real-time discrete monitoring data;
inputting the real-time discrete monitoring data into the decision tree model to obtain the initial abnormal level of the current unit time;
and acquiring initial abnormal levels of a preset number of continuous unit time, and taking the initial abnormal levels as the abnormal levels of the preset service when all the initial abnormal levels are the same.
Preferably, the preset number is 3.
Therefore, the running state of the preset service in the service running environment is monitored to obtain the initial abnormal level of each unit time, and when the initial abnormal levels in a plurality of continuous unit times are the same, the abnormal level of the preset service is obtained, so that the accuracy of the abnormal level of the preset service is ensured.
And S14, executing the switching measure corresponding to the abnormal grade on the service flow of the preset service to obtain a switching result.
In an optional embodiment, each exception level corresponds to a switching measure, so that all or part of the service traffic of the preset service is switched to a standby environment according to the exception level, and the normal operation of the preset service is ensured.
Illustratively, when the number of the exception levels is 2, the exception levels are 0 and 1, and an exception level of 0 indicates that the service operating environment is normal, the corresponding switching measure is to not switch the service traffic; and if the exception grade is 1, the service operation environment is abnormal, and the corresponding switching measure is to switch the service flow to the standby environment.
In another example, when the number of the exception levels is 3, the exception levels are 0, 1 and 2, and a larger value of the exception level indicates a larger degree of exception of the service operation environment; the switching measure corresponding to the abnormal level 0 is that the service flow is not switched; the switching measure corresponding to the abnormal level 1 is to switch 50% of the service flow to a standby environment; the switching measure corresponding to the abnormal level 2 is to switch all the service flows to the standby environment.
Please refer to fig. 3, which is a schematic flow chart of the service traffic switching according to the present application. In this optional embodiment, after the switching measure corresponding to the abnormal level is obtained, the switching measure is executed on the service traffic of the preset service. Firstly, extracting interface information such as domain names, IP (Internet protocol) and the like of at least one standby environment; and further switching the service flow into a standby environment based on the interface information and the switching measure to obtain a switching result.
Therefore, corresponding switching measures are executed on the service flow of the preset service according to different abnormal levels, automatic switching of the service flow is achieved, and normal operation of the preset service is guaranteed.
According to the technical scheme, all monitoring data of the preset service are discretized to obtain discrete monitoring data, the accurate abnormal grade of the preset service is obtained based on the decision tree model and the discrete monitoring data, the switching measure corresponding to the abnormal grade is executed on the service flow of the preset service to obtain the switching result, automatic switching of the service flow is achieved, and the switching precision of the service flow is improved.
Referring to fig. 4, fig. 4 is a functional block diagram of a preferred embodiment of the artificial intelligence based traffic switching apparatus according to the present invention. The artificial intelligence based service traffic switching device 11 includes a discretization unit 110, a storage unit 111, a construction unit 112, an abnormality detection unit 113, and a switching unit 114. A module/unit as referred to herein is a series of computer readable instruction segments capable of being executed by the processor 13 and performing a fixed function, and is stored in the memory 12. In the present embodiment, the functions of the modules/units will be described in detail in the following embodiments.
In an optional embodiment, the discretization unit 110 is configured to collect multiple pieces of historical monitoring data of a preset service in a historical time, perform discretization on the historical monitoring data to obtain historical discrete monitoring data, where the historical monitoring data includes at least one monitoring attribute.
In an optional embodiment, the preset service is a service 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; and when the preset application system is an electronic transaction system, the preset service is an electronic payment service.
In this optional embodiment, the historical monitoring data is monitoring data related to a preset service, which is collected in any unit time in the historical time, the monitoring data includes multiple monitoring attributes, and the monitoring data may reflect an operation condition of the preset service in a service operation environment. Wherein the unit time may be 1 minute. Illustratively, the monitoring data includes four monitoring attributes of a service request volume, an average response time, an abnormal request volume and a system level collected in a unit time, that is, one piece of historical monitoring data includes four monitoring attributes and attribute values thereof.
In an optional implementation, before the discretizing the historical monitoring data to obtain the historical discrete monitoring data, the method further includes:
classifying each monitoring attribute based on the value range of the monitoring attribute to obtain a classification result, wherein the classification result comprises a continuous attribute and a discrete attribute;
acquiring a value range of a target continuous attribute, wherein the target continuous attribute is any one of all continuous attributes;
dividing the value range into a preset number of sub-ranges, wherein each sub-range comprises at least one value;
allocating an index tag as a unique identifier for each sub-range to obtain a discrete mapping relation of the target continuous type attribute, wherein the discrete mapping relation at least comprises a mapping pair of the sub-range and the index tag;
and traversing all the continuous type attributes to obtain the discrete mapping relation of each continuous type attribute.
The index tag may be integer data or character data, and the application is not limited; each continuous type attribute corresponds to a discrete mapping relation.
In this optional embodiment, the classifying each monitoring attribute based on the value range of the monitoring attribute to obtain a classification result includes:
if the value range of the monitoring attribute is continuous, the monitoring attribute is a continuous attribute;
and if the value range of the monitoring attribute is discrete, the monitoring attribute is a discrete attribute.
In an optional embodiment, the discretizing the historical monitoring data to obtain the historical discrete monitoring data includes:
acquiring attribute values of all continuous attributes in target monitoring data, wherein the target monitoring data is any piece of historical monitoring data;
acquiring an index tag corresponding to the attribute value based on the attribute value and the discrete mapping relation of the same continuous attribute, and taking the index tag as the discrete value of the continuous attribute in the target monitoring data;
obtaining a discrete value of each continuous type attribute through all continuous type attributes in the target monitoring data;
taking the discrete values of all continuous attributes and the attribute values of all discrete attributes as historical discrete monitoring data corresponding to the target monitoring data;
and traversing all historical monitoring data to obtain historical discrete monitoring data corresponding to each piece of historical monitoring data.
In this optional embodiment, a discrete mapping relationship and an attribute value of the same continuity attribute are obtained for all continuity attributes in the target monitoring data, where the discrete mapping relationship includes at least one mapping pair of a sub-range and an index tag, a sub-range where the attribute value is located is determined, an index tag corresponding to the sub-range is obtained based on the mapping pair in the discrete mapping relationship, and then the index tag is used as a discrete value of the continuity attribute.
In an alternative embodiment, the storage unit 111 is configured to store the historical discrete monitoring data and the anomaly level label of each piece of historical discrete monitoring data as a training set.
In an optional embodiment, an abnormal level label of each piece of historical discrete monitoring data is obtained, the abnormal level label of the historical discrete monitoring data indicates the abnormal degree of the service operating environment under the historical discrete monitoring data, and the obtaining method of the abnormal level label is artificially marked. The number of the abnormal levels is at least two, and the specific number is not limited in the application.
In this optional embodiment, all the historical discrete monitoring data and the abnormal level label of each piece of historical discrete monitoring data are stored to obtain a training set.
In an alternative embodiment, the building unit 112 is configured to build a decision tree model based on the training set.
In an optional embodiment, the building a decision tree model based on the training set includes:
a1, counting all different values of the same monitoring attribute in the training set to obtain a discrete value range of each monitoring attribute;
a2, calculating the kini sub-coefficient of each value in all discrete value ranges based on the training set, and calculating the kini coefficient of each monitoring attribute based on the kini sub-coefficients of all values in the same discrete value range;
in this alternative embodiment, the number of kini subsystems satisfies the relationship:
Figure BDA0003856901660000123
wherein n represents the number of different exception levels in the exception level tag,
Figure BDA0003856901660000124
representing the quantity of historical discrete monitoring data with j of the value of the monitoring attribute P in the training set;
Figure BDA0003856901660000125
representing the number of abnormal grade labels i in the historical discrete monitoring data with j of the value of the monitoring attribute P in the training set; gini (P | P = j) is the kini coefficient for the value j in the discrete value range of the monitored property P.
It should be noted that the number of the kini subsystems reflects the degree of interference of the value of the monitoring attribute on the abnormal level detection, and the larger the number of the kini subsystems is, the larger the degree of interference of the value of the monitoring attribute on the abnormal level detection is, and the less effective information is provided in the abnormal level detection process; when the value of the monitoring attribute is 0, it indicates that an accurate abnormal level can be obtained according to the value of the monitoring attribute.
In this alternative embodiment, the kini coefficient satisfies the relationship:
Figure BDA0003856901660000121
wherein N (P) is all the values in the discrete value range of the monitoring attribute P,
Figure BDA0003856901660000122
representing the quantity of historical discrete monitoring data with j of the value of the monitoring attribute P in the training set; sigma Num represents the number of historical discrete monitoring data in the training set; gini (P | P = j) represents a kini coefficient of a value j in a discrete value range of the monitoring property P, and Gini (P) is a kini coefficient of the monitoring property P.
It should be noted that the degree of interference of the monitoring attribute on the abnormal level detection is reflected by the kini coefficient, the larger the kini coefficient is, the larger the degree of interference of the monitoring attribute on the abnormal level detection is, the less effective information is provided in the abnormal level detection process, and when the kini coefficient of one monitoring attribute is 0, the more accurate abnormal level can be obtained according to the monitoring attribute.
A3, selecting a monitoring attribute corresponding to the minimum value of the kini coefficient as a target attribute, and taking the target attribute as node information to obtain a newly added node;
a4, drawing a first directed edge by taking the newly added node as a starting point, and taking a value corresponding to the minimum value of the kini coefficient in the discrete value range of the target attribute as a tangent value of the first directed edge; if the residual values except for the split value of the first directed edge exist in the discrete value range of the target attribute, drawing a second directed edge by taking the newly added node as a starting point, and taking all the residual values as the split value of the second directed edge;
in this optional embodiment, when the values corresponding to the minimum value of the kinson coefficient in the discrete value range of the target attribute are two or more, all the values are used as the cut values of the first directed edge, that is, the cut values of the first directed edge may be one or more. It should be noted that the cut value of the second directed edge may also be one or more.
Exemplarily, it is assumed that the discrete value range of the target attribute has 4 values, which are respectively marked as a, B, C, and D, and the kini coefficients corresponding to the 4 values are 0.48, 0.365, 0.5, and 0.365 in sequence; the tangent values of the first directed edge are B and D, and the tangent values of the second directed edge are a and C.
A5, screening all historical discrete monitoring data in the training set based on the segmentation value of the target directed edge to obtain a training subset of the target directed edge, wherein the target directed edge is any one of the first directed edge and the second directed edge, and the training set is a father training set of the training subset;
in this optional embodiment, the tangent values of the target directed edges are one or more, and in the training set, all the historical discrete monitoring data whose values of the target attributes are equal to any one tangent value of the target directed edges are used as the training subset of the target directed edges.
A6, if the number of the kini subsystems of the segmentation values of the target directed edge is 0, all the abnormal grade labels in the training subset are the same, and the abnormal grade labels are used as the end points of the target directed edge; if at least one of the kinson coefficients of the segmentation value of the target directed edge is not 0, repeating the steps A1 to A3 by taking the training subset as a new training set to obtain a new node, and taking the new node as the terminal point of the target directed edge;
a7, traversing all the directed edges to obtain the end point of each directed edge, and if the end points of all the directed edges are abnormal grade labels, obtaining an initial decision tree model; if the terminal point of at least one directed edge is a newly added node, executing the steps A4 to A7 aiming at each newly added node until an initial decision tree model is obtained;
and A8, pruning the initial decision tree model to obtain a decision tree model, wherein the input of the decision tree model is discrete monitoring data, and the output of the decision tree model is an abnormal grade corresponding to the discrete monitoring data.
In the optional embodiment, abnormal distortion data and small probability data may exist in the training set, and an abnormal node may be introduced into the initial decision tree model, so that the accuracy of the output result of the decision tree model is reduced. Taking a training set with the number of monitoring attributes being 4 and the number of anomaly levels being 3 as an example, a structural diagram of the decision tree model is shown in fig. 2.
In an optional embodiment, for step A3, when the number of the monitoring attributes corresponding to the minimum value of the kini coefficient is two or more, the selecting the monitoring attribute corresponding to the minimum value of the kini coefficient as the target attribute further includes:
a, taking all monitoring attributes corresponding to the minimum value of the kini coefficient as alternative attributes;
b, judging whether the training set has a father training set;
c, if the training set does not have a father training set, taking any one of the alternative attributes as a target attribute;
d, if the training set has a father training set, calculating the kini coefficient of each alternative attribute in the father training set and obtaining the minimum value of all the kini coefficients, if the minimum value corresponds to one alternative attribute, taking the alternative attribute as a target attribute, if the minimum value corresponds to two or more alternative attributes, taking the father training set as a new training set, and repeatedly executing the steps b to d until the target attribute is obtained.
In an optional embodiment, the anomaly detection unit 113 is configured to obtain real-time discrete monitoring data of the preset service, and obtain an anomaly level of the preset service based on the real-time discrete monitoring data and the decision tree model.
In an optional embodiment, after the decision tree model is built, the decision tree model may be used to detect the operation state of the preset service in a service operation environment, so as to obtain the abnormal level of the preset service.
In an optional embodiment, the obtaining real-time discrete monitoring data of the preset service, and obtaining an exception level of the preset service based on the real-time discrete monitoring data and the decision tree model includes:
collecting real-time monitoring data of the preset service in current unit time, and performing discretization processing on the real-time monitoring data to obtain real-time discrete monitoring data;
inputting the real-time discrete monitoring data into the decision tree model to obtain the initial abnormal level of the current unit time;
and acquiring initial abnormal levels of a preset number of continuous unit time, and taking the initial abnormal levels as the abnormal levels of the preset service when all the initial abnormal levels are the same.
Preferably, the preset number is 3.
In an optional embodiment, the switching unit 114 is configured to execute a switching measure corresponding to the abnormal level on the service traffic of the preset service to obtain a switching result.
In an optional embodiment, each abnormal level corresponds to a switching measure, so that all or part of the service traffic of the preset service is switched to a standby environment according to the abnormal level, and the normal operation of the preset service is ensured.
According to the technical scheme, all monitoring data of the preset service are discretized to obtain discrete monitoring data, the accurate abnormal grade of the preset service is obtained based on the decision tree model and the discrete monitoring data, the switching measure corresponding to the abnormal grade is executed on the service flow of the preset service to obtain the switching result, automatic switching of the service flow is achieved, and the switching precision of the service flow is improved.
Please refer to fig. 5, which is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure. The electronic device 1 comprises a memory 12 and a processor 13. The memory 12 is used for storing computer readable instructions, and the processor 13 is used for executing the computer readable instructions stored in the memory to implement the artificial intelligence based service traffic switching method according to any of the above embodiments.
In an alternative embodiment, the electronic device 1 further comprises a bus, a computer program stored in said memory 12 and executable on said processor 13, such as an artificial intelligence based traffic switching program.
Fig. 5 shows only the electronic device 1 with the memory 12 and the processor 13, and it will be understood by those skilled in the art that the structure shown in fig. 5 does not constitute a limitation of the electronic device 1, and may comprise fewer or more components than shown, or a combination of certain components, or a different arrangement of components.
In conjunction with fig. 1, the memory 12 in the electronic device 1 stores a plurality of computer-readable instructions to implement an artificial intelligence based traffic switching method, and the processor 13 can execute the plurality of instructions to implement:
acquiring a plurality of pieces of historical monitoring data of preset services in historical time, and discretizing the historical monitoring data to obtain historical discrete monitoring data, wherein the historical monitoring data comprises at least one monitoring attribute;
storing the historical discrete monitoring data and the abnormal grade label of each piece of historical discrete monitoring data to serve as a training set;
building a decision tree model based on the training set;
acquiring real-time discrete monitoring data of the preset service, and obtaining the abnormal grade of the preset service based on the real-time discrete monitoring data and the decision tree model;
and executing the switching measure corresponding to the abnormal grade on the service flow of the preset service to obtain a switching result.
Specifically, the specific implementation method of the instruction by the processor 13 may refer to the description of the relevant steps in the embodiment corresponding to fig. 1, which is not described herein again.
It will be understood by those skilled in the art that the schematic diagram is only an example of the electronic device 1, and does not constitute a limitation to the electronic device 1, the electronic device 1 may have a bus-type structure or a star-shaped structure, the electronic device 1 may further include more or less hardware or software than those shown in the figures, or different component arrangements, for example, the electronic device 1 may further include an input and output device, a network access device, etc.
It should be noted that the electronic device 1 is only an example, and other existing or future electronic products, such as may be adapted to the present application, should also be included in the scope of protection of the present application, and is included by reference.
Memory 12 includes at least one type of readable storage medium, which may be non-volatile or volatile. The readable storage medium includes flash memory, removable hard disks, multimedia cards, card type memory (e.g., SD or DX memory, etc.), magnetic memory, magnetic disks, optical disks, etc. The memory 12 may in some embodiments be an internal storage unit of the electronic device 1, for example a removable hard disk of the electronic device 1. The memory 12 may also be an external storage device of the electronic device 1 in other embodiments, such as a plug-in mobile hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like provided on the electronic device 1. The memory 12 may be used not only to store application software installed in the electronic device 1 and various types of data, such as codes of an artificial intelligence based traffic switching program, etc., but also to temporarily store data that has been output or is to be output.
The processor 13 may be composed of an integrated circuit in some embodiments, for example, a single packaged integrated circuit, or may be composed of a plurality of integrated circuits packaged with the same or different functions, including one or more Central Processing Units (CPUs), microprocessors, digital Processing chips, graphics processors, and combinations of various control chips. The processor 13 is a Control Unit (Control Unit) of the electronic device 1, connects various components of the electronic device 1 by using various interfaces and lines, and executes various functions and processes data of the electronic device 1 by running or executing programs or modules (for example, executing an artificial intelligence based service traffic switching program and the like) stored in the memory 12 and calling data stored in the memory 12.
The processor 13 executes the operating system of the electronic device 1 and various installed application programs. The processor 13 executes the application program to implement the steps in each artificial intelligence based service traffic switching method embodiment, such as the steps shown in fig. 1.
Illustratively, the computer program may be partitioned into one or more modules/units, which are stored in the memory 12 and executed by the processor 13 to accomplish the present application. The one or more modules/units may be a series of computer readable instruction segments capable of performing certain functions, which are used to describe the execution 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 building unit 112, an abnormality detecting unit 113, and a switching unit 114.
The integrated unit implemented in the form of a software functional module may be stored in a computer-readable storage medium. The software functional module is stored in a storage medium and includes several instructions to enable a computer device (which may be a personal computer, a computer device, or a network device, etc.) or a Processor (Processor) to execute parts of the artificial intelligence based service traffic switching method according to the embodiments of the present application.
The integrated modules/units of the electronic device 1 may be stored in a computer-readable storage medium if they are implemented in the form of software functional units and sold or used as separate products. Based on such understanding, all or part of the flow in the method of the embodiments described above may be implemented by a computer program, which may be stored in a computer readable storage medium, and when the computer program is executed by a processor, the steps of the embodiments of the methods described above may be implemented.
Wherein the computer program comprises computer program code, which may be in the form of source code, object code, an executable file or some intermediate form, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, U-disk, removable hard disk, magnetic disk, optical disk, computer Memory, read-Only Memory (ROM), random-access Memory and other Memory, etc.
Further, the computer-readable storage medium may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function, and the like; the storage data area may store data created according to the use of the blockchain node, and the like.
The block chain referred by the application is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism, an encryption algorithm and the like. A block chain (Blockchain), which is essentially a decentralized database, is a string of data blocks associated by using a cryptographic method, and each data block contains information of a batch of network transactions, which is used for verifying the validity (anti-counterfeiting) of the information and generating a next block. The blockchain may include a blockchain underlying platform, a platform product service layer, an application service layer, and the like.
The bus may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one arrow is shown in FIG. 5, but this does not indicate only one bus or one type of bus. The bus is arranged to enable connection communication between the memory 12 and at least one processor 13 or the like.
The present embodiment also provides a computer-readable storage medium (not shown), where the computer-readable storage medium stores computer-readable instructions, and the computer-readable instructions are executed by a processor in an electronic device to implement the method for switching service traffic based on artificial intelligence according to any of the foregoing embodiments.
In the several embodiments provided in the present application, it should be understood that the disclosed system, apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the modules is only one logical functional division, and other divisions may be realized in practice.
The modules described as separate parts may or may not be physically separate, and parts displayed as modules may or may not be physical units, may be located in one position, or may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment.
In addition, functional modules in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, or in a form of hardware plus a software functional module.
Furthermore, it is obvious that the word "comprising" does not exclude other elements or steps, and the singular does not exclude the plural. A plurality of units or means recited in the specification may also be implemented by one unit or means through software or hardware. The terms first, second, etc. are used to denote names, but not any particular order.
Finally, it should be noted that the above embodiments are only used for illustrating the technical solutions of the present application and not for limiting, and although the present application is described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that modifications or equivalent substitutions can be made on the technical solutions of the present application without departing from the spirit and scope of the technical solutions of the present application.

Claims (10)

1. A service flow switching method based on artificial intelligence is characterized in that the method comprises the following steps:
acquiring a plurality of pieces of historical monitoring data of preset services in historical time, and performing discretization processing on the historical monitoring data to obtain historical discrete monitoring data, wherein the historical monitoring data comprises at least one monitoring attribute;
storing the historical discrete monitoring data and the abnormal grade label of each piece of historical discrete monitoring data to serve as a training set;
building a decision tree model based on the training set;
acquiring real-time discrete monitoring data of the preset service, and obtaining the abnormal grade of the preset service based on the real-time discrete monitoring data and the decision tree model;
and executing the switching measure corresponding to the abnormal grade on the service flow of the preset service to obtain a switching result.
2. The artificial intelligence based traffic flow switching method according to claim 1, wherein before the discretizing the historical monitoring data to obtain historical discretizing monitoring data, the method further comprises:
classifying each monitoring attribute based on the value range of the monitoring attribute to obtain a classification result, wherein the classification result comprises a continuous attribute and a discrete attribute;
acquiring a value range of a target continuous attribute, wherein the target continuous attribute is any one of all continuous attributes;
dividing the value range into a preset number of sub-ranges, wherein the sub-ranges comprise at least one value;
allocating an index tag as a unique identifier for each sub-range to obtain a discrete mapping relation of the target continuous type attribute, wherein the discrete mapping relation at least comprises a mapping pair of the sub-range and the index tag;
all the continuous type attributes are traversed to obtain the discrete mapping relation of each continuous type attribute.
3. The artificial intelligence based service traffic switching method according to claim 2, wherein the discretizing the historical monitor data to obtain historical discretized monitor data comprises:
acquiring attribute values of all continuous attributes in target monitoring data, wherein the target monitoring data is any piece of historical monitoring data;
acquiring an index tag corresponding to the attribute value based on the attribute value and the discrete mapping relation of the same continuous attribute, and taking the index tag as the discrete value of the continuous attribute in the target monitoring data;
obtaining discrete values of each continuous type attribute through all continuous type attributes in the target monitoring data;
taking the discrete values of all continuous attributes and the attribute values of all discrete attributes as historical discrete monitoring data corresponding to the target monitoring data;
and traversing all historical monitoring data to obtain historical discrete monitoring data corresponding to each piece of historical monitoring data.
4. The artificial intelligence based traffic flow switching method according to claim 1, wherein said building a decision tree model based on said training set comprises:
a1, counting all different values of the same monitoring attribute in the training set to obtain a discrete value range of each monitoring attribute;
a2, calculating the kini sub-coefficient of each value in all discrete value ranges based on the training set, and calculating the kini coefficient of each monitoring attribute based on the kini sub-coefficients of all values in the same discrete value range;
a3, selecting a monitoring attribute corresponding to the minimum value of the kini coefficient as a target attribute, and taking the target attribute as node information to obtain a newly added node;
a4, drawing a first directed edge by taking the newly added node as a starting point, and taking a value corresponding to the minimum value of the kini coefficient in the discrete value range of the target attribute as a tangent value of the first directed edge; if the discrete value range of the target attribute has the residual values except the segmentation value of the first directed edge, drawing a second directed edge by taking the newly added node as a starting point, and taking all the residual values as the segmentation value of the second directed edge;
a5, screening all historical discrete monitoring data in the training set based on the segmentation value of the target directed edge to obtain a training subset of the target directed edge, wherein the target directed edge is any one of the first directed edge and the second directed edge, and the training set is a father training set of the training subset;
a6, if the number of the kini subsystems of the segmentation values of the target directed edge is 0, all the abnormal grade labels in the training subset are the same, and the abnormal grade labels are used as the end points of the target directed edge; if at least one of the kinson coefficients of the segmentation value of the target directed edge is not 0, repeating the steps A1 to A3 by taking the training subset as a new training set to obtain a new node, and taking the new node as the terminal point of the target directed edge;
a7, traversing all the directed edges to obtain the end point of each directed edge, and if the end points of all the directed edges are abnormal grade labels, obtaining an initial decision tree model; if the terminal point of at least one directed edge is a newly added node, executing the steps A4 to A7 aiming at each newly added node until an initial decision tree model is obtained;
and A8, pruning the initial decision tree model to obtain a decision tree model, wherein the input of the decision tree model is discrete monitoring data, and the output of the decision tree model is an abnormal grade corresponding to the discrete monitoring data.
5. An artificial intelligence based service traffic switching method according to claim 4, wherein said number of kini subsystems satisfies the relation:
Figure FDA0003856901650000021
wherein n represents the number of different exception levels in the exception level tag,
Figure FDA0003856901650000022
representing the quantity of historical discrete monitoring data with j of the value of the monitoring attribute P in the training set;
Figure FDA0003856901650000023
representing the number of abnormal grade labels i in the historical discrete monitoring data with j of the value of the monitoring attribute P in the training set; gini (P | P = j) is a kini coefficient of a value j in a discrete value range of the monitoring attribute P;
the kini coefficient satisfies the relation:
Figure FDA0003856901650000024
wherein N (P) is all the values in the discrete value range of the monitoring attribute P,
Figure FDA0003856901650000025
representing the quantity of historical discrete monitoring data with j of the value of the monitoring attribute P in the training set; sigma Num represents the number of historical discrete monitoring data in the training set; gini (P | P = j) represents a kini coefficient of a value j in a discrete value range of the monitoring property P, and Gini (P) is a kini coefficient of the monitoring property P.
6. The artificial intelligence based service traffic switching method according to claim 4, wherein when the number of the monitoring attributes corresponding to the minimum value of the kini coefficients is two or more, the selecting the monitoring attribute corresponding to the minimum value of the kini coefficients as the target attribute further comprises:
a, taking all monitoring attributes corresponding to the minimum value of the kini coefficient as alternative attributes;
b, judging whether the training set has a father training set;
c, if the training set does not have a parent training set, taking any one of the alternative attributes as a target attribute;
d, if the training set has a father training set, calculating the kini coefficient of each alternative attribute in the father training set and obtaining the minimum value of all the kini coefficients, if the minimum value corresponds to one alternative attribute, taking the alternative attribute as a target attribute, if the minimum value corresponds to two or more alternative attributes, taking the father training set as a new training set, and repeatedly executing the steps b to d until the target attribute is obtained.
7. The method for switching service traffic based on artificial intelligence according to claim 1, wherein the obtaining real-time discrete monitoring data of the preset service and obtaining the abnormal level of the preset service based on the real-time discrete monitoring data and the decision tree model comprises:
collecting real-time monitoring data of the preset service in current unit time, and performing discretization processing on the real-time monitoring data to obtain real-time discrete monitoring data;
inputting the real-time discrete monitoring data into the decision tree model to obtain the initial abnormal level of the current unit time;
and acquiring initial abnormal levels of a preset number of continuous unit time, and taking the initial abnormal levels as the abnormal levels of the preset service when all the initial abnormal levels are the same.
8. An artificial intelligence based service traffic switching apparatus, the apparatus comprising:
the system comprises a discretization unit, a service monitoring unit and a service monitoring unit, wherein the discretization unit is used for acquiring a plurality of historical monitoring data of preset services in historical time, and performing discretization processing on the historical monitoring data to obtain historical discretization monitoring data, and the historical monitoring data comprises at least one monitoring attribute;
the storage unit is used for storing the historical discrete monitoring data and the abnormal grade label of each piece of historical discrete monitoring data to be used as a training set;
the building unit is used for building a decision tree model based on the training set;
the anomaly detection unit is used for acquiring real-time discrete monitoring data of the preset service and obtaining the anomaly grade of the preset service based on the real-time discrete monitoring data and the decision tree model;
and the switching unit is used for executing the switching measures corresponding to the abnormal levels on the service flow of the preset service so as to obtain a switching result.
9. An electronic device, characterized in that the electronic device comprises:
a memory storing computer readable instructions; and
a processor executing computer readable instructions stored in the memory to implement the artificial intelligence based traffic flow switching method according to any one of claims 1 to 7.
10. A computer-readable storage medium, having computer-readable instructions stored thereon, which when executed by a processor implement the artificial intelligence based traffic switching method according to any one of claims 1 to 7.
CN202211152305.5A 2022-09-21 2022-09-21 Service flow switching method based on artificial intelligence and related equipment Pending CN115562934A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211152305.5A CN115562934A (en) 2022-09-21 2022-09-21 Service flow switching method based on artificial intelligence and related equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211152305.5A CN115562934A (en) 2022-09-21 2022-09-21 Service flow switching method based on artificial intelligence and related equipment

Publications (1)

Publication Number Publication Date
CN115562934A true CN115562934A (en) 2023-01-03

Family

ID=84740831

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211152305.5A Pending CN115562934A (en) 2022-09-21 2022-09-21 Service flow switching method based on artificial intelligence and related equipment

Country Status (1)

Country Link
CN (1) CN115562934A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117421643A (en) * 2023-12-18 2024-01-19 贵州省环境工程评估中心 Ecological environment remote sensing data analysis method and system based on artificial intelligence

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117421643A (en) * 2023-12-18 2024-01-19 贵州省环境工程评估中心 Ecological environment remote sensing data analysis method and system based on artificial intelligence
CN117421643B (en) * 2023-12-18 2024-02-23 贵州省环境工程评估中心 Ecological environment remote sensing data analysis method and system based on artificial intelligence

Similar Documents

Publication Publication Date Title
CN109634801B (en) Data trend analysis method, system, computer device and readable storage medium
CN110083475B (en) Abnormal data detection method and device
CN113283675A (en) Index data analysis method, device, equipment and storage medium
CN112559831A (en) Link monitoring method and device, computer equipment and medium
CN112948275A (en) Test data generation method, device, equipment and storage medium
CN115562934A (en) Service flow switching method based on artificial intelligence and related equipment
CN112700261B (en) Method, device, equipment and medium for detecting single file of brushing on basis of suspicious communities
CN110018932A (en) A kind of monitoring method and device of container disk
CN112819305A (en) Service index analysis method, device, equipment and storage medium
CN116501610B (en) Method, device, equipment and medium for testing market transaction system
CN111429085A (en) Contract data generation method and device, electronic equipment and storage medium
CN116150185A (en) Data standard extraction method, device, equipment and medium based on artificial intelligence
CN115203758B (en) Data security storage method, system and cloud platform
CN115293809A (en) Typhoon and rainstorm risk rating method based on artificial intelligence and related equipment
CN116361571A (en) Artificial intelligence-based merchant portrait generation method, device, equipment and medium
CN112395179B (en) Model training method, disk prediction method, device and electronic equipment
WO2021184588A1 (en) Cluster optimization method and device, server, and medium
CN114860722A (en) Data fragmentation method, device, equipment and medium based on artificial intelligence
CN114818686A (en) Text recommendation method based on artificial intelligence and related equipment
CN112738175A (en) Request processing method and related equipment
CN113064984A (en) Intention recognition method and device, electronic equipment and readable storage medium
CN113591881A (en) Intention recognition method and device based on model fusion, electronic equipment and medium
CN113850260A (en) Key information extraction method and device, electronic equipment and readable storage medium
CN113657546A (en) Information classification method and device, electronic equipment and readable storage medium
CN115803726A (en) Improved entity resolution of master data using qualifying relationship scores

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination