
/*******************************************
****        JavaScript example          ****
**** (c) 2017-2019, Alessandro Pedretti ****
*******************************************/

/*
 * This example requires Node.js as JavaScript interpreter
 * https://nodejs.org/
 */


const random_forest = require('./random_forest.js');

const Model = new random_forest();


/**** Prediction example 1 ****/

Model.Angles       = 108.0;
Model.Atoms        = 60.0;
Model.Bonds        = 63.0;
Model.Charge       = 0.0;
Model.ChiralAtms   = 0.0;
Model.Dipole       = 2.54652;
Model.EzBnds       = 2.0;
Model.FlexTorsions = 10.0;
Model.Gyrrad       = 7.528516;
Model.HbAcc        = 4.0;
Model.HbDon        = 2.0;
Model.HeavyAtoms   = 32.0;
Model.Impropers    = 21.0;
Model.Lipole       = 2.13308;
Model.Mass         = 448.5804;
Model.Ovality      = 1.894926;
Model.Psa          = 92.87458;
Model.Rings        = 4.0;
Model.Sas          = 809.6651;
Model.Sav          = 1316.951;
Model.Sdiam        = 12.73983;
Model.Surface      = 509.8912;
Model.Torsions     = 32.0;
Model.Vdiam        = 9.254815;
Model.VirtualLogP  = 4.190687;
Model.Volume       = 415.0514;

console.log("\n* Example #1");
console.log("  Domain violations: %d (must be 0)", Model.DomCheck());
console.log("  Predicted class:   %d (real 0)", Model.Classify());


/**** Prediction example 2 ****/

Model.Angles       = 27.0;
Model.Atoms        = 18.0;
Model.Bonds        = 18.0;
Model.Charge       = 0.0;
Model.ChiralAtms   = 0.0;
Model.Dipole       = 0.245056;
Model.EzBnds       = 1.0;
Model.FlexTorsions = 2.0;
Model.Gyrrad       = 2.415841;
Model.HbAcc        = 2.0;
Model.HbDon        = 4.0;
Model.HeavyAtoms   = 10.0;
Model.Impropers    = 9.0;
Model.Lipole       = 4.472592;
Model.Mass         = 156.2088;
Model.Ovality      = 1.382357;
Model.Psa          = 96.54134;
Model.Rings        = 1.0;
Model.Sas          = 330.8518;
Model.Sav          = 474.6761;
Model.Sdiam        = 7.461171;
Model.Surface      = 174.8896;
Model.Torsions     = 9.0;
Model.Vdiam        = 6.345953;
Model.VirtualLogP  = 0.500129;
Model.Volume       = 133.8102;

console.log("\n* Example #2");
console.log("  Domain violations: %d (must be 0)", Model.DomCheck());
console.log("  Predicted class:   %d (real 1)", Model.Classify());
