JavaScript Predictor Object

From Eigenvector Research Documentation Wiki
Revision as of 14:48, 16 July 2015 by imported>Jeremy (Created page with "== Introduction == The JavaScript Predictor Object is freely available to developers who wish to create JavaScript applications that interface with Solo_Predictor as does the...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Introduction

The JavaScript Predictor Object is freely available to developers who wish to create JavaScript applications that interface with Solo_Predictor as does the Solo Predictor Field Monitor.

The object provides basic methods to get a list of available models (from a specific folder on the server), then apply those models to data stored in a DataCache object in Solo_Predictor. Finally, it also provides access to raw data, and Q or Hotelling's T-squared contributions (if the underlying model type provides contributions).

Available Models

These properties and methods relate to the models that are available to Solo_Predictor and which of those should be applied to data when it is imported.

Properties

.modelFolder Sets or retrieves the folder (on the server, that is the computer running Solo_Predictor) which should be searched for models to apply. When updated, the modelList property (see below) is automatically updated.
.modelList [READ ONLY] An array of strings which define all valid files located in the modelFolder on the server. The contents of this list will be automatically updated when the modelFolder property is updated or when the updateModelList method is called.
.modelListError [READ ONLY] The error (if any) returned after the last updateModelList call. If no error occurred, this property will be empty.
.updateModelListCallback A function that should be executed when updateModelList is executed. The function should expect a single input consisting of the Predictor object itself. For example:[BR]
     obj.updateModelListCallback = function (myobj) {
       if (myobj.modelListError) throw new Error(myobj.modelListError);
       //Do something with myobj.modelList here...
     }

Methods

.updateModelList Contacts the server and requests the current list of models (.MAT and .TXT files) in the specified modelFolder. When the server responds, the results are stored in the modelList and modelListError properties and finally a call is made to the function specified in updateModelListCallback. If any errors occurred, the modelList will be empty.

Applying Models to Data

The following properties and methods relate to applying models to data and retreiving those results.


Properties

.selectedModels An array of strings which indicate the names of models which should be applied. The model names can be taken from the modelList property defined above. If this array is empty, no models will be applied. If more than one model is listed, all models will be applied and Solo_Predictor will attempt to join all the results into a single results matrix. Changing the selectedModels list will generally cause the most recent results to be cleared.
.datacacheblock Identifies which DataCache object block should be connected to the predictor as the source of data to which the models should be applied. Generally, this will be always be = 1, but some advanced applications might make use of additional DataCache blocks.