Example #1
0
 public function clusterData($fromTimestamp, $toTimestamp)
 {
     $windows = StatsHelper::windows($fromTimestamp, $toTimestamp);
     list($clusters, $winIdCluster) = ClusterHelper::clusterizeStrings($windows);
     $from = $fromTimestamp;
     $to = $toTimestamp;
     $clustersList = array_map(function ($a) {
         return ['id' => $a, 'name' => $a];
     }, array_unique(array_values($clusters)));
     $durations = ClusterHelper::getProcessWindowHierarchy($winIdCluster, $from, $to);
     return ['clusters' => $clustersList, 'durations' => $durations];
 }
 public function actionTransitionMatrix()
 {
     $from = strtotime('today');
     $to = strtotime('tomorrow');
     $matrix = StatsHelper::transitionMatrix($from, $to);
     $windows = StatsHelper::windows($from, $to);
     $flattenMatrix = StatsHelper::flattenTransitionMatrix($matrix, $windows);
     foreach ($flattenMatrix as $key => $value) {
         echo $value['source'] . "\t" . $value['target'] . "\t" . $value['value'] . PHP_EOL;
     }
 }