Installing a Model on the Expert Models Platform

New Model Installation

Soon you will be able to create and install your own Models directly in the Expert Models platform using a self-service code manager and editor. But, for now we are here to help you install and deploy your models. To get your models installed, simply follow the guidelines in this document.

You retain ownership of any code you create and deploy on the system. We will not share your code with anyone else without your permission. We will sign a confidentiality agreement with you if required.

To install your model, all you have to do is to follow these guidelines and send the code to us for review and installation. As outlined here, all models must be written in Python and the model input form described in JSON.

Feel free to contact us on support@expertmodels.com if you have any questions or would like any more information at this stage.

Expert Models – Model Deployment

Assumptions:

  • You have a working knowledge in Python and understand data programming.
  • You have (or will create) your own model in Python code that you would like to install in the Expert Models platform.
  • You have access to your own Python programming environment in which you can create and debug your model.

Now, Simply Follow These Steps:

  • Create a Python module file in the format .py with the name in lowercase and words separated by underscores.
  • Create a class method called “main”
  • Implement the algorithm with the “main“ function
  • Pass the inputs of the model as a dictionary
  • Return the output of the model as a dictionary
  • Any datatables involved should be installed as Data Tables in the platform and accessed using the Expert Models data library functions.
  • Execute the python module file in a terminal or shell and verify the output is printed correctly like python .py
  • Create an input JSON to define the UI. Various types of input supported at the moment are:
    • Textbox
    • Numbers
    • Drop down
    • Textarea
    • File picker

Example:

Below is an example of a model to add 2 numbers.

add_numbers.py

The inputs to the model are passed as a dictionary (args). The keys of the dictionary are the names of the arguments – num1 and num2

class EMTestModel:
	def main(self, args):
		result = {}
		num1 = args["num1"]
		num2 = args["num2"]
		result["sum_of_numbers"] = num1 + num2
		return result


if __name__ == "__main__":
	args = {
		"num1": 100,
		"num2": 100,
	}
	print EMTestModel().main(args)

The input JSON for the above model would be as below:

{
  "fields": [
    {
      "validation": {
        "required": true
      },
      "name": "num1",
      "placeholder": "Enter number1",
      "value": 10,
      "label": "num1",
      "type": "number"
    },
    {
      "validation": {
        "required": true
      },
      "name": "num2",
      "placeholder": "Enter number2",
      "label": "num2",
      "type": "number"
    }
  ]
}

Each of the attributes are given below:

• name : The argument name that will be used in the model
• label: The text to be displayed next to the input field in the wizard
• type: The type of the input. Can take values text, number, textarea, filepicker
• validation: This is to mark a field as required
• value: Default value to be assigned to a field

Model Submission:

To submit the model for including on the EM platform, create a zip file containing the python module and other supporting files and send it to support@expertmodels.com with the subject line “Model Deployment”

Contact:

If you have any questions, please send an e-mail to support@expertmodels.com with details and screenshots.