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

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


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

const Model = new random_tree();


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

Model.Angles = 325.0;
Model.Atoms = 176.0;
Model.Bonds = 185.0;
Model.ChiralAtms = 18.0;
Model.Dipole = 8.4205;
Model.EzBnds = 0.0;
Model.FG_CON2 = 0;
Model.FG_COOH = 1;
Model.FG_COOR = 0;
Model.FG_F = 0;
Model.FG_PhOH = 1;
Model.FlexTorsions = 12.0;
Model.Gyrrad = 7.364614;
Model.HbAcc = 26.0;
Model.HbDon = 21.0;
Model.HeavyAtoms = 101.0;
Model.Lipole = 0.858332;
Model.Mass = 1449.254;
Model.Ovality = 2.463538;
Model.Psa = 498.9334;
Model.Rings = 10.0;
Model.Sas = 1573.201;
Model.Sav = 3197.086;
Model.Sdiam = 20.67702;
Model.Torsions = 94.0;
Model.Vdiam = 13.17372;
Model.VirtualLogP = 0.346624;

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 = 298.0;
Model.Atoms = 152.0;
Model.Bonds = 159.0;
Model.ChiralAtms = 25.0;
Model.Dipole = 7.189289;
Model.EzBnds = 0.0;
Model.FG_CON2 = 0;
Model.FG_COOH = 0;
Model.FG_COOR = 0;
Model.FG_F = 0;
Model.FG_PhOH = 1;
Model.FlexTorsions = 15.0;
Model.Gyrrad = 8.992547;
Model.HbAcc = 24.0;
Model.HbDon = 11.0;
Model.HeavyAtoms = 76.0;
Model.Lipole = 0.810682;
Model.Mass = 1085.146;
Model.Ovality = 2.443584;
Model.Psa = 362.2158;
Model.Rings = 8.0;
Model.Sas = 1451.669;
Model.Sav = 2739.57;
Model.Sdiam = 19.1786;
Model.Torsions = 72.0;
Model.Vdiam = 12.26883;
Model.VirtualLogP = 0.76864;

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