Skip to content
This repository was archived by the owner on Nov 19, 2020. It is now read-only.
This repository was archived by the owner on Nov 19, 2020. It is now read-only.

System.AggregateException thrown in C45Learning.Run #113

@liadmat

Description

@liadmat

In v2.15, when you have 2 inputs that are exactly the same but for some reason have different outputs, you get an unhandled exception:

double[][] inputs = new double[][] {
    new double[] { 0 },
    new double[] { 0 }
};

int[] outputs = new int[] {
    1,
    0
};


DecisionVariable[] variables = { new DecisionVariable("x", DecisionVariableKind.Continuous) };

DecisionTree decisionTree = new DecisionTree(variables, 2);
C45Learning c45Learning = new C45Learning(decisionTree);
c45Learning.Run(inputs, outputs); // System.AggregateException thrown here
A first chance exception of type 'System.AggregateException' occurred in mscorlib.dll
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at System.Threading.Tasks.Task.Wait()
   at System.Threading.Tasks.Parallel.ForWorker[TLocal](Int32 fromInclusive, Int32 toExclusive, ParallelOptions parallelOptions, Action`1 body, Action`2 bodyWithState, Func`4 bodyWithLocal, Func`1 localInit, Action`1 localFinally)
   at System.Threading.Tasks.Parallel.For(Int32 fromInclusive, Int32 toExclusive, Action`1 body)
   at Accord.MachineLearning.DecisionTrees.Learning.C45Learning.split(DecisionNode root, Double[][] input, Int32[] output, Int32 height)
   at Accord.MachineLearning.DecisionTrees.Learning.C45Learning.Run(Double[][] inputs, Int32[] outputs)

It also happens with more than 2 inputs (for example, you can make the DecisionTree sample app crash by changing examples.xls).
ID3 algorithm isn't affected.

Thanks,
Liad

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions