function _run() { $id = Request::post('id'); if ($id) { $feature = Features::getInstance()->getByIdLoaded($id); list($success, $description) = $feature->_run(); $this->setWriteParameter('features_module', 'run_result', implode("\n", $description)); } }
function setCollectionClass() { $this->Collection = Features::getInstance(); }
public function save_order() { $features_array = $_POST['features_id']; $order_array = $_POST['order']; $features = new Features(); foreach ($features_array as $key => $value) { $features_id = $value; $features_order = $order_array[$key]; $features->update('Features', array('sequence' => $features_order), 'id=' . $features_id); } Flash::set('success', __('This features sequence has been saved.')); redirect(get_url('features')); }
function _update($data) { $tableName = Features::getInstance()->tableName; $this->dropCache(); return parent::_update($data, $tableName); }
/** * Uses the chi-squared feature selection algorithm to rank features by * informativeness, and return a map from old feature indices to new ones. * * @param object $features full feature set * @return array associative array mapping a subset of the original feature * indices to new indices */ function select(Features $features) { $n = $features->numFeatures(); $selected = new SplMinHeap(); $allowed = isset($this->max) ? min($this->max, $n) : $n; $labels = array(-1, 1); /* Start with 1, since 0 is dedicated to the constant intercept term; <= $n because n is the last feature. */ for ($j = 1; $j <= $n; $j++) { $max_chi2 = 0.0; foreach ($labels as $label) { /* t = term present l = document has label n = negation */ $stats = $features->varStats($j, $label); list($t_l, $t_nl, $nt_l, $nt_nl) = $stats; $num = $t_l * $nt_nl - $t_nl * $nt_l; $den = ($t_l + $t_nl) * ($nt_l + $nt_nl); $chi2 = $den != 0 ? $num * $num / $den : INF; if ($chi2 > $max_chi2) { $max_chi2 = $chi2; } } /* Keep track of top features in a heap, as we compute informativeness. */ if ($allowed > 0) { $selected->insert(array($max_chi2, $j)); $allowed -= 1; } else { list($other_chi2, $_) = $selected->top(); if ($max_chi2 > $other_chi2) { $selected->extract(); $selected->insert(array($max_chi2, $j)); } } } return $this->buildMap($selected); }
function checkTest() { global $current_user; $this->data['success'] = 0; if (!$current_user->authorized) { $this->error('Auth'); return; } if ($current_user->getRole() < User::ROLE_SITE_ADMIN) { $this->error('Must be admin'); return; } $id = isset($_POST['id']) ? (int) $_POST['id'] : false; if (!$id) { $this->error('Illegal id'); return; } $feature = Features::getInstance()->getByIdLoaded($id); /* @var $feature Feature */ $this->data = array('id' => $id, 'status_description' => $feature->getStatusDescription(), 'last_run' => date('Y/m/d H:i', $feature->getLastRun()), 'last_message' => $feature->getLastMessage(), 'success' => 1); }
public static function getInstance() { if (!self::$features_instance) { self::$features_instance = new Features(); } return self::$features_instance; }
foreach ($rsvpData as $singleRsvp) { $tempRsvp = new RSVP(); $tempRsvp->createRSVPFromJson($singleRsvp); $tempRsvp->addRsvp(); } break; default: echo "<br>Unexpected action on Post: {$action}<br>(index)"; break; } } if ($_SERVER['REQUEST_METHOD'] === 'GET') { switch ($action) { case "api/features": include "src/serverModels/database/features.php"; $tempFeatures = new Features(); echo json_encode($tempFeatures->getFeatures()); break; default: echo "<br>Unexpected action on Post: {$action}<br>(index)"; break; } } } else { if ($_SERVER['REQUEST_METHOD'] === 'GET') { include "src/views/fileInjections/headerInjection.html"; include "src/views/fileInjections/sidebarNavigation.html"; switch ($action) { case "home": include "src/views/home.html"; break;