Example of using a Computed Field

Adding a Computed Property

Clicking on Properties will give a pop up form listing all the properties associated with a Stage. A user can then add a new property by giving a Title and Type of property. There are predefined Types of properties (like Text, Number, Upload File, Barcode etc) which a user can use for adding a Data Property.

Suppose a User want to create a simple Linear Regression model for Real GDP (world) vs Year as a variable then a User can add 2 new Properties namely Year and GDP. Keeping TYPE as Number for both the variables. User can also add a new Property namely newYear (keep TYPE as Computed) for getting the normalized values later.

Adding Python Script to calculate the value of computed field

A User can add a new script by clicking on Icon on this Pop up window. User can provide Script Title and Description and Submit the form to create a new script. User is shown the new script in Edit Tab and here a user can select and add input properties, output properties and Global variables.

For Linear regression on GDP data exercise a User can select Year as input property and newYear as output property.

Normalization is a technique often applied as part of data preparation for machine learning. The goal of normalization is to change the values of numeric columns in the dataset to a common scale, without distorting differences in the ranges of values. For machine learning, every dataset does not require normalization. It is required only when features have different ranges.

​

After adding these Properties a user can use I/O Tab to edit the script. For this example we have normalized Year variable by subtracting 1960 from the value of Year.

# access property of abc using input["abc"]
# print(input["abc"])
# save computed property xyz to the database using output["xyz"] = 1234
​
# stuff to run always here such as class/def
def main():
output["newYear"] = input["Year"]-1960
​
if __name__ == "__main__":
# stuff only to run when not called via 'import' here
main()
​

A default Python script is generated when a User adds a new script. We have just added line no. 7 in the script to normalize the Year variable.

Adding Data

Clicking on Data will give a Pop up form to manage the data. A User can Add Data, View Data and check Data Spread here. Data can be added in the form or can also be uploaded using a Excel Sheet. A User can also Download a Sample file for uploading the data.