internal string Evaluate(RandomTreeNode node, RandomForestInstance instance) { var stack = new Stack <RandomTreeNode>(); stack.Push(node); while (stack.Any()) { var next = stack.Pop(); if (next.Evaluate(instance)) { // its not a leaf if (next.OutputClass == null) { foreach (var child in next.Children) { stack.Push(child); } } // its a leaf else { return(next.OutputClass); } } } // tree could not classify instance... return(RandomTreeNode.NoClass); }
/// <summary> /// Constructor with attributes for the artifact and the queue name /// </summary> public ContentPlacementInstance(string queue, double sizeInBytes, double inputPipCount, double outputPipCount, double avgPositionInputPips, double avgPositionOutputPips, double avgDepsInputPips, double avgDepsOutputPips, double avgInputsInputPips, double avgInputsOutputPips, double avgOutputsInputPips, double avgOutputsOutputPips, double avgPriorityInputPips, double avgPriorityOutputPips, double avgWeightInputPips, double avgWeightOutputPips, double avgTagCountInputPips, double avgTagCountOutputPips, double avgSemaphoreCountInputPips, double avgSemaphoreCountOutputPips) : this() { QueueName = queue; Artifact = new RandomForestInstance(sizeInBytes, inputPipCount, outputPipCount, avgPositionInputPips, avgPositionOutputPips, avgDepsInputPips, avgDepsOutputPips, avgInputsInputPips, avgInputsOutputPips, avgOutputsInputPips, avgOutputsOutputPips, avgPriorityInputPips, avgPriorityOutputPips, avgWeightInputPips, avgWeightOutputPips, avgTagCountInputPips, avgTagCountOutputPips, avgSemaphoreCountInputPips, avgSemaphoreCountOutputPips); }
internal string Evaluate(RandomForestInstance instance) { foreach (var root in Roots) { var evaluation = Evaluate(root, instance); if (evaluation != RandomTreeNode.NoClass) { return(evaluation); } } return(RandomTreeNode.NoClass); }
internal bool Evaluate(RandomForestInstance instance) { return(EvaluationPredicate.Invoke(instance)); }