Skip to content

Server Side Extension - NBA example with BigML integration

License

Notifications You must be signed in to change notification settings

josefinestal/SSE-BigML

Repository files navigation

SSE - BigML integration (NBA example app)

This repository contains a Server Side Extension example app using NBA data. The NBA app was first shown at Qonnections 2016, demonstrating how R and Python as external calculation engines could be used to extend the expression library in the Qlik Engine for statistical analysis.

Two SSE plugins are used for this example. The sse-r-plugin is used for linear regression and clustering and the Python plugin, included in this repository, is used for predictions with BigML integration.

Content

Status

Qlik Sense Version: June 2017 release
SSE Version: v1.0.0
NBA app: This version is a direct translation from the original example app, to work with SSE v1.0.0 and no extra functionality is added. However, see the Improvements & Todo's for planned improvements.

Prerequisites

It is assumed you have read the documentation and are able to run some basic python examples in the server-side-extension repository as well as an example with the sse-r-plugin. Additional preprequisites for this particular example are:

  • Python library: bigml
  • R library: pastecs
  • Sense Visualization Extension: sense-media-box (GitHub repo here)
  • BigML account

BigML Integration

Predictions in Python are done using the BigML Python Bindings and the ensemble used for prediction is pre-trained and accessed by a (hardcoded) link on the plugin side. In this version the players possible to predict, which are excluded from the training set, are limited to 7 persons. Caching is enabled by default but if you wish to disable the cache, please uncomment the following lines(78-79) in the ExpressionExtension_NBA.py file:

#md = (('qlik-cache', 'no-store'),)
#context.send_initial_metadata(md)

To be able to access the BigML library from Python, and be able to make predictions, you must provide your username and your BigML API Key when you start the Python plugin. The authentication variable is then set based on your input (read more about API authentication in BigML)

Get Started Guide

This step-by-step guide is using a very simple local setup with non-secure communication and Qlik Sense Desktop. Take a look at alternative configurations in the server-side-extension repository.

  1. Add SSEPlugin = R,localhost:50051;P,localhost:50052 on a new line in your Settings.ini file located at C:\Users[user]\Qlik\Sense and save the file.
  2. Copy the SSE_NBA_example.qvf to C:\Users[user]\Qlik\Sense\Apps.
  3. Start the Python plugin by:
    • Install bigml by running pip install bigml in a cmd.
    • Go to current location
    • Insert your BigML username and api key in the following command:
      python ExtensionService_NBA.py --BIGML_USERNAME <username> --BIGML_API_KEY <api_key>
    • Run the command
  4. Start the R plugin by:
    • Install the pastecs library
    • Follow the Get Started guide in the sse-r-plugin repository.
  5. Start Qlik Sense Desktop and open the NBA Simple Analytics app.

Improvements & Todo's

The following features are ideas of what could be improved. They will be implemented and/or investigated further when I have the time.

BigML integration

  • Possibility to choose data in Sense to be used for training a model in BigML.
    • Visualize information about the trained model, including accuracy etc.
    • Possibility to choose to use the trained model or not based on the given information.

General

  • Use the data from Qlik to show the correct result, instead of returning the value from python. I.e. remove the files of each of the seven players.

Author

Josefine Stål
github.com/josefinestal
linkedin.com/in/josefinestal

Licence

Copyright © 2017 Josefine Stål

Released under the MIT license.