Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const buildFakeDataModel = (featPref) => {
const [featureArr, labelArr] = preprocResumes(cvCollection.cvData, featPref);
const [trainX, trainY, validX, validY] =_splitTrainTest(featureArr, labelArr, 0.2);
const options = {
gainFunction: 'gini',
maxDepth: 15,
minNumSamples: 10,
};
const classifier = new DTClassifier(options);
classifier.train(trainX, trainY);
//test
const prediction = classifier.predict(validX);
reportMetrics(prediction, validY);
return classifier;
};
const buildUserModel = (acceptedIndices, rejectedIndices) => {
const [featureArr, labelArr] = _userModelCvPreProc(acceptedIndices, rejectedIndices);
const options = {
gainFunction: 'gini',
maxDepth: 5,
minNumSamples: 3,
};
const classifier = new DTClassifier(options);
classifier.train(featureArr, labelArr);
return classifier;
};