Skip to content

intersystems-community/integratedml-demo-template

Repository files navigation

integratedml-demo-template

This is a template for IntegratedML - InterSystems Github repository.

This repository comes with a few example Jupyter notebooks (http://jupyter.org) which demonstrate how to use IntegratedML in InterSystems IRIS Community Edition (Advanced Analytics including IntegratedML) in a docker container.

Contents

What is IntegratedML?

IntegratedML is a feature of the InterSystems IRIS data platform that brings machine learning to SQL developers.

IntegratedML is

  • all-SQL -- Build and train machine learning models using intuitive custom SQL commands, fully integrated within the InterSystems IRIS SQL processor
  • turnkey -- no packages or programming languages to learn, nothing to install
  • modular -- leverages "best of breed" open source and proprietary AutoML frameworks

Learn more about InterSystems IRIS and IntegratedML at the InterSystems Learning site

What's inside this template

Pre-configured environment, and sample data

This template creates a docker environment (via "docker-compose up") of 2 pre-configured containers:

  1. tf2jupyter: Jupyter+Tensorflow2.2(without GPU), with a few sample notebook files (in its Dockerfile)
  2. irisimlsvr another one for an IRIS 2020.3 Community Edition, with pre-loaded sample data in USER namespace(see its Dockerfile and iris.script that is run at startup)

Sample notebooks to get you started

4 sample notebook files -- by default this template starts Jupyter at http://localhost:8896/tree :

  • campaign-integratedml-jdbc.ipynb: A simple JDBC connection from tf2jupyter into a sample data table (Marketing Campaign data) within InterSystems IRIS's USER namespace, showing some use of IntegratedML including VALIDATE MODEL command usage.
  • readmission-integratedml-jdbc.ipynb: Demonstrates use of IntegratedML on a hospital readmission prediction dataset.
  • biomedical-integratedml-PyODBC.ipynb: Connection to InterSystems IRIS server over PyODBC, building and using an IntegratedML machine learning model, with a complex SQL query using the PREDICT() and PROBABILITY() IntegratedML SQL functions.
  • ED_visit_90_day.ipynb: Building and using an IntegratedML machine learning model to predict visits to Emergency Department, utilizing data from a Health Insight server, kindly provided by Joseph Cofone at Baystate Health. NOTE: this notebook is not executable!

Demo environment topology

Prerequisites

Make sure you have git and Docker desktop installed.

Tested environments

This template is tested breifly on AWS Ubuntu, Mac OS, and Windows 10(using Docker Toolbox only). It should work on other Docker environment too - let us know if you encounter any issues.

Installation

Clone/git pull the repo into any local directory

$ git clone https://github.com/intersystems-community/integratedml-demo-template.git

Open a Docker terminal in this directory and run:

$ docker-compose build
  1. Run the IRIS container, and Jupyter notebook server images:
$ docker-compose up -d
  1. Open browser to access the notebooks
http://localhost:8896/tree

Note: use docker-compose ps to confirm tf2juyter's ports; make sure right localhost port is used if over SSL tunneling to remotehost)

  1. Examine the test data with webterminal Open terminal with: SuperUser / SYS credentials
http://localhost:8092/terminal/

Enter /sql mode and make SQL queries to examine data in IRIS. Screenshot 2023-10-28 at 12 08 44 AM

How to develop your IntegragedML solution with the IntegratedML Template Repository

Use this template

Click the button "Use this template" on Github to create a new repository which will be the copy of this one.

Checkout the repo

Clone your new repo to a local folder.

Start developing

Install VSCode, Docker Desctop and ObjectScript plugin and open the folder in VSCode.

Import your data as listed below, rebuild containers to let the data be imported, and use IntegratedML via SQL tools, as described in Jupyter notebooks.

How to Import data into InterSystems IRIS

Importing data from CSV file

  1. Add csv file into the repository, e.g. like this titanic.csv
  2. Introduce an import data call into your IRIS initalisation script. This is an example line to import titanic.csv into IRIS Titanic.Passenger class along with data.
  3. Query the data from any SQL tool, web terminal or from InterSystems ObjectScript with:
SELECT * From Titanic.Passenger

Importing data from CSV URL

If your file is accessible remotely, you can import it as follows:

  1. Add the import CSV from URL line into iris.script. Here is an example line to import countries.csv data from URL
  2. Rebuild the docker image (the easiest way is to rebuild via docker-compose -- docker-compose build). This will create User.Countries class and import data which you can query with SQL from Countries table:
SELECT * FROM COUNTRIES