Beispiel #1
0
 public function getDriversLocation()
 {
     $user = new User();
     $group_id = $user->getGroupID();
     if ($group_id > 0) {
         return DBHelper::getAssoc("\n                SELECT d.`driver_id`, d.`lat`, d.`lng`, d.`busy`, d.`accuracy`, d.`last_activity`\n                FROM `drivers` d, `drivers_groups` g\n                WHERE d.driver_id = g.driver_id AND g.`group_id` = " . $group_id);
     } else {
         return DBHelper::getAssoc("\n                SELECT `driver_id`, `lat`, `lng`, `busy`, `accuracy`, `last_activity`\n                FROM `drivers`");
     }
 }
Beispiel #2
0
 /**
  * Wylicza warto¶ci wid (wagi poszczególnych cech w dokumencie)
  * na podstawie czêsto¶ci wystêpowania wyrazów i innych
  * danych zebranych w BD dla wcze¶niejszych komentarzy.
  *
  * @param array $comment
  * @return array
  */
 protected function evalWid(array $comment)
 {
     $dbcom = "('" . implode("','", array_keys($comment)) . "')";
     $sql = "SELECT word, CCi, idf FROM `datavect_{$this->idc}-4f` WHERE word IN {$dbcom}";
     $res = DBHelper::getAssoc($this->dbconn, $sql);
     $ret_array = array();
     $sum = 0.0;
     foreach ($comment as $k => $v) {
         if (array_key_exists($k, $res)) {
             $val = log($v + 0.5) * $res[$k][0] * $res[$k][1];
         } else {
             $val = log($v + 0.5);
         }
         $ret_array[$k] = $val;
         $sum += $val;
     }
     if ($sum == 0.0) {
         $sum = 1.0;
     }
     $mul = 1 / $sum;
     foreach ($ret_array as &$v) {
         $v *= $mul;
     }
     return $ret_array;
 }
Beispiel #3
0
 public function getAllUsers()
 {
     return DBHelper::getAssoc("SELECT `user_id`, `company_id`, `email`, `name`, `last_activity`, `user_type` FROM `users`");
 }
    mkdir($directory);
}
// wszystkie testy wykonaj $subTests razy
for ($sub = 1; $sub <= $subTests; ++$sub) {
    // poszczególne zestawy komentarzy
    for ($idc = 1; $idc <= 3; ++$idc) {
        $curTimes = array();
        $classObj = array();
        $partialResults["{$sub}_{$idc}"] = array();
        $summedResults["{$sub}_{$idc}"] = array();
        if ($sub == 1) {
            $times["{$idc}"] = array();
        }
        // pobierz komentarze inicjalizuj±ce
        $posInit = DBHelper::getAssoc($db, "SELECT id, comment FROM comment_{$idc} WHERE type = 'OK' ORDER BY id LIMIT {$initialComments}");
        $negInit = DBHelper::getAssoc($db, "SELECT id, comment FROM comment_{$idc} WHERE type = 'ER' ORDER BY id LIMIT {$initialComments}");
        // utwórz obiekty klasyfikatorów, obiekty czasomierzy
        // zainicjalizuj tablice wyników, dokonaj inicjalizacji
        foreach ($classifiers as $k => $v) {
            if ($suppressThreshold) {
                $v["{$idc}"]['threshold'] = 0.0;
            }
            $tmpc = new ReflectionClass($k);
            $classObj[$k] = $tmpc->newInstance($db, $dictionaries, $idc, $copyUnknown, $v["{$idc}"]);
            $curTimes[$k] = new Timer();
            $classObj[$k]->doInit($posInit, $negInit);
            $curTimes[$k]->set('doInit');
            $curResults[$k] = array('TP' => 0, 'TN' => 0, 'FP' => 0, 'FN' => 0, 'UC' => 0);
        }
        unset($posInit, $negInit);
        $ii = 0;
Beispiel #5
0
 public function getGroups($driver_id)
 {
     return DBHelper::getAssoc("SELECT * FROM `drivers_groups` WHERE `driver_id` = " . $driver_id);
 }