public DatasetCoverage[] ComputeCoverages(Array <HyperRectangle> hyperRectangles) { var coverages = new DatasetCoverage[hyperRectangles.Length]; Parallel.For(0, hyperRectangles.Length, i => { var currentRectangle = hyperRectangles[i]; var currentCoverage = ComputeCoverage(hyperRectangle: currentRectangle); coverages[i] = currentCoverage; }); return(coverages); }
private static void BinaryOr(bool[] finalCoverage, DatasetCoverage ruleCoverage) { var lhs = finalCoverage; var rhs = ruleCoverage.InstancesCovered; // Improve exception description if (lhs.Length != rhs.Length) { throw new ArgumentException(nameof(ruleCoverage)); } for (int i = 0; i < lhs.Length; i++) { lhs[i] = lhs[i] || rhs[i]; } }
public Array <int> FindSeedsIndices(ReadOnlySpan <Rule> existingRules) { if (existingRules.IsEmpty) { var instanceCount = _dataset.InstanceCount; var indices = new int[instanceCount]; for (int i = 0; i < indices.Length; i++) { indices[i] = i; } return(indices); } var boxes = _boxCreator.FromRules(existingRules.AsSpan()); var coverages = _coverageComputer.ComputeCoverages(boxes); var totalCoverage = DatasetCoverage.CombineCoveragesBinaryOr(coverages); return(totalCoverage.IndicesOfUncoveredInstances); }