balancenode properties

Balance node icon The Balance node corrects imbalances in a dataset, so it conforms to a specified condition. The balancing directive adjusts the proportion of records where a condition is true by the factor specified.


node = stream.create("balance", "My node")
node.setPropertyValue("training_data_only", True)
node.setPropertyValue("directives", [[1.3, "Age > 60"], [1.5, "Na > 0.5"]])
Table 1. balancenode properties
balancenode properties Data type Property description
directives   Structured property to balance proportion of field values based on number specified (see example below).
training_data_only flag Specifies that only training data should be balanced. If no partition field is present in the stream, then this option is ignored.

This node property uses the format:

[[ number, string ] \ [ number, string] \ ... [number, string ]].

Note: If strings (using double quotation marks) are embedded in the expression, they must be preceded by the escape character " \ ". The " \ " character is also the line continuation character, which you can use to align the arguments for clarity.