Work with the conditional logic operator¶
UbiOps pipelines come with some predefined operators that you can use. One of those operators is the Conditional Logic operator. The Conditional Logic evaluates expressions as boolean, and uses this boolean to determine if the next deployment in your pipeline should be activated. In this how-to, we show how you can use the conditional logic operator, to throw an error if your model provides unwanted results.
Configuring the conditional logic operator¶
Once you have added the function operator to your pipeline canvas, the UI will prompt you to provide an Expression and an Input field that can be used inside the Expression. The expression refers to the conditional expression to evaluate. Let us assume that we want to perform a unit test on our model. To this end, we want to check if the probability of a certain classification is within range, i.e. if it is larger than zero and smaller than one. We insert the following Expression:
probability>=1 or probability<0
Test expression tab, you can try out various cases by instering dummy data and evaluating the results. If the results are correct, you can create the conditional logic operator operator by clicking on 'save'. This creates the Function operator object.
Integrating the conditional logic operator into your pipeline¶
The conditional logic operator decides if the next step in the pipeline is executed. You could for example raise a custom error using the
Raise error operator. To see how, check out the raise error how-to
That's all there is to this operator. If you run into any issues though, do not hesitate to contact support.