Web-interface, and programmatic API for classification and regression predictions
Python JavaScript CSS Puppet HTML Shell Other
Switch branches/tags
Latest commit 3203d4a Jan 4, 2018 @jeff1evesque jeff1evesque Merge pull request #3179 from jeff1evesque/feature-3174
#3174: Puppetize 'react_presets.pp'
Permalink
Failed to load latest commit information.
brain #3129: model_generate.py, set default gamma to 'auto' Dec 11, 2017
doc #3129: model_generate.rst, adjust 'sigmoid' markdown Dec 11, 2017
hiera #3174: hiera.yaml, refactor 'datadir' for docker Jan 4, 2018
interface #3100: views_api.py, use 'jwt_required' Nov 15, 2017
log #2781: remove unnecessary '@name' in docstring Jan 20, 2017
puppet #3174: init.pp, fix indentation Jan 4, 2018
src #3174: Merge branch 'master' into 'feature-3174' Jan 3, 2018
test #3165: .sccss-lint.yml, ignore nesting level Dec 21, 2017
.coveragerc #2697: coveragerc, add file Jan 16, 2017
.gitignore #3132: ignore + cleanup 'interface/static/node_modules' Dec 10, 2017
.travis.yml #3159: .travis.yml, remove spacing between '=' Dec 19, 2017
README.md #2933: pytest.rst, move into 'test/' Nov 26, 2017
Vagrantfile #3132: ignore + cleanup 'interface/static/node_modules' Dec 10, 2017
__init__.py #2781: remove unnecessary '@name' in docstring Jan 20, 2017
app.py #3100: replace 'run' with 'run-api' Nov 11, 2017
contributing.json #2860: set commit message limit < 65 characters Jan 22, 2017
contributing.md #2844: contributing.md, merge master into feature-2844 Aug 4, 2017
default.dockerfile #3098: move 'sklearn', 'compiler' to webserver Nov 25, 2017
factory.py #3100: factory.py, remove 'PROPAGATE_EXCEPTIONS' Nov 15, 2017
hiera.yaml #3174: hiera.yaml, implement absolute 'datadir' path Jan 4, 2018
license.md #2890: license.md, extend date to 2017 Jan 31, 2017
mariadb.dockerfile #2235: mariadb.dockerfile, use 'FROM ml-default' Nov 22, 2017
mongodb.dockerfile #2235: xxx.dockerfile, use 'FROM ml-default' Nov 22, 2017
redis.dockerfile #2235: xxx.dockerfile, use 'FROM ml-default' Nov 22, 2017
webserver.dockerfile #3098: webserver.dockerfile, reimplement 'app.py' Nov 25, 2017

README.md

Machine Learning Build Status Coverage Status

This project provides a web-interface, as well as a programmatic-api for various machine learning algorithms. Some of it's general applications, have been outlined within index.rst.

Supported algorithms:

Contributing

Please adhere to contributing.md, when contributing code. Pull requests that deviate from the contributing.md, could be labelled as invalid, and closed (without merging to master). These best practices will ensure integrity, when revisions of code, or issues need to be reviewed.

Note: support, and philantropy can be inquired, to further assist with development.

Configuration

Fork this project, and remember to generate ssh keys, before cloning the repository:

  • simple clone: clone the remote master branch.
  • commit hash: clone the remote master branch, then checkout a specific commit hash.
  • release tag: clone the remote branch, associated with the desired release tag.

Note: the puppetfile.rst can be reviewed, to better understand why ssh keys are required.

Installation

In order to proceed with the installation for this project, two dependencies need to be installed:

Once the necessary dependencies have been installed, execute the following command to build the virtual environment:

cd /path/to/machine-learning/
vagrant up

Depending on the network speed, the build can take between 10-15 minutes. So, grab a cup of coffee, and perhaps enjoy a danish while the virtual machine builds. Remember, the application is intended to run on localhost, where the Vagrantfile defines the exact port-forward on the host machine.

Note: a more complete refresher on virtualization, can be found within the vagrant wiki page.

The following lines, indicate the application is accessible via localhost:8080, on the host machine:

...
  ## Create a forwarded port mapping which allows access to a specific port
  ## within the machine from a port on the host machine. In the example below,
  ## accessing "localhost:8080" will access port 80 on the guest machine.
  main.vm.network 'forwarded_port', guest: 5000, host: 8080
  main.vm.network 'forwarded_port', guest: 6000, host: 9090
...

Note: ssl is configured on the reverse proxy, such that accessing http://localhost:8080, on the host machine, will redirect to https://localhost:8080.

Execution

Both the web-interface, and the programmatic-api, have corresponding unit tests which can be reviewed, and implemented.

Web Interface

The web-interface, or GUI implementation, allow users to implement the following sessions:

  • data_new: store the provided dataset(s), within the implemented sql database.
  • data_append: append additional dataset(s), to an existing representation (from an earlier data_new session), within the implemented sql database.
  • model_generate: using previous stored dataset(s) (from an earlier
  • data_new, or data_append session), generate a corresponding model into
  • model_predict: using a previous stored model (from an earlier model_predict session), from the implemented nosql datastore, along with user supplied values, generate a corresponding prediction.

When using the web-interface, it is important to ensure the csv, xml, or json file(s), representing the corresponding dataset(s), are properly formatted. Dataset(s) poorly formatted will fail to create respective json dataset representation(s). Subsequently, the dataset(s) will not succeed being stored into corresponding database tables; therefore, no model, or prediction can be made.

The following are acceptable syntax:

Note: each dependent variable value (for JSON datasets), is an array (square brackets), since each dependent variable may have multiple observations.

As mentioned earlier, the web application can be accessed after subsequent vagrant up command, followed by using a browser referencing localhost:8080, on the host machine.

Programmatic Interface

The programmatic-interface, or set of API, allow users to implement the following sessions:

  • data_new: store the provided dataset(s), within the implemented sql database.
  • data_append: append additional dataset(s), to an existing representation (from an earlier data_new session), within the implemented sql database.
  • model_generate: using previous stored dataset(s) (from an earlier
  • data_new, or data_append session), generate a corresponding model into
  • model_predict: using a previous stored model (from an earlier model_predict session), from the implemented nosql datastore, along with user supplied values, generate a corresponding prediction.

A post request, can be implemented in python, as follows:

import requests

endpoint = 'https://localhost:9090/load-data'
headers = {
    'Authorization': 'Bearer ' + token,
    'Content-Type': 'application/json'
}

requests.post(endpoint, headers=headers, data=json_string_here)

Note: more information, regarding how to obtain a valid token, can be further reviewed, in the /login documentation.

Note: various data attributes can be nested in above POST request.

It is important to remember that the Vagrantfile, as denoted by the above snippet, has defined two port forwards. Specifically, on the host, 8080 is reserved for the web-interface, while 9090, is reserved for the programmatic rest-api.