Skip to content

Missed fields on cross-validation #63

@Berkmann18

Description

@Berkmann18

After following the example on cross-validation on a project, I've noticed that both microAverage and macroAverage have some fields left as empty or (whichever was the default value in the PrecisionRecall's constructor).

Here's an example (taken from ac-learn)

const Learner = require('./ac-learn`)
const learner = new Learner(); //creates and object where the classifier is the `intentClassifier` from the examples
learner.crossValidate(/*folds=*/ 5);

Which outputs this (seemingly incomplete) object:

{
  macroAvg: {
    count: 79,
    TP: 69,
    TN: 0,
    FP: 3.6,
    FN: 10,
    TRUE: 68.2,
    startTime: 2019-05-02T11:17:15.451Z,
    dep: {},
    confusion: {},
    macroPrecision: 0,
    macroRecall: 0,
    macroF1: 0,
    Accuracy: 0.8632911392405064,
    HammingLoss: 0.17215189873417722,
    HammingGain: 0.8278481012658228,
    Precision: 0.9235869565217393,
    Recall: 0.8734177215189874,
    F1: 0.89154213836478,
    endTime: 'Thu May 02 2019 11:17:15 GMT+0000 (GMT)', //Shouldn't this be in the EPOCH time format like the rest?
    timeMillis: 8.6,
    timePerSampleMillis: 0.1088607594936709,
    shortStatsString: 'Accuracy=86% HammingGain=83% Precision=92% Recall=87% F1=89% timePerSample=0[ms]'
  },
  microAvg: {
    count: 395,
    TP: 345,
    TN: 0,
    FP: 18,
    FN: 50,
    TRUE: 341,
    startTime: 2019-05-02T11:17:15.451Z,
    dep: {},
    confusion: {},
    macroPrecision: 0,
    macroRecall: 0,
    macroF1: 0,
    Accuracy: 0.8632911392405064,
    HammingLoss: 0.17215189873417722,
    HammingGain: 0.8278481012658228,
    Precision: 0.9504132231404959,
    Recall: 0.8734177215189873,
    F1: 0.9102902374670185,
    endTime: 2019-05-02T11:17:16.325Z,
    timeMillis: 874,
    timePerSampleMillis: 2.212658227848101,
    shortStatsString: 'Accuracy=341/395=86% HammingGain=1-68/395=83% Precision=95% Recall=87% F1=91% timePerSample=2[ms]'
  }
}

I had a glance at the code and it seems that labels, dep, confusion, macroPrecision, macroRecall and macroF1 should be filled instead of being {} or 0 so I was wondering if it was a bug?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions