In Rubiscape, you can add a variable at the workbook or workflow level. Refer to Adding a Variable.
Rubiscape provides variable support, that is, its usage, for all tasks anywhere in workbooks or workflows like creating a dataset, performing data preparation tasks like sorting, filtering, aggregation, and using various algorithms. Any reference to the added variable in the workbook or workflow is supported. Here we take an example of a workbook.
Notes: | - The effect of an added variable can be seen in a node that is a successor of the RubiPython node.
- For example, in the figure below, SSOrderPriority and Support_Vector_Machine are successors nodes of the RubiPython node.
|
Variable Usage in Workbook and Workflow
To use a variable in a workbook, follow the steps given below.
- Create a workbook or open an existing workbook. Refer to Creating a Workbook or Opening a Workbook.
- Build your algorithm flow. Refer to Building Algorithm Flow in a Workbook Canvas.
For example, we create an algorithm flow using the RubiPython node, Sp_sample_Superstore dataset, and the Support Vector Machine algorithm, as shown below.
As shown below, in the Support Vector Machine algorithm, there are two advanced properties named Penalty Parameter and Degree, with default values 1.0 and 3, respectively.
We want to change these values using the added variable. - For this, add variables to be used in the workbook. Refer to Adding a Variable.
For example, we add two variables, TestPenaltyParameter and TestDegree, corresponding to the two advanced properties Penalty Parameter and Degree of the Support Vector Machine algorithm.
The figure below shows the two added variables with their default and current values.
- Click the RubiPython node.
The Python Code Editor is displayed.
Type the required code in the editor in the following format.
TaskName.PropertyName = @@Varible Name@@
In our example, we write the code as shown below.
Support_Vector_Machine.PenaltyParameter = @@
and
Support_Vector_Machine.Degree = @@
Notes: | While writing the code, make sure that - There is no space between two words in the property name. For example, we write the Penalty Parameter as PenaltyParameter.
- The task name is written exactly like that in the property pane. For example, we write the task name as Support_Vector_Machine.
|
Close the editor and to run the entire workbook, click Run.
- After the flow is successfully run, click on the Support Vector Machine node.
The properties pane displays the selected properties of the algorithm. In the pane, you see that the values of Penalty Parameter and Degree change to the current values of the added variable.
Thus, the current value of the added variables used in the task overwrites the initial values of properties while exploring and executing the task.