CN113222459A - System and method for dynamically constructing food uncertainty evaluation model by expression tree - Google Patents
System and method for dynamically constructing food uncertainty evaluation model by expression tree Download PDFInfo
- Publication number
- CN113222459A CN113222459A CN202110600480.5A CN202110600480A CN113222459A CN 113222459 A CN113222459 A CN 113222459A CN 202110600480 A CN202110600480 A CN 202110600480A CN 113222459 A CN113222459 A CN 113222459A
- Authority
- CN
- China
- Prior art keywords
- uncertainty
- model
- expression
- data
- operator
- 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
Links
- 230000014509 gene expression Effects 0.000 title claims abstract description 116
- 238000000034 method Methods 0.000 title claims abstract description 35
- 238000013210 evaluation model Methods 0.000 title claims abstract description 22
- 238000011156 evaluation Methods 0.000 claims abstract description 29
- 238000007689 inspection Methods 0.000 claims abstract description 17
- 238000012800 visualization Methods 0.000 claims abstract description 7
- 238000013461 design Methods 0.000 claims description 36
- 238000004364 calculation method Methods 0.000 claims description 30
- 238000013507 mapping Methods 0.000 claims description 27
- 238000010276 construction Methods 0.000 claims description 18
- 230000015572 biosynthetic process Effects 0.000 claims description 16
- 238000012545 processing Methods 0.000 claims description 16
- 238000003786 synthesis reaction Methods 0.000 claims description 16
- 230000003993 interaction Effects 0.000 claims description 13
- 238000004458 analytical method Methods 0.000 claims description 9
- 230000002194 synthesizing effect Effects 0.000 claims description 7
- 238000007620 mathematical function Methods 0.000 claims description 4
- 238000004891 communication Methods 0.000 claims description 2
- 238000001514 detection method Methods 0.000 abstract description 18
- 238000012854 evaluation process Methods 0.000 abstract description 2
- 238000010561 standard procedure Methods 0.000 abstract 1
- 238000005259 measurement Methods 0.000 description 8
- 238000012360 testing method Methods 0.000 description 4
- 238000002474 experimental method Methods 0.000 description 3
- 238000013479 data entry Methods 0.000 description 2
- 230000007547 defect Effects 0.000 description 2
- 238000010586 diagram Methods 0.000 description 2
- 238000013178 mathematical model Methods 0.000 description 2
- 238000012821 model calculation Methods 0.000 description 2
- 238000013515 script Methods 0.000 description 2
- 239000000126 substance Substances 0.000 description 2
- 238000005303 weighing Methods 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000005538 encapsulation Methods 0.000 description 1
- 230000007246 mechanism Effects 0.000 description 1
- 238000003752 polymerase chain reaction Methods 0.000 description 1
- 238000011160 research Methods 0.000 description 1
- 230000003068 static effect Effects 0.000 description 1
- 238000012795 verification Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06Q—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06Q10/00—Administration; Management
- G06Q10/06—Resources, workflows, human or project management; Enterprise or organisation planning; Enterprise or organisation modelling
- G06Q10/063—Operations research, analysis or management
- G06Q10/0639—Performance analysis of employees; Performance analysis of enterprise or organisation operations
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/80—Information retrieval; Database structures therefor; File system structures therefor of semi-structured data, e.g. markup language structured data such as SGML, XML or HTML
- G06F16/81—Indexing, e.g. XML tags; Data structures therefor; Storage structures
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/80—Information retrieval; Database structures therefor; File system structures therefor of semi-structured data, e.g. markup language structured data such as SGML, XML or HTML
- G06F16/84—Mapping; Conversion
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/90—Details of database functions independent of the retrieved data types
- G06F16/901—Indexing; Data structures therefor; Storage structures
- G06F16/9027—Trees
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F40/00—Handling natural language data
- G06F40/10—Text processing
- G06F40/166—Editing, e.g. inserting or deleting
- G06F40/186—Templates
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Business, Economics & Management (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Databases & Information Systems (AREA)
- Human Resources & Organizations (AREA)
- General Engineering & Computer Science (AREA)
- Data Mining & Analysis (AREA)
- Educational Administration (AREA)
- Entrepreneurship & Innovation (AREA)
- Development Economics (AREA)
- Software Systems (AREA)
- Strategic Management (AREA)
- Economics (AREA)
- Marketing (AREA)
- Game Theory and Decision Science (AREA)
- Computational Linguistics (AREA)
- General Health & Medical Sciences (AREA)
- Operations Research (AREA)
- Quality & Reliability (AREA)
- Tourism & Hospitality (AREA)
- General Business, Economics & Management (AREA)
- Audiology, Speech & Language Pathology (AREA)
- Artificial Intelligence (AREA)
- Health & Medical Sciences (AREA)
- Management, Administration, Business Operations System, And Electronic Commerce (AREA)
Abstract
The invention relates to the field of food inspection and detection, in particular to a result uncertainty evaluation item aiming at food inspection and detection, which is applied to selecting a proper detection standard method or detection basis according to a food detection requirement item, solidifying a detection process and evaluating the uncertainty of a result. Specifically disclosed are a system and a method for dynamically constructing a food uncertainty evaluation model from an expression tree. According to the system and the method disclosed by the invention, the basic uncertainty models are selected and combined through the actual evaluation requirements to obtain the synthetic uncertainty model, so that the uncertainty evaluation of the detection items is realized; meanwhile, the system visualization evaluation process is added, so that the difficulty in researching and designing various uncertain evaluation models is reduced. When the basic uncertain model is selected, the model base can be called from a large number of model bases, and the synthesized uncertainty model is established by calling the mature model, so that a large amount of time cost can be saved, and the evaluation efficiency can be improved.
Description
Technical Field
The invention relates to the technical field of food inspection and detection, in particular to a system and a method for dynamically constructing a food uncertainty evaluation model by using an expression tree, which are applied to a process of selecting and detecting items according to food inspection requirement items aiming at detection item uncertainty items in a food inspection and detection process.
Background
The uncertainty evaluation of the food safety inspection result does not have a clear and unified mathematical model. According to the research of an uncertain evaluation system of food inspection results, when the experimental items are different, the sources of the uncertainty of the inspection results are different; uncertainty sources are different, calculation models of the uncertainty sources are also different, uncertain synthesis calculation models of different sources are also different, even uncertainty of some sources can be decomposed into uncertainty of different sub-sources, and therefore the uncertainty evaluation mathematical model expression can obtain scientific, comprehensive and accurate final uncertainty only by performing combined calculation on each most basic calculation model in different levels and different modes. The complexity, uncertainty, etc. of such models cannot be exhaustive to arrive at all possible combinations to make a practical test.
Most of the existing food inspection informatization systems only carry out static recording and archiving on experiment original data and inspection results, and do not provide support for designing calculation, or some systems provide limited capability for designing calculation by providing plug-in scripts, extended macros and other mechanisms, but also have high threshold requirements on user with considerable script programming capability. The application of an uncertain evaluation model in an information system is limited, and the uncertainty, which is an important inspection result accuracy index, is less popularized in the industry.
Therefore, the detection items for food are numerous, different detection requirement combinations are difficult to exhaust, the existing food detection is not automatic and intelligent enough, the difficulty of the food detection is increased, the efficiency of the food detection is difficult to promote, a more reasonable technical scheme needs to be provided, and the defects in the prior art are overcome.
Disclosure of Invention
In order to solve the defects of the prior art mentioned in the above, the invention provides a system and a method for dynamically constructing a food uncertainty evaluation model by an expression tree, wherein a plurality of calling modules for constructing the uncertainty model are integrated in the system, required modules are selected from different calling modules according to actual evaluation requirements, and corresponding parameter mapping relations are called to synthesize a final evaluation calculation model, so that the corresponding uncertainty is quickly evaluated and obtained.
In order to achieve the purpose, the invention specifically adopts the technical scheme that:
a system for dynamically constructing a food uncertainty evaluation model from an expression tree, comprising:
the design module comprises a basic uncertainty design unit, a synthetic uncertainty design unit, a data form design unit and a mapping unit, wherein the synthetic uncertainty design unit receives data of the basic uncertainty design unit, and the mapping unit receives data of the synthetic uncertainty design unit and the data form design unit;
the execution module comprises a form construction unit and a data unit, wherein the form construction unit receives the data of the form design unit, and the data unit receives the data of the form construction unit;
and the analysis module comprises an expression construction unit and a calculation unit, wherein the expression construction unit receives the data of the mapping unit, and the calculation unit receives the data of the expression construction unit and the data unit.
The system disclosed above determines the uncertainty to be evaluated according to the actual detection requirements, integrates limited, most basic, common operation and other basic data processing units, combines uncertainty processing models of various most basic sources according to the data processing units, and combines uncertainty processing models of different sources into a synthetic uncertainty processing model of the project according to the project. When the uncertainty is calculated specifically, according to a given parameter mapping relation, the original data is brought into a corresponding project uncertainty synthesis calculation model for calculation, and therefore uncertainty of the result is obtained.
Furthermore, in order to enhance the interaction efficiency of the system, the system further comprises a visualization module, wherein the visualization module is connected and communicated with the analysis module and is used for displaying the analysis process and the result.
The invention also discloses a method for establishing the uncertainty evaluation model, which is specifically explained as follows:
a method for dynamically constructing a food uncertainty evaluation model from an expression tree, comprising,
the design steps are as follows:
setting a plurality of basic uncertainty models according to evaluation requirements, wherein each model corresponds to one evaluation uncertainty;
synthesizing the selected basic uncertainty model to obtain a synthesized uncertainty model;
setting a data form which needs to be calculated by the synthesis uncertainty model according to the obtained synthesis uncertainty model;
mapping and associating the data form with the synthetic uncertainty model;
an interaction step:
providing a data demand by the synthetic uncertainty model, and generating and sending a calculation demand after data is obtained;
and (3) analyzing:
and analyzing and compiling according to the calculation requirement, and performing dynamic execution to obtain the final uncertainty.
Furthermore, a plurality of basic uncertainty models are set, wherein the basic uncertainty models are obtained by analyzing and modeling uncertainty of a specific source, and comprise model input parameters defining, expression character string calculating and storing. When the scheme is adopted, a basic uncertainty model can be established according to different evaluation purposes.
Further, the synthesizing the selected base uncertainty model to obtain the synthetic uncertainty model includes analyzing the inspection item, identifying the uncertainty of the specific source in the item, and modeling the synthesis of the uncertainty of each source. When the scheme is adopted, a plurality of basic uncertainty models can be selected to obtain a synthetic uncertainty model, so that all uncertainty required by evaluation is met.
Further, interaction is needed to be carried out before evaluation so as to input corresponding parameter data, specifically, a data form which needs to be operated by the synthetic uncertainty model is set according to the obtained synthetic uncertainty model, the method comprises the steps of collecting an original data item list, designing an original data form template of an item, and carrying out data interaction according to the form template in the checking process.
Further, the mapping association of the data form with the synthetic uncertainty model includes performing corresponding association setting on data form items and model parameters, so that the data form becomes a data source of the parameters.
Further, the analyzing and compiling according to the calculation requirement comprises initializing a function dictionary and loading a built-in function; and polling each model for parsing and compiling.
Still further, the polling each model for parsing and compiling includes the following steps:
s1: taking out the affix expression in the function body, and initializing an operator stack s1 and an intermediate result stack s 2;
s2: scanning infix expressions from right to left;
s3: when an operand is encountered, it is pushed to s 2;
s4: when an operator is encountered, comparing it with the priority of the s1 stack top operator;
s4.1: if s1 is empty, or the top of stack operator is right parenthesis ")", then directly push this operator onto the stack;
s4.2: otherwise, if the priority is higher than or equal to the top of stack operator, press the operator to s 1;
s4.3: otherwise, pop the top of stack operator of S1 and push it into S2, go to S4.1 again and compare it with the new top of stack operator in S1;
s5: when parentheses are encountered, the following two steps are followed:
s5.1: if right bracket ")", press directly into s 1;
s5.2: if it is left bracket "(", pop the operator at the top of the stack of S1 in turn and push S2 until the right bracket is encountered, at which point the pair of brackets is discarded;
s6: repeating steps S2-S5 until the leftmost of the expression is reached;
s7: popping up and pressing the rest operators in s1 into s2 in sequence;
s8: sequentially popping up elements in s2 to form a new character string sequence which is the corresponding prefix expression;
s9: initializing an expression stack s3, scanning prefix expressions from right to left, and sequentially pushing dynamic expressions corresponding to operands into a stack s 3;
s9.1: if the operand is a constant, constructing a decimal constant lambda expression, wherein the value is a constant value;
s9.2: if the operand is a variable, constructing a real parameter lambda expression with a data type of decimal, wherein the name is a variable name;
s9.3: if the operand is a basic mathematical function call, function names and parameter lists are analyzed, and dictionary lookup is carried out through the function names to obtain corresponding lambda expressions;
s9.4: if the operand is called by a model formula, performing dictionary lookup by calling a function name;
s9.4.1: if the dictionary does not have the keyword, searching the model definition, creating a dynamic lambda expression by the model recursion step 1, wherein the name is the model name, and loading the dynamic lambda expression to a function dictionary;
s9.4.2: if the keyword exists in the dictionary, directly returning to the corresponding lambda expression;
s10: until an operator is met, the stack s3 pops up the lambda expressions of the data with the same number of the operator, constructs parameter lambda expressions, searches a function dictionary with the operator to obtain the operator processing lambda expressions, creates calling lambda expressions according to the operator processing lambda expressions, and pushes the calling lambda expressions into the stack s 3;
s11: popping up the lambda expression in the stack s3 until the last prefix expression element is scanned, namely the final expression tree;
s12: the model definition name Key loads the final expression into the function dictionary.
Further, the performing dynamic execution to obtain the final uncertainty includes the following steps:
s1: searching the model definition of the item, and searching a function dictionary by taking the name of the model definition as Key to obtain a corresponding dynamic expression;
s2: searching form data in the steps of mapping configuration and interaction of model parameters and form items, and constructing real parameter expressions called by expression trees
S3: and transmitting the Invoke of the dynamic expression by the parameter expression, and converting a returned result into decimal, namely an evaluation result.
Compared with the prior art, the invention has the beneficial effects that:
according to the system and the method disclosed by the invention, the basic uncertainty models are selected and combined through actual evaluation requirements to obtain a synthetic uncertainty model, so that the uncertainty flatness of the detection project is realized; meanwhile, the system visualization evaluation process is added, so that the difficulty in researching and designing various uncertain evaluation models is reduced. When the basic uncertain model is selected, the model base can be called from a large number of model bases, and the synthesized uncertainty model is established by calling the mature model, so that a large amount of time cost can be saved, and the evaluation efficiency can be improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the embodiments will be briefly described below, it should be understood that the following drawings only show some embodiments of the present invention, and therefore should not be considered as limiting the scope, and for those skilled in the art, other related drawings can be obtained according to the drawings without inventive efforts.
FIG. 1 is a block diagram of the system.
Fig. 2 is a schematic diagram of the internal components and logic of each module.
Detailed Description
The invention is further explained below with reference to the drawings and the specific embodiments.
It should be noted that the description of the embodiments is provided to help understanding of the present invention, but the present invention is not limited thereto. Specific structural and functional details disclosed herein are merely illustrative of example embodiments of the invention. This invention may, however, be embodied in many alternate forms and should not be construed as limited to the embodiments set forth herein.
Example 1
As shown in fig. 1 and 2, the system for dynamically constructing a food uncertainty evaluation model from an expression tree includes:
the design module comprises a basic uncertainty design unit, a synthetic uncertainty design unit, a data form design unit and a mapping unit, wherein the synthetic uncertainty design unit receives data of the basic uncertainty design unit, and the mapping unit receives data of the synthetic uncertainty design unit and the data form design unit;
the execution module comprises a form construction unit and a data unit, wherein the form construction unit receives the data of the form design unit, and the data unit receives the data of the form construction unit;
and the analysis module comprises an expression construction unit and a calculation unit, wherein the expression construction unit receives the data of the mapping unit, and the calculation unit receives the data of the expression construction unit and the data unit.
The system disclosed above determines the uncertainty to be evaluated according to the actual detection requirements, integrates limited, most basic, common operation and other basic data processing units, combines uncertainty processing models of various most basic sources according to the data processing units, and combines uncertainty processing models of different sources into a synthetic uncertainty processing model of the project according to the project. When the uncertainty is calculated specifically, according to a given parameter mapping relation, the original data is brought into a corresponding project uncertainty synthesis calculation model for calculation, and therefore uncertainty of the result is obtained.
In this embodiment, in order to enhance the interaction efficiency of the system, the system further includes a visualization module, and the visualization module is connected to the parsing module for communication and is used for displaying the parsing process and the result.
Example 2
The embodiment also discloses a method for establishing an uncertainty evaluation model, which is specifically described as follows:
the method for dynamically constructing the food uncertainty evaluation model by the expression tree specifically comprises the following steps:
s1: design step
S101: setting a plurality of basic uncertainty models according to evaluation requirements, wherein each model corresponds to one evaluation uncertainty;
s102: synthesizing the selected basic uncertainty model to obtain a synthesized uncertainty model;
s103: setting a data form which needs to be calculated by the synthesis uncertainty model according to the obtained synthesis uncertainty model;
s104: mapping and associating the data form with the synthetic uncertainty model;
s2: interaction step
Providing a data demand by the synthetic uncertainty model, and generating and sending a calculation demand after data is obtained;
s3: step of analysis
S301: and analyzing and compiling according to the calculation requirement, and performing dynamic execution to obtain the final uncertainty.
The method comprises the steps of setting a plurality of basic uncertainty models, wherein the basic uncertainty models are obtained by analyzing and modeling uncertainty of a specific source, and comprise the steps of defining model input parameters, calculating expression character strings and storing the expression character strings. When the scheme is adopted, a basic uncertainty model can be established according to different evaluation purposes.
For example, a model of uncertainty (typically calculated using standard deviation) due to repeated measurements, and a mathematical function as follows, f (x) stdev (x), the model may be defined as follows:
the model name: func
Inputting parameters: sequential parameter name data type
1x decimal[]
Function body: stdev (x)
Complete model function func (x) stdev (x)
The definition of the basic uncertainty model is the encapsulation of general calculation steps in the uncertainty calculation process, and is convenient for repeated calling in different evaluation requirements without paying attention to the internal process.
In this embodiment, the synthesizing the selected basic uncertainty model to obtain the synthetic uncertainty model includes analyzing the inspection item, identifying the uncertainty of a specific source in the item, and modeling the synthesis of the uncertainty of each source. When the scheme is adopted, a plurality of basic uncertainty models can be selected to obtain a synthetic uncertainty model, so that all uncertainty required by evaluation is met.
For example, in a food inspection project, there are 3 uncertain sources introduced by the test process, which are respectively func1(x, y), func2(a, b, c) and func3(k), and assuming that all are already defined in the basic model, the contract model of the project is defined as follows:
the model name: func _ com
Function body: round (pow (func1(x, y),2) + pow (func2(x + y + z),2) + pow (func3(z),2),1/2),2)
The complete model function: func _ com (x, y, z) ═ f
round(pow(pow(func1(x,y),2)+pow(func2(x+y+z),2)+pow(func3(z),2),1/2),2)
Before evaluation, interaction is needed to be carried out to input corresponding parameter data, specifically, a data form which needs to be synthesized with the uncertainty model for operation is set according to the obtained synthesis uncertainty model, an original data item list is collected, an original data form template of an item is designed, and data interaction is carried out according to the form template in the checking process.
The form template definition comprises a form name and a data item list (data item name, data type, control type and presentation sequence number).
For example, a polymerase chain reaction analyzer calibrates the raw record form template (part):
list name: food _ form1
Form templates guide the laboratory operator in collecting data ranges, criteria, which enable them to provide normative data input for project model calculations.
In this embodiment, the mapping and associating the data form with the synthetic uncertainty model includes performing corresponding association setting on data form items and model parameters, so that the data form becomes a data source of the parameters.
When the mapping data items and the parameters are associated, the data types of the data items and the parameter data types are required to be consistent, and the data items of the document type control cannot be mapped to the project model parameters; the associated form template data items must be specified for each model parameter; the same form template data item may be associated to different parameters of the project model.
Model: fun (x, y, z) ═ round (Sqrt (x,2) + pow (func1(y),2) + pow (z)), (4)
Form: form _ xxx
The analyzing and compiling according to the calculation requirement comprises initializing a function dictionary and loading a built-in function; and polling each model for parsing and compiling.
Preferably, the polling each model for parsing and compiling includes the following steps:
s1: taking out the affix expression in the function body, and initializing an operator stack s1 and an intermediate result stack s 2;
s2: scanning infix expressions from right to left;
s3: when an operand is encountered, it is pushed to s 2;
s4: when an operator is encountered, comparing it with the priority of the s1 stack top operator;
s4.1: if s1 is empty, or the top of stack operator is right parenthesis ")", then directly push this operator onto the stack;
s4.2: otherwise, if the priority is higher than or equal to the top of stack operator, press the operator to s 1;
s4.3: otherwise, pop the top of stack operator of S1 and push it into S2, go to S4.1 again and compare it with the new top of stack operator in S1;
s5: when parentheses are encountered, the following two steps are followed:
s5.1: if right bracket ")", press directly into s 1;
s5.2: if it is left bracket "(", pop the operator at the top of the stack of S1 in turn and push S2 until the right bracket is encountered, at which point the pair of brackets is discarded;
s6: repeating steps S2-S5 until the leftmost of the expression is reached;
s7: popping up and pressing the rest operators in s1 into s2 in sequence;
s8: sequentially popping up elements in s2 to form a new character string sequence which is the corresponding prefix expression;
s9: initializing an expression stack s3, scanning prefix expressions from right to left, and sequentially pushing dynamic expressions corresponding to operands into a stack s 3;
s9.1: if the operand is a constant, constructing a decimal constant lambda expression, wherein the value is a constant value;
s9.2: if the operand is a variable, constructing a real parameter lambda expression with a data type of decimal, wherein the name is a variable name;
s9.3: if the operand is a basic mathematical function call, function names and parameter lists are analyzed, and dictionary lookup is carried out through the function names to obtain corresponding lambda expressions;
s9.4: if the operand is called by a model formula, performing dictionary lookup by calling a function name;
s9.4.1: if the dictionary does not have the keyword, searching the model definition, creating a dynamic lambda expression by the model recursion step 1, wherein the name is the model name, and loading the dynamic lambda expression to a function dictionary;
s9.4.2: if the keyword exists in the dictionary, directly returning to the corresponding lambda expression;
s10: until an operator is met, the stack s3 pops up the lambda expressions of the data with the same number of the operator, constructs parameter lambda expressions, searches a function dictionary with the operator to obtain the operator processing lambda expressions, creates calling lambda expressions according to the operator processing lambda expressions, and pushes the calling lambda expressions into the stack s 3;
s11: popping up the lambda expression in the stack s3 until the last prefix expression element is scanned, namely the final expression tree;
s12: the model definition name Key loads the final expression into the function dictionary.
Preferably, the performing dynamically to obtain the final uncertainty includes the following steps:
s1: searching the model definition of the item, and searching a function dictionary by taking the name of the model definition as Key to obtain a corresponding dynamic expression;
s2: searching form data in the steps of mapping configuration and interaction of model parameters and form items, and constructing real parameter expressions called by expression trees
S3: and transmitting the Invoke of the dynamic expression by the parameter expression, and converting a returned result into decimal, namely an evaluation result.
When the method in the present embodiment is applied specifically, one example is given here.
Content inspection item of YY substance in certain food (for convenience of description, only the repeatability measurement and the uncertainty brought by a balance are considered, and a user inputs and displays information and only focuses on data related to uncertain model calculation)
And (3) a project design stage:
1. design of repeatability measurement uncertainty model
The uncertainty of repeatability measurement, i.e., the calculation of standard deviation, relates to the standard deviation of the basic mathematical formula (STDEV), approximate evaluation (ROUND)
Defining variables: array-representing 1 to a plurality of sets of measurement values; the variable d represents the decimal place that the result is to retain.
Repeatability measurement uncertainty formula: ROUND (stdev (array), d).
2. Design of synthetic uncertainty model for YY substance content verification project in food
The basic mathematical formula includes POWER Operation (POWER) and approximate evaluation (ROUND)
Definitions variable m-uncertainty value representing a specific weighing balance (origin certificate of origin)
Synthesizing an uncertainty formula: ROUND (POWER (fun1(array, d),2) + POWER (m, N),1/2), d).
3. Data form template definition
item 1: sample repetition measure (array input control):
item 2: decimal accurate digit (integer input control)
item 3: scale uncertainty value (numerical input control)
4. Model parameter and data table entry mapping
Parameter array mapping item1
Parameter d mapping item2
Parameter m mapping item3
5. Experiment execution phase
During the testing experiment, the system displays the original data entry interface (the system dynamically generates according to the form design)
6. Data entry
The data entered by the experimenter when testing the samples were as follows:
repeatability measurements: 5.02,5.01,5.03,5.01,5.02
Decimal accurate digit: 4
Weighing balance uncertainty value: 0.0052
7. System calculated results
According to the project, the system automatically calls the corresponding formula
Automatically bringing the data input by experimenters into calculation according to the mapping relation of the parameters/data items
1) Repeatability measurement uncertainty
The formula: fun1 (ROUND, d)
And (3) calculating the result: 0.0084
2) Synthetic uncertainty:
the formula: fun (array, d, m) ═ ROUND (POWER (fun1(array, d),2) + POWER (m, N),1/2), d)
And (3) calculating the result: 0.0099
The system displays the results (the system dynamically displays user input, source uncertainty, synthesis uncertainty based on model design and form design)
The above embodiments are just exemplified in the present embodiment, but the present embodiment is not limited to the above alternative embodiments, and those skilled in the art can obtain other various embodiments by arbitrarily combining with each other according to the above embodiments, and any other various embodiments can be obtained by anyone in light of the present embodiment. The above detailed description should not be construed as limiting the scope of the present embodiments, which should be defined in the claims, and the description should be used for interpreting the claims.
Claims (10)
1. A system for dynamically constructing a food uncertainty evaluation model from an expression tree, comprising:
the design module comprises a basic uncertainty design unit, a synthetic uncertainty design unit, a data form design unit and a mapping unit, wherein the synthetic uncertainty design unit receives data of the basic uncertainty design unit, and the mapping unit receives data of the synthetic uncertainty design unit and the data form design unit;
the execution module comprises a form construction unit and a data unit, wherein the form construction unit receives the data of the form design unit, and the data unit receives the data of the form construction unit;
and the analysis module comprises an expression construction unit and a calculation unit, wherein the expression construction unit receives the data of the mapping unit, and the calculation unit receives the data of the expression construction unit and the data unit.
2. The system for dynamically building a food uncertainty evaluation model from an expression tree as claimed in claim 1, wherein: the analysis module is connected with the visualization module for communication and is used for displaying the analysis process and the analysis result.
3. A method for dynamically constructing a food uncertainty evaluation model from an expression tree, comprising,
the design steps are as follows:
setting a plurality of basic uncertainty models according to evaluation requirements, wherein each model corresponds to one evaluation uncertainty;
synthesizing the selected basic uncertainty model to obtain a synthesized uncertainty model;
setting a data form which needs to be calculated by the synthesis uncertainty model according to the obtained synthesis uncertainty model;
mapping and associating the data form with the synthetic uncertainty model;
an interaction step:
providing a data demand by the synthetic uncertainty model, and generating and sending a calculation demand after data is obtained;
and (3) analyzing:
and analyzing and compiling according to the calculation requirement, and performing dynamic execution to obtain the final uncertainty.
4. The method of dynamically constructing a food uncertainty evaluation model from an expression tree as claimed in claim 3, wherein:
the method comprises the steps of setting a plurality of basic uncertainty models, wherein the basic uncertainty models are obtained by analyzing and modeling uncertainty of a specific source, and comprise the steps of defining model input parameters, calculating expression character strings and storing the expression character strings.
5. The method of dynamically constructing a food uncertainty evaluation model from an expression tree as claimed in claim 4, wherein:
the synthesizing of the selected basic uncertainty model to obtain the synthetic uncertainty model comprises analyzing the inspection project, identifying the uncertainty of specific sources in the project, and modeling the synthesis of the uncertainty of each source.
6. The method of dynamically constructing a food uncertainty evaluation model from an expression tree as claimed in claim 3, wherein:
and setting a data form which needs to be operated by the synthesis uncertainty model according to the obtained synthesis uncertainty model, wherein the step of collecting an original data item list and designing an original data form template of the item comprises the steps of carrying out data interaction according to the form template in the inspection process.
7. The method of dynamically constructing a food uncertainty evaluation model from an expression tree as claimed in claim 3, wherein:
the mapping association of the data form and the synthetic uncertainty model comprises the corresponding association setting of data form items and model parameters, so that the data form becomes a data source of the parameters.
8. The method of dynamically constructing a food uncertainty evaluation model from an expression tree as claimed in claim 3, wherein:
the analyzing and compiling according to the calculation requirement comprises initializing a function dictionary and loading a built-in function; and polling each model for parsing and compiling.
9. The method of claim 8, wherein said polling each model for parsing and compiling comprises the steps of:
s1: taking out the affix expression in the function body, and initializing an operator stack s1 and an intermediate result stack s 2;
s2: scanning infix expressions from right to left;
s3: when an operand is encountered, it is pushed to s 2;
s4: when an operator is encountered, comparing it with the priority of the s1 stack top operator;
s4.1: if s1 is empty, or the top of stack operator is right parenthesis ")", then directly push this operator onto the stack;
s4.2: otherwise, if the priority is higher than or equal to the top of stack operator, press the operator to s 1;
s4.3: otherwise, pop the top of stack operator of S1 and push it into S2, go to S4.1 again and compare it with the new top of stack operator in S1;
s5: when parentheses are encountered, the following two steps are followed:
s5.1: if right bracket ")", press directly into s 1;
s5.2: if it is left bracket "(", pop the operator at the top of the stack of S1 in turn and push S2 until the right bracket is encountered, at which point the pair of brackets is discarded;
s6: repeating steps S2-S5 until the leftmost of the expression is reached;
s7: popping up and pressing the rest operators in s1 into s2 in sequence;
s8: sequentially popping up elements in s2 to form a new character string sequence which is the corresponding prefix expression;
s9: initializing an expression stack s3, scanning prefix expressions from right to left, and sequentially pushing dynamic expressions corresponding to operands into a stack s 3;
s9.1: if the operand is a constant, constructing a decimal constant lambda expression, wherein the value is a constant value;
s9.2: if the operand is a variable, constructing a real parameter lambda expression with a data type of decimal, wherein the name is a variable name;
s9.3: if the operand is a basic mathematical function call, function names and parameter lists are analyzed, and dictionary lookup is carried out through the function names to obtain corresponding lambda expressions;
s9.4: if the operand is called by a model formula, performing dictionary lookup by calling a function name;
s9.4.1: if the dictionary does not have the keyword, searching the model definition, creating a dynamic lambda expression by the model recursion step 1, wherein the name is the model name, and loading the dynamic lambda expression to a function dictionary;
s9.4.2: if the keyword exists in the dictionary, directly returning to the corresponding lambda expression;
s10: until an operator is met, the stack s3 pops up the lambda expressions of the data with the same number of the operator, constructs parameter lambda expressions, searches a function dictionary with the operator to obtain the operator processing lambda expressions, creates calling lambda expressions according to the operator processing lambda expressions, and pushes the calling lambda expressions into the stack s 3;
s11: popping up the lambda expression in the stack s3 until the last prefix expression element is scanned, namely the final expression tree;
s12: the model definition name Key loads the final expression into the function dictionary.
10. The method of claim 3, wherein the dynamically performing to obtain the final uncertainty comprises the steps of:
s1: searching the model definition of the item, and searching a function dictionary by taking the name of the model definition as Key to obtain a corresponding dynamic expression;
s2: searching form data in the steps of mapping configuration and interaction of model parameters and form items, and constructing real parameter expressions called by expression trees
S3: and transmitting the Invoke of the dynamic expression by the parameter expression, and converting a returned result into decimal, namely an evaluation result.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110600480.5A CN113222459A (en) | 2021-05-31 | 2021-05-31 | System and method for dynamically constructing food uncertainty evaluation model by expression tree |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110600480.5A CN113222459A (en) | 2021-05-31 | 2021-05-31 | System and method for dynamically constructing food uncertainty evaluation model by expression tree |
Publications (1)
Publication Number | Publication Date |
---|---|
CN113222459A true CN113222459A (en) | 2021-08-06 |
Family
ID=77081899
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110600480.5A Pending CN113222459A (en) | 2021-05-31 | 2021-05-31 | System and method for dynamically constructing food uncertainty evaluation model by expression tree |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113222459A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115826932A (en) * | 2023-02-10 | 2023-03-21 | 中国电子科技集团公司第十五研究所 | Evaluation model and evaluation model construction method |
CN116402480A (en) * | 2023-06-07 | 2023-07-07 | 成都普朗克科技有限公司 | Method and system for outputting inventory based on association rule self-built model |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102043757A (en) * | 2010-12-20 | 2011-05-04 | 西安计量技术研究院 | Calculating device for measuring uncertainty |
US9037961B1 (en) * | 2006-09-18 | 2015-05-19 | Credit Suisse Securities (Usa) Llc | System and method for storing a series of calculations as a function for implementation in a spreadsheet application |
CN109522303A (en) * | 2018-11-13 | 2019-03-26 | 深圳市思迪信息技术股份有限公司 | Collecting method, device and computer equipment based on Excel configuration |
CN111768767A (en) * | 2020-05-22 | 2020-10-13 | 深圳追一科技有限公司 | User tag extraction method and device, server and computer readable storage medium |
US20210010072A1 (en) * | 2017-11-24 | 2021-01-14 | Koei Suzuki | Device, preparator's skill evaluating method, non-transitory recording medium storing computer program for evaluating skill of preparator, and preparator's skill evaluating device, and testing device performance evaluating method, non-transitory recording medium storing computer program for evaluating performance of testing device, and testing device performance evaluating device |
CN112860577A (en) * | 2021-03-16 | 2021-05-28 | 上海银乾软件有限公司长春分公司 | Uncertainty evaluation method of measurement result |
-
2021
- 2021-05-31 CN CN202110600480.5A patent/CN113222459A/en active Pending
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US9037961B1 (en) * | 2006-09-18 | 2015-05-19 | Credit Suisse Securities (Usa) Llc | System and method for storing a series of calculations as a function for implementation in a spreadsheet application |
CN102043757A (en) * | 2010-12-20 | 2011-05-04 | 西安计量技术研究院 | Calculating device for measuring uncertainty |
US20210010072A1 (en) * | 2017-11-24 | 2021-01-14 | Koei Suzuki | Device, preparator's skill evaluating method, non-transitory recording medium storing computer program for evaluating skill of preparator, and preparator's skill evaluating device, and testing device performance evaluating method, non-transitory recording medium storing computer program for evaluating performance of testing device, and testing device performance evaluating device |
CN109522303A (en) * | 2018-11-13 | 2019-03-26 | 深圳市思迪信息技术股份有限公司 | Collecting method, device and computer equipment based on Excel configuration |
CN111768767A (en) * | 2020-05-22 | 2020-10-13 | 深圳追一科技有限公司 | User tag extraction method and device, server and computer readable storage medium |
CN112860577A (en) * | 2021-03-16 | 2021-05-28 | 上海银乾软件有限公司长春分公司 | Uncertainty evaluation method of measurement result |
Non-Patent Citations (1)
Title |
---|
R.S.博耶 , JS.穆尔 , 李卫华: "计算机科学中的正确性问题", 计算机工程与应用, no. 10, pages 25 - 46 * |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115826932A (en) * | 2023-02-10 | 2023-03-21 | 中国电子科技集团公司第十五研究所 | Evaluation model and evaluation model construction method |
CN116402480A (en) * | 2023-06-07 | 2023-07-07 | 成都普朗克科技有限公司 | Method and system for outputting inventory based on association rule self-built model |
CN116402480B (en) * | 2023-06-07 | 2023-09-19 | 成都普朗克科技有限公司 | Method and system for outputting inventory based on association rule self-built model |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110543421B (en) | Unit test automatic execution method based on test case automatic generation algorithm | |
Revell | phytools: an R package for phylogenetic comparative biology (and other things) | |
CN111722839B (en) | Code generation method and device, electronic equipment and storage medium | |
CN113222459A (en) | System and method for dynamically constructing food uncertainty evaluation model by expression tree | |
CN104239219B (en) | Software defect positioning technology on-line evaluating and experimenting platform and method based on coverage | |
CN101206130A (en) | Automatic verification/calibration/test platform for electronic instrument | |
CN112364024B (en) | Control method and device for automatic comparison of table data in batches | |
CN112558942A (en) | Operator registration method and related product | |
Wang et al. | MixProTool: a powerful and comprehensive web tool for analyzing and visualizing multigroup proteomics data | |
CN110737689A (en) | Data standard conformance detection method, device, system and storage medium | |
CN108007912A (en) | Middle-low alloy steels analytical equipment, correction analysis method and authenticity of medicament decision-making system | |
CN111061994A (en) | Calculation method and device for function derivation, calculation equipment and storage medium | |
CN114895895B (en) | Model development method, apparatus, computer device, and storage medium | |
Romanov et al. | Representing programs with dependency and function call graphs for learning hierarchical embeddings | |
Daum et al. | Simplifying the analysis of building information models using tQL4BIM and vQL4BIM | |
CN116451621A (en) | Method, system, equipment and medium for generating functional coverage rate code | |
JPWO2020100285A1 (en) | Information processing equipment, control methods, and programs | |
CN114116683A (en) | Multi-language processing method and device for computing platform and readable storage medium | |
Henry | A technique for hiding proprietary details while providing sufficient information for researchers; or, do you recognize this well-known algorithm? | |
CN113568662A (en) | Code change influence range analysis method and system based on calling relationship | |
CN113918159A (en) | Applet conversion method, system, device and medium | |
CN113807038A (en) | SoC integration method, device, system and computer readable storage medium | |
CN113312054A (en) | Software stack consumption analysis method and analysis device for embedded software architecture | |
Sauro et al. | Software tools for systems biology | |
Villadsen et al. | Bridging the Requirements-Specification Gap using Behaviour-Driven Development |
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 |