-
Notifications
You must be signed in to change notification settings - Fork 8
Scoring with MAS
In this section I discuss how to execute scoring with a model published to MAS using the masSetup and masRun methods of the restaflib library.
This method sets up the necessary information to score with MAS.
let masControl = await restaflib.masSetup(store, models);
The arguments to this method are:
- store - restaf store
- models - An array of model names you want to score with
let masControl = await restaflib.masSetup(store, ['sdktgo_iris'] );
This is the method you will call to score each scenario
let result = await restaflib.masRun(store, masControl, modelName,scenario, step);
The parameters to this method are;
- store - restaf store
- masControl - the object you got back from casSetup
- modelName - the name of the model you want to use for scoring. Has to have been specified in the models array to casSetup
- scenario - a JS object with the input values(see example below)
- step - this is optional. If not specified the first step in the model will be used for scoring.
async function example () {
let models = ['sdktgo_iris'];
let masControl = await restaflib.masSetup(store, models);
let scenario = {
petallengthcm: 1.5,
petalwidthcm : 0.2,
sepallengthcm: 5,
sepalwidthcm : 3
};
let result = await restaflib.masRun (store, masControl, models[0], scenario);
console.log(result);
}
A sample result for the model used above is:
{ I_Species : 'Iris-setosa ',
P_SpeciesIris_setosa : 1,
P_SpeciesIris_versicolor: 0,
P_SpeciesIris_virginica : 0,
_leaf_id_: 2 }
- The methods discussed in this blog use the microanalyticScore REST API
Include the following two script tags.
<script src="https://unpkg.com/@sassoftware/restaf/dist/restaf.min.js"></script>
<script src="https://unpkg.com/@sassoftware/restaflib/dist/restaflib.min.js"></script>
Two globals restaf and restaflib will be available for use in your script tags.
Install restaf and restaflib using the following command
npm install @sassoftware/restaf @sassoftware/restaflib
.... Under construction...
-
restaf
-
restaflib
-
Examples:
- Cas Server
- Compute Server
- Scoring with MAS
- Scoring with CAS
- Utility
-
CAS Related Functions
-
MAS Related Functions
-
Compute Server Related Functions
-
Reports Related Functions
-
Interactive CLI
-
Special Topic