public bool generateNegative(Clause pred) { int k = 0; int t = 0; int noOfClauseToCheck = 100; ResolutionManager rm = new ResolutionManager(); // int negTresh = (int)(noOfClauseToCheck * noOfClauseToCheck / negatives.Count); foreach (Literal c in negTrainSet) { if (rand.Next(negTrainSet.Count) < noOfClauseToCheck) { t++; Clause p = pred.clone(); if (rm.checkCoverage(p, c)) { // return true; k++; c.covered = true; } } } pred.negativeCoverage = (100.0 * k / t); if (pred.negativeCoverage > negativeThreshold) { return(true); } return(false); }
public void computeTestCoverage(Clause pred) { ResolutionManager rm = new ResolutionManager(); int pcount = 0; int total = 0; foreach (Literal c in testSet) { if (!c.covered) { Clause p = pred.clone(); total++; if (rm.checkCoverage(p, c)) { pcount++; c.covered = true; } } } }
public double computeCoverage(Clause pred, bool mark, bool fast) // the min coverage assumed to be five { ResolutionManager rm = new ResolutionManager(); int pcount = 0; int total = 0; foreach (Literal c in trainSet) { Clause p = pred.clone(); total++; if (rm.checkCoverage(p, c)) { pcount++; c.covered = true; if (mark) { c.visited = true; } } if (pcount > 5) { return(100.0 * pcount / total); } //TODO: change 104 // if (fast && total > 104) // break; } double posCoverage = 0; if (total == 0) { posCoverage = 0; } else { posCoverage = 100.0 * pcount / total; } pred.positiveCoverage = posCoverage; return(posCoverage); }