public Ensemble(List <List <Line> > pAllLines, double pReliabilityThreshold) { reliabilityThreshold = pReliabilityThreshold; EnsembleSize = pAllLines.Count; var largestTestCases = pAllLines.MaxBy(t => t.Count).First(); for (int i = 0; i < largestTestCases.Count; i++) { // get all line objects from each model with process instance id i List <Line> processInstanceLines = new List <Line>(); for (int j = 0; j < pAllLines.Count; j++) { if (Program.TestCasesCount == -1 || pAllLines[j].Count == Program.TestCasesCount) { //if either -1 is defined or number equals target size, continue processInstanceLines.Add(pAllLines[j][i]); } else { //if incomplete dataset is found, ignore the file in ensemble creation; notify error if (!pAllLines[j].Any()) { Logger.AddErrorMessage($"empty model found in {largestTestCases[0].FullPathToFile} at fileindex {j}"); } else { Logger.AddErrorMessage($"incomplete result set found in {pAllLines[j][i].FullPathToFile}. Expected {largestTestCases.Count} but found {pAllLines[j].Count}"); } } } EnsembleLines.Add(new EnsembleLine(processInstanceLines, this)); } }
public double GetReliabilityForBucket(double pBucketLevel, double pBucketGranularity) { var lines = EnsembleLines.Where(line => line.Completion >= pBucketLevel * pBucketGranularity && line.Completion < (pBucketLevel + 1) * pBucketGranularity); if (lines.Any()) { return(lines.Average(t => t.Reliability)); } else { return(0); } }
public List <double> GetReliabilitiesForBucket(double pBucketLevel, double pBucketGranularity) { return(EnsembleLines.Where(line => line.Completion >= pBucketLevel * pBucketGranularity && line.Completion < (pBucketLevel + 1) * pBucketGranularity).Select(t => t.Reliability).ToList()); }