private function setAssocProperties(AssocRule $inputRule) { $leftCount = 0; $rightCount = 0; $leftRightCount = 0; foreach ($this->assocRules as $rule) { $leftInput = $inputRule->getFullLeftTerms(); $leftCompare = $rule->getFullLeftTerms(); $rightInput = $inputRule->getFullRightTerms(); $rightCompare = $rule->getFullRightTerms(); Util::translateArr($leftInput); Util::translateArr($leftCompare); Util::translateArr($rightInput); Util::translateArr($rightCompare); if (count(array_intersect($leftInput, $leftCompare)) === count($leftInput)) { $leftCount++; if (count(array_intersect($rightInput, $rightCompare)) === count($rightInput)) { $leftRightCount++; } } if (count(array_intersect($rightInput, $rightCompare)) === count($rightInput)) { $rightCount++; } } $total = count($this->assocRules); $inputRule->setP2000Support($leftCount / $total); $inputRule->setNewsSupport($rightCount / $total); $inputRule->setTotalSupport($leftRightCount / $total); $inputRule->setConfidenceLeft($inputRule->getTotalSupport() / $inputRule->getP2000Support()); $inputRule->setConfidenceRight($inputRule->getTotalSupport() / $inputRule->getNewsSupport()); $inputRule->setLift($inputRule->getTotalSupport() / ($inputRule->getP2000Support() * $inputRule->getNewsSupport())); }