Skip to content
Scott Sievert edited this page Feb 17, 2017 · 1 revision

Summary: This page describes what a NEXT application consists of and where these files reside in the NEXT directory structure.

Every application in NEXT conforms to a fixed directory layout, and the associated application files must be located in apps directory at the top level of the NEXT repository. So for instance, the PoolBasedBinaryClassification application files are located in apps/PoolBasedBinaryClassification.

This directory contains:

PoolBasedBinaryClassification.yaml
PoolBasedBinaryClassification.py
algs/
  Algs.yaml
  RandomSamplingLinearLeastSquares/
    RandomSamplingLinearLeastSquares.py  
widgets/
  getQuery_widget.html  
dashboard/
  Dashboard.py
  PoolBasedBinaryClassification.html
tests/
  test_api.py

A high level overview of these components is as follows:

  • PoolBasedBinaryClassification.yaml: In this yaml file, we specify and document the interface, for each of the major NEXT api functions, namely initExp, getQuery, processAnswer, getModel, getStats contained in the main application file, PoolBasedBinaryClassification.py. So for example, this interface specifies that the initExp function needs to accept targets. Learn more about the application interface at Interface.
  • PoolBasedBinaryClassification.py: This is the main application file and contains the majority of the code that stores the targets, calls algorithms, runs asynchronous jobs, updates internal models, initializes internal variables, among other tasks. Learn more about the application code at Framework-Apps
  • algs/Algs.yaml: Analogous to PoolBasedBinaryClassification.yaml, this file defines the interface for the four algorithm functions initExp, getQuery, processAnswer, and getModel, which get called by the corresponding functions in PoolBasedBinaryClassification.py and are defined in the algorithm files.
  • algs/RandomSamplingLinearLeastSquares/RandomSamplingLinearLeastSquares.py: This is the algorithm file for the specific algorithm called RandomSamplingLinearLeastSquares, which implements the interface from Algs.yaml. In general, one can define several different algorithms for a given application, and these files are where all the mathematics and model updates happen. Learn more about developing algorithms at Framework-Algs.
  • widgets/getQuery_widget.html: As explained in the overview and discussed above, widgets are a graphical, more user-friendly interface for displaying queries. This file is an HTML template that specifies how a query for the PoolBasedBinaryClassification app should appear. Learn more about writing widgets at Widgets.
  • dashboard/Dashboard.py: By default NEXT provides a dashboard with plots for monitoring frequency and timing of api calls. However other app specific visuals (each of which has it's own stat_id), such as model accuracy, embeddings, or rankings are also important to put on the dashboard. Dashboard.py is where all additional stat_id's beyond the defaults are defined. For this app, Dashboard.py defines one additional stat_id, test_error_multiline_plot that returns the data needed to generate a test error plot versus number of answered queries.
  • dashboard/PoolBasedBinaryClassification.html: This is the HTML representation of the dashboard stat_id's for display. We use the mpld3 library and provide many examples of plot types. Learn more about dashboards at Dashboard
  • tests/test_api.py: The test_api.py should use the python requests (or urllib) library for testing each application API endpoint. The test file can also be used for load testing and model validation. Learn more about tests at Testing.

We recommend learning these components in order as specified in the sidebar.

Clone this wiki locally