Exemplo n.º 1
0
 /**
  * Initializes the record set and uses the database handle to get the column list contained in
  * the query that created this object.
  *
  * @return void
  * @see lithium\data\model\RecordSet::$_columns
  * @todo The part that uses _handle->columns() should be rewritten so that the column list
  *       is coming from the query object.
  */
 protected function _init()
 {
     parent::_init();
     if ($this->_handle && $this->_result) {
         $this->_columns = $this->_handle->columns($this->_query, $this->_result, $this);
     }
 }
Exemplo n.º 2
0
 /**
  * Estimates the lambda parameter from the dataset.
  *
  * @param object $invX inverted X matrix for dataset (essentially a posting
  * list of features in X)
  * @return float lambda estimate
  */
 function estimateLambdaNorm($invX)
 {
     $sqNorm = 0;
     foreach ($invX->iterateData() as $entry) {
         $Xij = $entry[2];
         $sqNorm += $Xij * $Xij;
     }
     $m = $invX->rows();
     $n = $invX->columns();
     $sigmaSq = $n * $m / $sqNorm;
     return sqrt(2) / sqrt($sigmaSq);
 }