Model monitoring method and device
By obtaining the indicator strategy of the target monitoring indicator and creating a directed acyclic graph, the customized monitoring of the model is realized, which solves the problem of difficulty in realizing customized indicator monitoring in the existing technology and improves the flexibility and applicability of monitoring.
Patent Information
- Application Number
- CN202310474863.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-04-27
- Publication Date
- 2024-08-30
AI Technical Summary
Existing technology is difficult to provide customized indicator monitoring in model online applications, cannot effectively combine business needs, and lacks personalized monitoring solutions for models.
By obtaining the indicator strategy of the target monitoring indicator, create a directed acyclic graph, generate monitoring indicators based on the running information of the script and model, realize customized monitoring of the model, and display the monitoring indicators to the user.
It reduces the need for users to connect task processes on their own, reduces knowledge reserves and programming ability requirements, improves openness and usage thresholds, is suitable for various application scenarios, and reduces indicator development and usage costs.
Smart Images

Figure CN118567938A
Abstract
Description
Technical Field
[0001] The present application relates to the field of machine learning, and the following description relates to a model monitoring method and device. Background Art
[0002] At present, most products or systems provide some common standard model monitoring indicators, such as the number of incoming items, PSI, quantiles, etc. However, in the process of online model application, it is often hoped to add custom indicator monitoring based on the key content of the model in the business, and calculate and monitor the indicators of the specified model. For this problem, the relevant technology has not provided an effective solution. Summary of the invention
[0003] Exemplary embodiments of the present disclosure may solve at least the above problems.
[0004] According to a first aspect of the present disclosure, a model monitoring method is provided, comprising: obtaining an indicator strategy for a target monitoring indicator of a monitoring model, wherein the indicator strategy includes a calculation logic for the target monitoring indicator; creating a script for the target monitoring indicator based on the indicator strategy and an indicator script template; creating a directed acyclic graph for determining the target monitoring indicator based on the script and the running information of the model; and monitoring the model based on the directed acyclic graph.
[0005] Optionally, the directed acyclic graph includes a directed acyclic graph file generation operator and a directed acyclic graph file submission operator, and the model is monitored based on the directed acyclic graph, including: generating a directed acyclic graph file through the directed acyclic graph file generation operator, the directed acyclic graph file is a workflow consisting of script and model running information; submitting the directed acyclic graph file to a platform for scheduling and monitoring workflows through the directed acyclic graph file submission operator, and receiving the running results of the directed acyclic graph file on the platform; and monitoring the model based on the running results.
[0006] Optionally, creating a script for the target monitoring indicator based on the indicator strategy and the indicator script template includes: determining a development language for creating the script for the target monitoring indicator; and creating the script for the target monitoring indicator according to the development language based on the indicator strategy and the indicator script template.
[0007] Optionally, after monitoring the model based on the directed acyclic graph, it also includes: adjusting the position of the input parameter in the script to a configuration parameter, wherein the configuration parameter is set to be obtained from the running information of the model to be monitored and is the same type as the input parameter; and saving the adjusted script to the indicator library.
[0008] Optionally, saving the adjusted script to the indicator library includes: simulating the execution of the script to obtain the value output by the script; determining a rule for selecting the value to be displayed from the value output by the script; and saving the rule and the adjusted script to the indicator library.
[0009] Optionally, after saving the adjusted script to the indicator library, it also includes: in response to the adjusted script in the indicator library being called, obtaining parameters corresponding to the configuration parameters in the adjusted script from the running information of the model to be monitored; based on the adjusted script and parameters, creating a directed acyclic graph corresponding to the target monitoring indicators; based on the directed acyclic graph, monitoring the model to be monitored.
[0010] Optionally, the model is monitored based on the directed acyclic graph, including: obtaining a value of a target monitoring indicator based on the directed acyclic graph; determining a value to be displayed from the value of the target monitoring indicator; and displaying the value to be displayed to a user.
[0011] Optionally, presenting the value to be presented to the user includes: determining an indicator presentation style of the target monitoring indicator based on the indicator strategy; and presenting the value to be presented to the user through the indicator presentation style.
[0012] According to a second aspect of the present disclosure, a model monitoring device is provided, including: an acquisition unit, configured to acquire an indicator strategy for a target monitoring indicator for monitoring a model, wherein the indicator strategy includes a calculation logic for the target monitoring indicator; a first creation unit, configured to create a script for the target monitoring indicator based on the indicator strategy and an indicator script template; a second creation unit, configured to create a directed acyclic graph for determining the target monitoring indicator based on the script and running information of the model; and a monitoring unit, configured to monitor the model based on the directed acyclic graph.
[0013] Optionally, the directed acyclic graph includes a directed acyclic graph file generation operator and a directed acyclic graph file submission operator, and the monitoring unit is further configured to generate a directed acyclic graph file through the directed acyclic graph file generation operator, and the directed acyclic graph file is a workflow consisting of the running information of the script and the model; submit the directed acyclic graph file to a platform for scheduling and monitoring workflows through the directed acyclic graph file submission operator, and receive the running results of the directed acyclic graph file on the platform; and monitor the model based on the running results.
[0014] Optionally, the first creation unit is further configured to determine a development language for creating a script for the target monitoring indicator; and create the script for the target monitoring indicator in the development language based on the indicator strategy and the indicator script template.
[0015] Optionally, the monitoring unit is also configured to adjust the position of the input parameter in the script to a configuration parameter after monitoring the model based on the directed acyclic graph, wherein the configuration parameter is set to be obtained from the running information of the model to be monitored and is of the same type as the input parameter; and save the adjusted script to the indicator library.
[0016] Optionally, the monitoring unit is further configured to simulate the execution of the script to obtain the value of the script output; determine the rule for selecting the value to be displayed from the value of the script output; and save the rule and the adjusted script to the indicator library.
[0017] Optionally, the monitoring unit is also configured to, after saving the adjusted script to the indicator library, obtain parameters corresponding to the configuration parameters in the adjusted script from the running information of the model to be monitored in response to the adjusted script in the indicator library being called; create a directed acyclic graph corresponding to the target monitoring indicators based on the adjusted script and parameters; and monitor the model to be monitored based on the directed acyclic graph.
[0018] Optionally, the monitoring unit is further configured to obtain a value of a target monitoring indicator based on a directed acyclic graph; determine a value to be displayed from the value of the target monitoring indicator; and display the value to be displayed to a user.
[0019] Optionally, the monitoring unit is further configured to determine an indicator display style of the target monitoring indicator based on the indicator strategy; and display the value to be displayed to the user through the indicator display style.
[0020] According to a third aspect of the present disclosure, a computer-readable storage medium storing instructions is provided, wherein when the instructions are executed by at least one computing device, the at least one computing device is prompted to execute the above model monitoring method.
[0021] According to a fourth aspect of the present disclosure, a system is provided comprising at least one computing device and at least one storage device storing instructions, wherein the instructions, when executed by the at least one computing device, prompt the at least one computing device to execute the above model monitoring method.
[0022] According to the model monitoring method and device disclosed in the present invention, the user can configure the indicator strategy of the target monitoring indicator according to the needs. After obtaining the indicator strategy configured by the user, the script of the target monitoring indicator can be created according to the indicator strategy and the indicator script template, and then a directed acyclic graph (DAG) for calculating the target monitoring indicator is automatically created according to the script. The model is monitored by the directed acyclic graph. This method does not require the user to connect the task flow in series by themselves, and does not require the user to have too much knowledge reserves and programming capabilities. It not only ensures a low usage threshold, but also has a high degree of openness. It can cover various application scenarios and reduce the development and use costs of indicators. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] These and / or other aspects and advantages of the present invention will become clear and more easily understood from the following description of the embodiments in conjunction with the accompanying drawings, in which:
[0024] Figure 1A flow chart showing a model monitoring method according to an exemplary embodiment of the present disclosure;
[0025] Figure 2 A schematic diagram showing an indicator script template according to an exemplary embodiment of the present disclosure;
[0026] Figure 3 A schematic diagram showing the release of a custom indicator according to an exemplary embodiment of the present disclosure;
[0027] Figure 4 A schematic diagram showing the use of a custom indicator after publication according to an exemplary embodiment of the present disclosure;
[0028] Figure 5 A schematic diagram showing a method for creating and configuring a custom indicator according to an exemplary embodiment of the present disclosure;
[0029] Figure 6 A schematic diagram showing an operation indicator strategy according to an exemplary embodiment of the present disclosure;
[0030] Figure 7 A block diagram of a model monitoring device according to an exemplary embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0031] The following description with reference to the accompanying drawings is provided to assist in a comprehensive understanding of the embodiments of the present invention as defined by the claims and their equivalents. Various specific details are included to assist in understanding, but these details are considered to be exemplary only. Therefore, one of ordinary skill in the art will recognize that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. In addition, descriptions of well-known functions and structures are omitted for clarity and brevity.
[0032] It should be noted that the phrase "at least one of the items" in the present disclosure includes three types of parallel situations: "any one of the items", "a combination of any number of the items", and "all of the items". For example, "including at least one of A and B" includes the following three parallel situations: (1) including A; (2) including B; (3) including A and B. Another example is "executing at least one of step 1 and step 2" which means the following three parallel situations: (1) executing step 1; (2) executing step 2; (3) executing step 1 and step 2.
[0033] The model monitoring method and apparatus according to the embodiments of the present disclosure will be described below with reference to the accompanying drawings in order to explain the present disclosure.
[0034] Figure 1 FIG. 1 is a flow chart of a model monitoring method according to an exemplary embodiment of the present disclosure. Figure 1 As shown, the model monitoring method includes the following steps:
[0035] In step S101, an indicator strategy for a target monitoring indicator of a monitoring model is obtained, wherein the indicator strategy includes a calculation logic of the target monitoring indicator.
[0036] The above-mentioned model can be a model for any scenario, such as a model for a video recommendation scenario, a model for an anti-money laundering suspicious case sorting scenario, or a model for a cash installment scenario, and the present disclosure does not limit this.
[0037] The monitoring indicators used for monitoring the model can vary according to different scenarios. For example, taking the anti-money laundering suspicious case sorting scenario as an example, the monitoring indicators concerned by the model in this scenario can be business evaluation indicators. The indicator evaluation method is to sort the cases from high to low according to the scores, and then see how many money laundering black samples can be recalled (covered) by TOP30%, TOP 50%, and TOP 70% respectively. The business evaluation indicator formula can be Score=1.0*Recall(0%, 30%)+0.5*Recall(30%, 50%)-1.0*Recall(70%, 100%), wherein the sorting within the segment is irrelevant, the single sample tail gain is greater, and Recall(i, j) is the number of money laundering cases sorted between i and j / the total number of money laundering cases.
[0038] Taking the cash installment scenario as an example, in addition to the expected response rate (accuracy) of top customers, the monitoring indicators that the model pays attention to in this scenario will further measure the expected benefits. In the presentation of these monitoring indicators, attention will be paid to: the changes in accuracy and recall rate over time under a specific topN; the changes in accuracy and recall rate under the current latest topN as the N ratio switches; and how much should be pushed to the top in order to achieve the expected accuracy and recall targets.
[0039] It should be noted that the target monitoring indicators disclosed in the present invention can be the monitoring indicators listed above, or other monitoring indicators required by the user, and the present invention does not limit this; moreover, the target monitoring indicators disclosed in the present invention can be customized by the user, that is, the target monitoring indicators in the above steps can be indicators customized by the user, and the indicator strategy corresponding to the target monitoring indicators can be a strategy customized by the user, and the present invention does not limit this. In addition, in a scenario, you can focus on only one monitoring indicator, or you can focus on multiple monitoring indicators, and you can also present multiple monitoring indicators together, and the present invention does not limit this.
[0040] As an example, when it is necessary to define a monitoring indicator (such as a target monitoring indicator), the model monitoring page of the monitoring platform can receive user-defined input information, that is, configuration information for defining the monitoring indicator, and then the monitoring platform can obtain the indicator strategy of the monitoring indicator based on the configuration information, and the monitoring platform obtains the indicator strategy for the subsequent construction of the relevant content of the monitoring indicator. The indicator strategy here may include the calculation logic of the monitoring indicator, and may also include other information about the monitoring indicator, such as the display style of the monitoring indicator, which is not limited by the present disclosure. The monitoring platform here may include a model monitoring page, and the above-mentioned input of the defined indicator strategy into the corresponding monitoring platform may be a user creating an indicator strategy by configuring the corresponding information of the monitoring indicator on the model monitoring page of the platform, that is, selecting to configure the monitoring indicator on the model monitoring page, and filling in the corresponding information of the indicator strategy to create an indicator strategy.
[0041] In step S102, a script of the target monitoring indicator is created based on the indicator strategy and the indicator script template.
[0042] The above indicator script template can be pre-built into the monitoring platform, or it can be temporarily written on the monitoring platform, which is not limited by the present disclosure. When the indicator script template is pre-built into the monitoring platform, the indicator script template can be as follows: Figure 2 As shown, it should be noted that Figure 2 The template shown is only one form of indicator script template, and the present disclosure is not limited to this form.
[0043] As an example, after obtaining the indicator strategy of the target monitoring indicator, the indicator type can select a custom indicator, and then based on the built-in indicator script template and the obtained indicator strategy, a script for the target monitoring indicator can be created. Specifically, the above-mentioned monitoring platform can provide an online code editor to facilitate users to edit scripts anytime and anywhere. For example, the script for the target monitoring indicator can be created on the above-mentioned code editor based on the built-in indicator script template and the obtained indicator strategy. Of course, the script file can also be viewed on the above-mentioned code editor anytime and anywhere; the above-mentioned monitoring platform can also synchronize the files of the online code editor and the background server, so that users can develop scripts for custom indicators online at any time, which is not limited by the present disclosure.
[0044] According to the disclosed exemplary embodiment, based on the indicator strategy and the indicator script template, creating a script for a target monitoring indicator may include: determining a development language for creating a script for the target monitoring indicator; based on the indicator strategy and the indicator script template, creating a script for the target monitoring indicator in the development language. According to this embodiment, when creating a script, a development script may be selected as needed, so that the required script may be flexibly created.
[0045] Specifically, the above development language can be any language that can edit scripts, such as Python, and the present disclosure does not limit this.
[0046] As an example, after obtaining the indicator strategy of the target monitoring indicator, the indicator type can be selected as a custom indicator, and then the development language used to create the script can be selected. For example, in this embodiment, the Python language can be selected. After the development language is determined, the script of the target monitoring indicator can be created in the code editor based on the built-in indicator script template and the obtained indicator strategy according to the determined development language.
[0047] In step S103, based on the running information of the script and the model, a directed acyclic graph is created for determining the target monitoring index. The directed acyclic graph may include multiple operators, such as a task start operator, a DAG file generation operator, a DAG file submission operator, etc., which are not limited in the present disclosure. The user can logically connect and parameterize these operators through a graphical interface to obtain a directed acyclic graph. Of course, the monitoring platform can also automatically logically connect and parameterize these operators to obtain a directed acyclic graph, which is not limited in the present disclosure. This method can simply and conveniently design a complex calculation method for the target monitoring index through a graphical interface, which is convenient for users to determine the target monitoring index, and also convenient for users to modify and adjust the target monitoring index later.
[0048] For example, after the user configures the indicator strategy on the monitoring platform and develops the script of the custom indicator, when saving the indicator strategy, the monitoring platform will select appropriate operators on the monitoring platform based on the running information of the script and the model, and perform logical connections and parameter design on these operators, thereby creating an ordered acyclic graph (Directed Acyclic Graph, abbreviated as DAG). The monitoring platform can assemble DAG in a drag-and-drop manner according to the dependency of operators (including the above-mentioned scripts) and data (including the running information of the model). It should be noted that the above-mentioned drag-and-drop operation can be automatically performed by the monitoring platform or by the user, and this is not limited by the present disclosure.
[0049] It should be noted that the above-mentioned DAG can be scheduled on the Airflow platform to parse the DAG and facilitate the subsequent operation of the DAG. Airflow is a platform for scheduling and monitoring data workflows (data pipelines) written in Python. Of course, the above-mentioned DAG can also be scheduled by other similar frameworks or platforms, such as DolphinScheduler, kubeflow and other open source scheduling frameworks, which are not limited in this disclosure.
[0050] In step S104, the model is monitored based on the directed acyclic graph.
[0051] For example, after logically connecting and parameter designing the operators and creating an ordered acyclic graph, the value of the target monitoring indicator can be obtained by running the ordered acyclic graph, and the model can be monitored by the obtained value of the target monitoring indicator. Specifically, after running the directed acyclic graph to obtain the value of the target monitoring indicator, the value can be displayed to the user, and the user determines the operating effect of the model based on the value of the target monitoring indicator seen, and then determines whether the model needs to be adjusted based on the operating results; of course, after running the directed acyclic graph to obtain the value of the target monitoring indicator, the monitoring platform can also automatically determine the operating effect of the model, and then determine whether the model needs to be adjusted based on the operating results, etc., and this disclosure does not limit this.
[0052] According to the disclosed exemplary embodiment, the directed acyclic graph includes a directed acyclic graph file generation operator and a directed acyclic graph file submission operator. Based on the directed acyclic graph, monitoring the model may include: generating a directed acyclic graph file through a directed acyclic graph file generation operator, wherein the directed acyclic graph file is a workflow composed of script and model operation information; submitting the directed acyclic graph file to a platform for scheduling and monitoring workflows through a directed acyclic graph file submission operator, and receiving the operation result of the directed acyclic graph file on the platform; and monitoring the model based on the operation result. According to this embodiment, through the DAG file generation operator and the DAG file submission operator, the operation result of the directed acyclic graph can be obtained conveniently and quickly to monitor the model.
[0053] The above-mentioned DAG may include but is not limited to two operators, a DAG file generation operator and a DAG file submission operator. The DAG file generation operator is responsible for communicating with the modeling IDE. Based on the indicator strategy configured by the user, a DAG file that can be recognized by the modeling IDE can be dynamically constructed in combination with the general capabilities of Sage-SDK. The DAG file submission operator submits the above-mentioned generated DAG file to the Airflow platform (i.e., the platform for scheduling and monitoring workflows in the above-mentioned embodiment), parses the script in the DAG file, and executes the script on the modeling IDE to obtain the corresponding running results, so as to monitor the model. For example, taking the monitoring indicator as the business evaluation indicator in the anti-money laundering suspicious case sorting scenario, and the model output as the case score as an example, at this time, the script is executed on the modeling IDE, and the corresponding running result is the value of the business evaluation indicator. If the value is too low, it means that there are too few black samples of money laundering recalled, that is, the score of the case output by the model may be inaccurate. Therefore, it is necessary to adjust the parameters of the model to improve the accuracy of the score of the case output by the model.
[0054] The above-mentioned DAG file generation operator can be obtained by extending the native python operator supported by the Airflow platform. The extended function is to dynamically generate a DAG file for the modeling IDE based on the configuration given by the user combined with the capabilities of the Sage SDK. The composition of the DAG file includes the script of the above-mentioned target monitoring indicators and the workflow composed of the operation information of the above-mentioned model. Of course, the composition of the DAG file can also include some other operators. The above-mentioned other operators can be codes generated in advance by the modeling IDE for calculating general indicators of the model, such as the PSI operator for predicting the stability of the model, the operator for quantile statistics of the monitoring model data drift, etc., which are not limited in this disclosure. During operation, the DAG file generation operator will eventually output a DAG file for the modeling IDE.
[0055] The above-mentioned DAG file submission operator can also be obtained by extending the native python operator supported by the Airflow platform. The ability of this submission operator is to submit the DAG file of the modeling IDE generated by the above generation operator to the project of the modeling IDE of the monitoring platform, that is, to the Airflow platform. After submission, it will poll by calling the API interface of the monitoring platform to query the execution status of the DAG file until the DAG file is finally executed successfully or failed to record the current running status and synchronize it to the monitoring platform.
[0056] In addition to the DAG file generation operator and the DAG file submission operator, the above DAG can also include other operators, such as the task start operator, which records the ID and name of the current task corresponding to the DAG. At the same time, the operator will mark the running status of the current task during operation and synchronize the status to the monitoring platform; another example is the Python operator, which is a native python operator supported by the Airflow platform and can execute custom python scripts written by users.
[0057] It should be noted that the Sage SDK mainly includes the basic data and computing capabilities in the AI / OS core (Core), service orchestration, cluster management, monitoring and alarming, and other business-independent atomic capabilities. It also provides a good localized packaging for the built-in AI capabilities of the monitoring platform and command-line tools that are more convenient for operation and development. The native python operator supported by the above Airflow platform can execute custom python scripts written by users.
[0058] According to the disclosed exemplary embodiment, after monitoring the model based on the directed acyclic graph, the position of the input parameter in the script can be adjusted to a configuration parameter, wherein the configuration parameter is set to be obtained from the operation information of the model to be monitored and is of the same type as the input parameter; the adjusted script is saved to the indicator library. According to this embodiment, the target monitoring indicator can be published according to specific needs, so that when the target monitoring indicator is used subsequently, there is no need to recreate the script, which facilitates the reuse of the target monitoring indicator.
[0059] Specifically, when the target monitoring indicator has a certain degree of universality (for example, based on a custom judgment method such as the number of times used being higher than a threshold, being applied to a general scenario, etc., which will not be elaborated here), or based on the user's instructions, when the target monitoring indicator is published as a general indicator, the custom content of the target monitoring indicator can be published, and the target monitoring indicator can be converted into a general indicator built into the monitoring platform. For example, when publishing, the script of the target monitoring indicator can be parameter abstracted, and the position of the input parameter can be adjusted to a configuration parameter. The configuration parameter can be subsequently obtained from the running information of the model to be monitored and has the same type as the input parameter, and the target monitoring indicator processing calculation logic can be adaptively modified based on the abstract parameter. In terms of specific usage, when the user writes a custom indicator script, the parameter information of the monitoring platform configuration can be obtained in combination with the context information to complete the writing of the script logic. The written script will initialize the context information at runtime, and inject the parameter information configured by the user on the monitoring platform into the context configuration, so that the user only needs to care about the calculation logic of the monitoring indicator when writing the script, and the corresponding parameters can be obtained from the context configuration, that is, from the running information of the corresponding model to be monitored. It should be noted that the corresponding parameters here can be obtained not only from the operation information of the corresponding model to be monitored, but also from the information of other monitoring indicators related to the target monitoring indicators, and can also be obtained from other relevant information, which is not limited in this disclosure.
[0060] As an example, Figure 3 A schematic diagram showing the release of a custom indicator according to an exemplary embodiment of the present disclosure is shown as follows: Figure 3 As shown, the general indicators can be published on the model monitoring page of the monitoring platform. Specifically, select publish general indicators on the model monitoring page, and then start to define parameters, that is, determine the input parameters required for the custom indicators to be published, and then select the script of the custom indicators written above (that is, the script of the target monitoring indicators mentioned above). The script of the general indicators is developed through the script, that is, the position of the input parameters in the script is adjusted to the configuration parameters, and the configuration parameters are set to be obtained from the running information of the model to be monitored, and are the same as the type of the input parameters. Specifically, it can be as follows Figure 3 As shown in the figure, the adjusted script is obtained and stored in the indicator library.
[0061] It should be noted that Figure 3 The display method of the target monitoring indicators shown will be discussed in detail later and will not be discussed here.
[0062] According to the disclosed exemplary embodiment, saving the adjusted script to the indicator library may include: simulating the execution of the script to obtain the value output by the script; determining the rule for selecting the value to be displayed from the value output by the script; and saving the rule and the adjusted script to the indicator library. According to this embodiment, when publishing the target monitoring indicator as a general indicator, the rule for selecting the value to be displayed from the value output by the script can be defined and saved. When the target monitoring indicator is reused later, the value to be displayed can be directly selected according to the rule.
[0063] Specifically, the above monitoring platform can also be combined with the monitoring system of grafana. After the user develops the script of the custom indicator, the user can be provided with an advanced configuration method, that is, after parsing the script to obtain the value of the target monitoring indicator, when displaying the value of the target monitoring indicator, not all values are displayed, but the values that meet the user's needs are selected for display as needed, so that the user can configure the indicator display results in a more fine-grained manner. It should be noted that grafana is an open source program for visualizing large-scale measurement data, which provides a powerful and elegant way to create, share, and browse data.
[0064] As an example, Figure 3 As shown in the figure, after obtaining the adjusted script, the adjusted script can be synchronized to the Airflow platform, the adjusted script can be parsed, the value output by the script can be obtained, and the value to be displayed can be determined from the value output by the script according to user needs. Then, the rules for selecting the value to be displayed from the value output by the script can be stored in the indicator library. In this way, when the target monitoring indicator is called later, the configured display method can be adopted. At this time, the release of the target monitoring indicator is completed, that is, a general indicator is released.
[0065] According to the disclosed exemplary embodiment, after the adjusted script is saved to the indicator library, in response to the adjusted script in the indicator library being called, the parameters corresponding to the configuration parameters in the adjusted script can be obtained from the running information of the model to be monitored; based on the adjusted script and the parameters, a directed acyclic graph corresponding to the target monitoring indicator is created; based on the directed acyclic graph, the model to be monitored is monitored. According to this embodiment, the adjusted script is saved, and when the target monitoring indicator can be reused later, the configuration parameters can be directly replaced.
[0066] Specifically, when a target monitoring indicator is needed to monitor a certain model in the future, the target monitoring indicator can be directly selected. That is, when the adjusted script in the indicator library is called, the parameters corresponding to the configuration parameters in the adjusted script can be obtained from the running information of the model. According to the parameters and the adjusted script, a directed acyclic graph corresponding to the target monitoring indicator can be created, and the model can be monitored through the directed acyclic graph.
[0067] For example, Figure 4 A schematic diagram showing the use of a custom indicator after publication according to an exemplary embodiment of the present disclosure is shown as follows: Figure 4 As shown, you can use the common indicators on the model monitoring page of the monitoring platform. Specifically, select the custom indicator (such as the target monitoring indicator) published as the common indicator on the model monitoring page, obtain the parameters required for the custom indicator according to the running information of the model, and configure the obtained parameters through the model monitoring page to complete the policy configuration of the custom indicator. After configuring the indicator strategy, the monitoring platform will automatically generate a directed acyclic graph corresponding to the target monitoring indicator, and then parse the script in the directed acyclic graph through the Airflow platform, and then run the script in the modeling IDE to monitor the model.
[0068] According to the disclosed exemplary embodiment, monitoring a model based on a directed acyclic graph may include: obtaining a value of a target monitoring indicator based on the directed acyclic graph; determining a value to be displayed from the value of the target monitoring indicator; and displaying the value to be displayed to a user. According to this embodiment, a more advanced display result is provided, that is, the value of the target monitoring indicator can be displayed to the user in a more fine-grained manner.
[0069] Specifically, when the value of the target monitoring indicator is obtained, the value to be displayed can be determined from the value of the target monitoring indicator as needed, and the determined value to be displayed can be displayed to the user instead of displaying all the values of the target monitoring indicator, making the display result more granular.
[0070] According to the disclosed exemplary embodiment, presenting the value to be presented to the user may include: determining the indicator presentation style of the target monitoring indicator based on the indicator strategy; and presenting the value to be presented to the user through the indicator presentation style. According to this embodiment, the indicator presentation style may be set in the indicator strategy, so that the corresponding indicator presentation style may be used for presentation when the indicator is subsequently presented.
[0071] Specifically, the user can configure the display style of the monitoring indicator when configuring the indicator strategy on the model monitoring page of the monitoring platform. This determines the display style of the calculated monitoring indicator, such as a historical line chart or a histogram, which is not limited by the present disclosure. For example, the value of the target monitoring indicator obtained after the above script calculation will be automatically imported into the database. The grafana component will configure the corresponding data source to the current database, and the subsequent generation of corresponding reports and alarms will obtain the value of the target monitoring indicator from the configured data source, and then based on the indicator display style configured in the indicator strategy, it will finally be presented to the user in the configured display style on the monitoring platform.
[0072] The following is a systematic description of the process of creating and configuring the display mode of the custom indicator (such as the target monitoring indicator) in the above embodiment. Figure 5 A schematic diagram showing a custom indicator creation and configuration display method according to an exemplary embodiment of the present disclosure is shown as follows: Figure 5 As shown, you can select to configure monitoring indicators on the model monitoring page, select custom indicators for indicator type, and select Python for the development language used to create development scripts. Then, you can develop scripts for target monitoring indicators based on the built-in indicator script model on the code editor, that is, develop Python scripts. After the script is created, it is stored in the form of a file. You can use the script later by selecting the file, such as scheduling the script through the Airflow platform, parsing the script, and obtaining the output value of the script, that is, the value of the target monitoring indicator. Next, you can determine the data to be displayed to the user based on the output value, and you can also configure the display style of these data, such as histogram or line graph display.
[0073] In order to facilitate understanding of the present disclosure, the monitoring of the model is described in detail below.
[0074] When the user configures the model monitoring strategy on the model monitoring page of the monitoring platform, the monitoring platform will help the user generate the corresponding schedulable model monitoring task (i.e., DAG in the above embodiment) in the background, which can be edited and viewed by the user on the monitoring platform and displayed through visual components. The above model monitoring strategy may include indicator strategies for multiple monitoring indicators, or may include an indicator strategy for one monitoring indicator, which is not limited in this disclosure.
[0075] The visual interface on the monitoring platform can include the following parts:
[0076] 1. The left sidebar of the visualization interface is a list of operators described above. Users can drag operators to the canvas in the middle of the visualization interface;
[0077] 2. The middle of the visualization interface is the canvas. When the monitoring platform generates a corresponding schedulable model monitoring task in the background, the task is presented on the canvas, and the task can be edited and viewed by the user on the canvas; of course, the user can also drag the operator to the canvas by dragging and dropping, and then arrange the operator through the connecting line to obtain the task, which is not limited in this disclosure. After the task is saved, the monitoring platform will convert the task configuration into a DAG that can be recognized by the Airflow platform through the dynamic rendering of the template, and then the scheduling and execution of the entire task will be handed over to the Airflow platform for execution.
[0078] The following example uses a model monitoring strategy that includes an indicator strategy for a monitoring indicator. Assume that the monitoring indicator is not a common indicator, that is, the indicator library of the monitoring platform does not contain the monitoring indicator. In this case, a custom indicator needs to be created. Figure 6 A schematic diagram showing an operation indicator strategy according to an exemplary embodiment of the present disclosure is shown as follows: Figure 6 As shown in the figure, configure the indicator strategy on the model monitoring page and save it. The monitoring platform will help users generate corresponding schedulable model monitoring tasks in the background ( Figure 6 The construction monitoring indicator calculation task shown in ), that is, the DAG in the above embodiment, includes two operators, the DAG file generation operator and the DAG file submission operator. The DAG file generation operator is responsible for communicating with the modeling IDE. Based on the indicator strategy configured by the user, it can dynamically construct a DAG file that can be recognized by the modeling IDE in combination with the general capabilities of Sage-SDK. The DAG file submission operator submits the above-generated DAG file to the Airflow platform (i.e., the platform for scheduling and monitoring workflows in the above embodiment), parses the script in the DAG file, and executes the custom script on the modeling IDE. The value of the target monitoring indicator calculated by the script will be automatically imported into the database. The grafana component will configure the corresponding data source to the current database, and the subsequent generation of corresponding reports and alarms will obtain the value of the target monitoring indicator from the configured data source, and then finally present it to the user in the configured display style on the monitoring platform based on the indicator display style configured in the indicator strategy.
[0079] 3. When the user selects an operator, the right sidebar of the visualization interface can be used to configure the operator. The configuration includes general configuration, operator name, parameter configuration supported by the operator, and callback script configuration. The callback script mainly provides users with some interfaces, which can bind user-defined logic before, during, and after the operator runs. For example, if you want to send an email when the operator fails, you can connect it through the callback capability.
[0080] 4. The overall task is also configurable. The task configuration may include the following capabilities: task timing configuration, task callback configuration (similar to operator callback, users can bind custom logic when the task succeeds or fails), task retry times, and task timeout, which are not limited in this disclosure.
[0081] It should be noted that the monitoring platform of the present disclosure has built-in monitoring indicators. These monitoring indicators can cover the standardized monitoring scenarios of binary classification scenarios, enrich the content and diversity of model monitoring, and cover model effect monitoring, prediction stability monitoring, important model variable drift monitoring, and alarms for key monitoring indicator items. At the same time, visual charts are provided to view these monitoring indicators. The specific built-in monitoring indicators can be as follows:
[0082] Monitoring indicators for predictive stability, including predicted incoming volume, scoring PSI, scoring quantile distribution, scoring category monitoring - abnormal, special score, normal score, etc.
[0083] Monitoring indicators of model variable data drift, including data quality-null value rate, data distribution-quantile statistics, data stability-important variable binning PSI, etc.
[0084] Monitoring indicators of model effect discrimination include feedback data distribution-data quality ratio, effect discrimination-AUC, KS, Lift and variable discrimination-IV, etc.
[0085] In addition to the above-mentioned built-in monitoring indicators, other monitoring indicators can also be built-in, and this disclosure does not limit this. Of course, according to the technical solution of the present disclosure, custom indicators can also be constructed and reused. In this way, in the process of online application of the model, custom indicators can be added to monitor the model in combination with the key content of the model in the business. Only by satisfying the user-side customizable monitoring content can the model monitoring and business focus content be more closely integrated, and it can also meet the coverage of various application scenarios, reducing the development and use costs of indicators.
[0086] After obtaining various required indicators of a model, users can determine the operating effect of the model based on the values of various indicators they see, and then determine whether the model needs to be adjusted, etc., to achieve monitoring of the model.
[0087] Figure 7 FIG. 1 is a block diagram of a model monitoring device according to an exemplary embodiment of the present disclosure. Figure 7 As shown, the model monitoring device includes:
[0088] The acquisition unit 70 is configured to acquire an indicator strategy for a target monitoring indicator of a monitoring model, wherein the indicator strategy includes a calculation logic for the target monitoring indicator; the first creation unit 72 is configured to create a script for the target monitoring indicator based on the indicator strategy and the indicator script template; the second creation unit 74 is configured to create a directed acyclic graph for determining the target monitoring indicator based on the script and the running information of the model; the monitoring unit 76 is configured to monitor the model based on the directed acyclic graph.
[0089] According to the disclosed exemplary embodiment, the directed acyclic graph includes a directed acyclic graph file generation operator and a directed acyclic graph file submission operator. The monitoring unit 76 is also configured to generate a directed acyclic graph file through the directed acyclic graph file generation operator, and the directed acyclic graph file is a workflow composed of the running information of the script and the model; submit the directed acyclic graph file to the platform for scheduling and monitoring the workflow through the directed acyclic graph file submission operator, and receive the running results of the directed acyclic graph file on the platform; and monitor the model based on the running results.
[0090] According to the disclosed exemplary embodiment, the first creation unit 72 is further configured to determine a development language for creating a script for the target monitoring indicator; and create the script for the target monitoring indicator in the development language based on the indicator strategy and the indicator script template.
[0091] According to the disclosed exemplary embodiment, the monitoring unit 76 is also configured to adjust the position of the input parameter in the script to a configuration parameter after monitoring the model based on the directed acyclic graph, wherein the configuration parameter is set to be obtained from the running information of the model to be monitored and is of the same type as the input parameter; and save the adjusted script to the indicator library.
[0092] According to the disclosed exemplary embodiment, the monitoring unit 76 is further configured to simulate the execution of the script to obtain the value output by the script; determine the rule for selecting the value to be displayed from the value output by the script; and save the rule and the adjusted script to the indicator library.
[0093] According to the disclosed exemplary embodiment, the monitoring unit 76 is also configured to, after saving the adjusted script to the indicator library, obtain parameters corresponding to the configuration parameters in the adjusted script from the running information of the model to be monitored in response to the adjusted script in the indicator library being called; create a directed acyclic graph corresponding to the target monitoring indicator based on the adjusted script and the parameters; and monitor the model to be monitored based on the directed acyclic graph.
[0094] According to the disclosed exemplary embodiment, the monitoring unit 76 is further configured to obtain the value of the target monitoring indicator based on the directed acyclic graph; determine the value to be displayed from the value of the target monitoring indicator; and display the value to be displayed to the user.
[0095] According to the disclosed exemplary embodiment, the monitoring unit 76 is further configured to determine the indicator display style of the target monitoring indicator based on the indicator strategy; and display the value to be displayed to the user through the indicator display style.
[0096] The above has been referred to Figures 1 to 7 A model monitoring method and apparatus according to exemplary embodiments of the present disclosure are described.
[0097] Figure 7 Each unit in the model monitoring device shown can be configured as software, hardware, firmware or any combination of the above items to perform a specific function. For example, each unit can correspond to a dedicated integrated circuit, or a pure software code, or a module that combines software and hardware. In addition, one or more functions implemented by each unit can also be uniformly executed by components in a physical entity device (e.g., a processor, a client or a server, etc.).
[0098] In addition, refer to Figure 1 The described model monitoring method can be implemented by a program (or instruction) recorded on a computer-readable storage medium. For example, according to an exemplary embodiment of the present disclosure, a computer-readable storage medium storing instructions can be provided, wherein when the instructions are executed by at least one computing device, the at least one computing device is prompted to perform the model monitoring method according to the present disclosure.
[0099] The computer program in the computer-readable storage medium can be run in an environment deployed in a computer device such as a client, a host, an agent device, a server, etc. It should be noted that the computer program can also be used to perform additional steps in addition to the above steps or perform more specific processing when performing the above steps. The contents of these additional steps and further processing have been described in reference to Figure 1 It is mentioned in the description of the related method, so it will not be repeated here to avoid repetition.
[0100] It should be noted that the various units in the model monitoring device according to the exemplary embodiment of the present disclosure can completely rely on the operation of the computer program to realize the corresponding functions, that is, each unit corresponds to each step in the functional architecture of the computer program, so that the entire system is called through a special software package (for example, lib library) to realize the corresponding function.
[0101] on the other hand, Figure 7 The various units shown may also be implemented by hardware, software, firmware, middleware, microcode, or any combination thereof. When implemented by software, firmware, middleware, or microcode, the program code or code segment for performing the corresponding operation may be stored in a computer-readable medium such as a storage medium, so that the processor may perform the corresponding operation by reading and running the corresponding program code or code segment.
[0102] For example, an exemplary embodiment of the present disclosure may also be implemented as a computing device, which includes a storage component and a processor, wherein a set of computer executable instructions is stored in the storage component, and when the set of computer executable instructions is executed by the processor, a model monitoring method according to an exemplary embodiment of the present disclosure is executed.
[0103] Specifically, the computing device can be deployed in a server or client, or can be deployed on a node device in a distributed network environment. In addition, the computing device can be a PC, a tablet device, a personal digital assistant, a smart phone, a web application, or other device capable of executing the above instruction set.
[0104] Here, the computing device is not necessarily a single computing device, but may also be any device or circuit collection that can execute the above instructions (or instruction sets) individually or jointly. The computing device may also be part of an integrated control system or system manager, or may be configured as a portable electronic device that is interconnected with a local or remote (e.g., via wireless transmission) interface.
[0105] In a computing device, a processor may include a central processing unit (CPU), a graphics processing unit (GPU), a programmable logic device, a dedicated processor system, a microcontroller, or a microprocessor. By way of example and not limitation, a processor may also include an analog processor, a digital processor, a microprocessor, a multi-core processor, a processor array, a network processor, etc.
[0106] According to the exemplary embodiment of the present disclosure, some operations described in the model monitoring method may be implemented by software, some operations may be implemented by hardware, and furthermore, these operations may be implemented by a combination of software and hardware.
[0107] The processor may execute instructions or codes stored in one of the storage components, which may also store data. Instructions and data may also be sent and received over a network via a network interface device, which may employ any known transmission protocol.
[0108] The storage component may be integrated with the processor, for example, RAM or flash memory is arranged within an integrated circuit microprocessor, etc. In addition, the storage component may include a separate device, such as an external disk drive, a storage array, or any other storage device that can be used by a database system. The storage component and the processor may be operatively coupled, or may communicate with each other, such as through an I / O port, a network connection, etc., so that the processor can read files stored in the storage component.
[0109] In addition, the computing device may also include a video display (such as a liquid crystal display) and a user interaction interface (such as a keyboard, a mouse, a touch input device, etc.) All components of the computing device may be connected to each other via a bus and / or a network.
[0110] The model monitoring method according to the exemplary embodiment of the present disclosure can be described as various interconnected or coupled functional blocks or functional diagrams. However, these functional blocks or functional diagrams can be equally integrated into a single logical device or operate according to non-precise boundaries.
[0111] Therefore, refer to Figure 1 The described model monitoring method may be implemented by a system including at least one computing device and at least one storage device storing instructions.
[0112] According to an exemplary embodiment of the present disclosure, at least one computing device is a computing device for executing a model monitoring method according to an exemplary embodiment of the present disclosure, and a computer executable instruction set is stored in the storage device. When the computer executable instruction set is executed by the at least one computing device, the execution reference Figure 1 Model monitoring approach described.
[0113] The above describes various exemplary embodiments of the present disclosure, and it should be understood that the above description is only exemplary and not exhaustive, and the present disclosure is not limited to the disclosed exemplary embodiments. Without departing from the scope and spirit of the present disclosure, many modifications and changes are obvious to those of ordinary skill in the art. Therefore, the scope of protection of the present disclosure should be based on the scope of the claims.
Claims
1. A model monitoring method, wherein: The method comprises: Acquire an indicator strategy for a target monitoring indicator of a monitoring model, wherein the indicator strategy includes a calculation logic of the target monitoring indicator; Based on the indicator strategy and indicator script template, create a script for the target monitoring indicator; Based on the operation information of the script and the model, creating a directed acyclic graph for determining the target monitoring indicator; Based on the directed acyclic graph, the model is monitored.
2. The model monitoring method according to claim 1, wherein: The directed acyclic graph includes a directed acyclic graph file generation operator and a directed acyclic graph file submission operator. The monitoring of the model based on the directed acyclic graph includes: Generate a directed acyclic graph file by using the directed acyclic graph file generation operator, wherein the directed acyclic graph file is a workflow composed of the script and the running information of the model; Submitting the directed acyclic graph file to a platform for scheduling and monitoring workflows through the directed acyclic graph file submission operator, and receiving the running result of the directed acyclic graph file on the platform; Based on the operation result, the model is monitored.
3. The model monitoring method according to claim 1, wherein: The step of creating a script for the target monitoring indicator based on the indicator strategy and the indicator script template includes: Determine the development language of the script for creating the target monitoring indicator; Based on the indicator strategy and the indicator script template, a script for the target monitoring indicator is created in the development language.
4. The model monitoring method according to claim 1, wherein: After monitoring the model based on the directed acyclic graph, the method further includes: Adjusting the position of the input parameter in the script to a configuration parameter, wherein the configuration parameter is set to be obtained from the running information of the model to be monitored and is of the same type as the input parameter; Save the adjusted script to the indicator library.
5. The model monitoring method according to claim 4, wherein: The step of saving the adjusted script to the indicator library includes: Simulate the execution of the script to obtain the value output by the script; Determining a rule for selecting a value to be displayed from the values output by the script; The rules and the adjusted scripts are saved in the indicator library.
6. The model monitoring method according to claim 4, wherein: After saving the adjusted script to the indicator library, it also includes: In response to the adjusted script in the indicator library being called, obtaining parameters corresponding to the configuration parameters in the adjusted script from the operation information of the model to be monitored; Based on the adjusted script and the parameters, creating a directed acyclic graph corresponding to the target monitoring indicator; Based on the directed acyclic graph, the model to be monitored is monitored.
7. The model monitoring method according to claim 1, wherein: The monitoring of the model based on the directed acyclic graph includes: Based on the directed acyclic graph, obtaining a value of the target monitoring indicator; Determining a value to be displayed from the value of the target monitoring indicator; The value to be displayed is displayed to the user.
8. A model monitoring device, wherein: The device comprises: An acquisition unit is configured to acquire an indicator strategy for a target monitoring indicator of a monitoring model, wherein the indicator strategy includes a calculation logic of the target monitoring indicator; A first creation unit is configured to create a script of the target monitoring indicator based on the indicator strategy and the indicator script template; A second creation unit is configured to create a directed acyclic graph for determining the target monitoring indicator based on the script and the running information of the model; The monitoring unit is configured to monitor the model based on the directed acyclic graph.
9. A computer-readable storage medium storing instructions, wherein: When the instructions are executed by at least one computing device, the at least one computing device is prompted to perform the model monitoring method according to any one of claims 1 to 7.
10. A system comprising at least one computing device and at least one storage device storing instructions, wherein: When the instructions are executed by the at least one computing device, the at least one computing device is prompted to perform the model monitoring method according to any one of claims 1 to 7.
