Transform

../_images/transformnodeicon.png

Transform Node icon

The Clario Transform node is used to create new attributes, recode or rename existing attributes, perform arithmetic functions on existing attributes, and otherwise manipulate attributes in a data stream. For example, you can create a square root transformation of an existing attribute or a ‘Sales per Mailing’ model score by combining a ‘Sales’ model score and a ‘Response’ model score. The node connector of a Transform node can be connected to a variety of nodes, (e.g. Read File, Outliers, Missing, etc.), but requires a valid stream of data.

Configuration

../_images/transformconfig.png

Configuration

The configuration displays incoming attributes on the left and outgoing attributes on the right. To add attribute(s) to the outgoing stream, drag and drop one or more attributes from the incoming to the outgoing list. To transform an attribute you can either: double-click the attribute in the outgoing list to open the Transform Builder or click [Edit Code] to open the Transform Code Editor.

Attributes are highlighted in the outgoing list to indicate which attribute(s) have been transformed. Attributes with a blue background indicate a transformation. Attributes without a blue highlight are simply passed through to the outgoing stream. Selecting an attribute in the outgoing list draws lines to the incoming attribute(s) used in the underlying transformation.

To create a new attribute, click [New] at the bottom of the Outgoing Attributes list. Enter a name (NOTE: There are no length restrictions for attribute names. However, a new attribute cannot have the same name as an existing attribute), select a type and click [Create] which opens the Transform Builder window. See tips on Valid Characters for Attribute Names.

To remove attribute(s) from the outgoing stream, select one or more attributes (selected attribute(s) will be highlighted in green) and press the delete key. Outgoing attributes can be reordered by selecting them and dragging them to a new position in the list. See tips on Finding and Selecting Attributes to perform actions on multiple attributes at once.

Transform Builder

The upper right view contains transform code. This view is read only, to edit it directly open the Transform Code Editor. The code view is highlighted based on the contents of the main work area. It also displays any errors in red, giving you a better indication where the error exists.

The center of the screen contains [Home] and [Back] buttons, to assist in navigation in and out of nested functions. To the right of these buttons are a ‘Name’ field and ‘Type’ dropdown; use these to change the attribute name or type. Valid attribute types are Number, String, or Date. Below the [Home] and [Back] buttons is the main work area, where functions, attributes, and constants will be placed. When finished adding code to the main work area, click [Save] (bottom right) to save and exit to the Transform Configuration tab. Or, click [Cancel] to exit without saving.

The far left box contains three tabs located at the top of the box:

  1. Functions f(x) - coding tools to perform a variety of functions (see table below) that are offered in the Filter node.
  2. Attributes list [att] - attributes from the data stream that are available to be used in the attribute creation/transformation process.
  3. Constants [cons] - to use as inputs to functions.

Select a function, attribute, or constant, then drag and drop it into the main work area. See tips on Finding and Selecting Attributes.

../_images/transformbuilder.png

Transform Builder

See what Functions, Operators, and Constants can be used in the Transform node.

Transform Code Editor

The code editor is an advanced feature giving you the ability to create Transforms with code instead of the builder. Once you’ve entered your code, click [Check] to verify it is syntactically correct. Any syntax errors that exist are displayed in the Messages window. Your code must be syntactically valid in order to save. In addition to syntax verification, the check operation will validate your Transform code, displaying any validation errors in the Message window. Unlike syntax errors, it is OK to save an invalid Transforms just like you can in the builder. Refer to the complete coding guide for more information.

../_images/transformcodeeditor.png

Transform Code Editor

Transform Examples

In the Transform node’s Configuration, click [New], enter an Attribute Name and Type to create a new variable. This will take you to the Transform Builder.

../_images/transformeditor2.png

Empty Transform

Product of Two Attributes

The following is an example of constructing the product of a few attributes:

  1. On the left side of the Transform window, click the [att] tab to view a list of available attributes. Drag and drop one of these attributes into the main work area.
../_images/transformblankworkarea.png

Blank work area

../_images/transformoneattr.png

One attribute

  1. Continue dragging and dropping attributes into the main work area.
../_images/transformtwoattr.png

Two attributes

Attributes can be dropped above or below existing attributes on the work area. Once on the main work area, attributes can also be re-ordered by dragging and dropping them above or below existing attributes. Once multiple attributes are in the main work area, it is possible to change the operators that connect them. The default operator is addition (+).

  1. To change the operators, simply click on the operator dropdown between each attribute (see Figure), and select from the arithmetic or logical operators.
../_images/transformdropdown.png

Dropdown operator

Any errors will be highlighted in red. If you hold the mouse over them, an informative error message will appear. Once errors have been resolved, click [Save].

Conditional

The following is an example of how to create a conditional:

  1. Drag Condition from the f(x) tab on the left of the Transform window and drop it into the main work area.
../_images/transformblankworkarea.png

Blank work area

../_images/transformcondition1.png

Condition

  1. Drag and drop attributes into the ‘If’ area of the condition.
../_images/transformcondition2.png

Add attribute to If

Constant numbers, strings, dates, and nulls can also be used by clicking on the cons tab on the left of the Transform window. You can then drag and drop a string/number/date/null into the main work area. Once they’ve been dropped, you still need to define a String/Number/Date by typing a value directly into its field. Constant numbers default to 0, strings default to an empty string, and dates default to the current day.

  1. Drag and drop a number to the ‘If’ area.
../_images/transformcondition3.png

Add number to If

  1. Drill into the Condition by double clicking on the ‘If’ area, and change the default constant 0 to another number.

Changes can be more easily made in this closer view. When you’re done, navigate back to the main work area level by clicking [Home] in the middle of the screen. In a nested conditional, you may navigate back out one level by clicking [Back].

../_images/transformcondition4.png

Drill into Condition

  1. Place attributes and constants into the ‘If’, ‘Then’, and ‘Else’ areas. Once you are done, click [Save].

Any errors in the conditional will be highlighted in red, and if the code is nested you can drill into it then hold the mouse over the code until an informative error message appears.

../_images/transformcondition5.png

Conditional complete

Logical Operators and Functions

Below is a more complicated conditional, with a logical AND in the ‘If’ area, and functions in the ‘Then’ and ‘Else’ areas.

../_images/transformmorecomplicated.png

More Complicated Conditional

Results

See the Transform Node Results.

Output Stream

The newly transformed dataset is ready for immediate use in various nodes located throughout Clario. The data can be exported at any point in a workflow by using the Write File node.

Table Of Contents

Previous topic

Sort

Next topic

Univariate