Transform
From Clariopedia
Contents |
Overview
The clario® node Transform is used to create new attributes, recode existing attributes, perform arithmetic functions on existing attributes, and otherwise manipulate attributes in a data stream.
Examples: Create square-root transformation of an existing attribute. Compute a ‘Sales per Mailing’ model score by combining a ‘Sales’ model score and a ‘Response’ model score.
Usage
Input Stream
The node connector can be connected to a variety of nodes, (ie. Read, Outliers, Missing, etc.), but requires a valid stream of data.
Configuration
The Transform node has one configuration face.
Configuration Face
The configuration node face displays a list of all incoming data stream attributes from the data stream connected to the input link node connector. The default setting passes through all of the incoming attributes. These are displayed in the Outgoing Attributes list. The attributes in the Outgoing list can be deleted by clicking on an attribute in the list (selected attribute(s) will be highlighted in blue) and pressing the delete key. Attributes cannot be reordered.NOTE: To efficiently find attribute names, begin typing an attribute name in the text box directly above Incoming Attributes. You will then be directed to only the attribute(s) beginning with the letter(s) you type.
To create new variables, click the New Attribute button at the top of the Outgoing Attributes list. Until re-named, each new attribute will use the following naming convention: NEW, NEW_1, NEW_2, etc. To re-name an attribute, click once to highlight in blue and click again to enable the text editing functionality. There are no length restrictions for new attribute names. However, a new attribute cannot have the same name as another attribute in the dataset. Characters valid for use in new attribute names are limited to: A-Z, a-z, 0-9, “-“, “_”
Once the new attribute is created (and re-named where desired) it is ready to be edited.
To edit an attribute, double-click on the attribute in the Outgoing Attributes list. This will open up the transform editor window.
Transform Editor
The upper-right box contains the scoring ‘pseudo code.’ This code cannot be directly edited, but it can be copied and pasted for reference or for use in other coding environments. You can also use this ‘pseudo code’ to check your expression for accuracy.
The far left box contains: Attribute type – Select Number, String, or Date from the drop down box. Attribute quick search – To efficiently find attribute names, begin typing an attribute name in the text box directly above the attribute list. You will be directed to the attributes beginning with the letter(s) you type.Attribute list – These attributes are available to be used in the attribute creation/transformation process. Note that this list only contains attributes already on the data stream. New attributes created in the transform node will not be available for further transformations until after the transform node has run and the newly created file is read in to a new transform node.
The bottom right portion of the transform editor window contains the coding tools to perform a variety of functions that are offered in the Transform node. These functions include:
| Function | Description | |
| Absolute | Compute the absolute value of a Number Absolute Value | |
| Add Days | Return a Date with a specified number of days added | |
| Arc Cosine | Input is a REAL NUMBER between -1 and 1. Output is in degrees Inverse Trigonometric Functions | |
| Arc Sine | Input is a REAL NUMBER between -1 and 1. Output is in degrees Inverse Trigonometric Functions | |
| Arc Tangent | Input is any REAL Number, output is in degrees Inverse Trigonometric Functions | |
| Ceiling | Convert a real number up to the next highest integer. For example, 4.2 becomes 5 Ceiling Function | |
| Concatenate | Concatenate multiple Strings into one String | |
| Condition | Create a conditional (if, then, else) | |
| Cosine | Compute the Cosine of the Number (Expects Number in degrees and returns degrees) Cosine | |
| Date To String | Convert a Date to the String equivalent | |
| Day of Month | Parse the numeric day from a Date | |
| Days Between | Computes the number of days between a range of dates | |
| Exponential | exp(x) computes Euler's number e ( approximately equal to 2.718281... ) raised to the power of x. e-mathematical constant | |
| Floor | Convert a real number down to the next lowest integer ex. 4.2 becomes 4 Floor Function | |
| Hours Between | Computes the number of hours between a range of dates | |
| In | Allows users to: 1) assert a single value, and an array of attributes to return a boolean and 2) assert an array of attributes, and a single value to return a boolean. Must be used in the "IF" statement of a "Condition" function. | |
| Length | Returns the length of a string attribute | |
| Logarithm | Computes the natural logarithm (base e) of a Number | |
| Minutes Between | Computes the number of minutes between a range of dates | |
| Month of Year | Parse the numeric month (1-12) from a Date | |
| Not In | Allows users to: 1) assert a single value, and an array of attributes to return a boolean and 2) assert an array of attributes, and a single value to return a boolean. Must be used in the "IF" statement of a "Condition" function. | |
| Number To String | Convert a Number to a String | |
| Parenthesis | Insert open and close parentheses in an equation/function | |
| Power of Value (x,n) | pow(x, n) raises the number's value x to the nth power | |
| Quarter of Year | Return a numeric value (1-4) for the quarter of the year in which a Date falls | |
| Random | Generate a random Number | |
| Seconds Between | Computes the number of seconds between a range of dates | |
| Sine | Compute the Sine of a Number (Expects Number in degrees and returns degrees) Sine | |
| Square Root | Compute the square root of a Number Square Root | |
| String to Number | Convert a String to a Number | |
| Sub String | Define and retain a portion of a String | |
| Tangent | Compute the Tangent of a Number (Expects Number in degrees and returns degrees) Tangent | |
| To Lowercase | Convert String to all lower case | |
| To Uppercase | Convert String to all upper case | |
| Trim | Trim leading and trailing spaces from a String | |
| Week of Year | Parse the numeric value (1-52) for the week of the year in which a Date falls | |
| Year of Date | Parse the numeric year from a Date |
Operators
| + | Add |
| - | Subtract |
| / | Divide |
| * | Multiply |
| == | Equal to |
| != | Not Equal to |
| > | Greater than |
| < | Less than |
| >= | Greater than or Equal to |
| <= | Less than or Equal to |
| && | And |
| ❘❘ | Or |
Constants
String – Create a string constant ex. ‘Y’
Number – Create a numeric constant ex. 1
Date – Create a date constant
Null – Create a null variable ex. Replace 999 with null to calculate a more accurate mean
Field Definitions
Because Transform gives you the ability to create new attributes, a specific number of keys are valid. These valid keys are: A-Z, a-z, 0-9, "-", "_".
Valid Inputs – You must link to a read valid stream of data.
Results
There is no results face for the transform node.
Output Stream
Due to the unique design of clario, where data is streamed throughout all processing, there is no direct data output as a result of executing the transform node. The data can be exported at any point in a workflow by using the Write node.
Video Demonstration
References
None.
