Skip to content

Instantly share code, notes, and snippets.

View michaeltwofish's full-sized avatar

Michael C. Harris michaeltwofish

  • South Australia, Australia
View GitHub Profile
And the following clusters exist:
| id | name | description |
| 1 | Cluster 1 | Some description |
Given /^the following clusters exist:$/ do |clusters_table|
# item_table is a Cucumber::Ast::Table
item_table.hashes.each do |cluster|
insert_into_clusters(cluster)
end
end
def unweightedAUC
total = 0
(0..(self.m_NumClasses - 1)).each do |index|
total += areaUnderROC(index)
end
total.to_f/self.m_NumClasses
end
> dat
classifier depth average
1 bayes 0 3.5639098
2 bayes 1 6.0000000
3 bayes 2 3.0253165
4 bayes 3 5.2250000
5 bayes 4 1.7931034
6 bayes 5 2.6800000
7 bayes 6 3.6551724
8 adaboost 0 9.2857143
def unweightedAUC
total = 0
(0..(self.m_NumClasses - 1)).each do |index|
auc = areaUnderROC(index)
print "Class: #{index} AUC: #{auc}"
total += auc
end
puts
total.to_f/self.m_NumClasses
end
Feature: Create Candidates
In order to manage tests for candidates
As an admin
I want to be able to create candidates
Fatal error: Class name must be a valid object or a string in /usr/local/www/oars/libraries/lithium/libraries/lithium/data/source/Database.php on line 448 Call Stack: 0.0002 327136 1. {main}() /usr/local/www/oars/webroot/index.php:0 0.0260 1563444 2. lithium\action\Dispatcher::run() /usr/local/www/oars/webroot/index.php:36 0.0260 1564600 3. lithium\core\StaticObject::_filter() /usr/local/www/oars/libraries/lithium/libraries/lithium/action/Dispatcher.php:123 0.0260 1566044 4. lithium\util\collection\Filters::run() /usr/local/www/oars/libraries/lithium/libraries/lithium/core/StaticObject.php:126 0.0261 1567916 5. {closure}() /usr/local/www/oars/libraries/lithium/libraries/lithium/util/collection/Filters.php:182 0.0381 1855392 6. lithium\util\collection\Filters->next() /usr/local/www/oars/config/bootstrap/action.php:58 0.0381 1855420 7. {closure}() /usr/local/www/oars/libraries/lithium/libraries/lithium/util/collection/Filters.php:201 0.0387 1855744 8. lithium\util\collection\Filters->next() /usr/local/www/oars/
<?php
Validator::add('uniqueFieldForClient', function($value, $format = null, $options = array()) {
$class = $options['class'];
$field = $options['field'];
$conditions = array($field => $value);
if (isset($options['values']['id'])) {
$conditions[] = 'id != ' . $options['values']['id'];
}
173.45.230.87 - - [02/Jun/2011:02:38:21 +0000] "GET /georgiathorpe.com/cron/1306982901.0181?asyncronous=%7BSSHA512%7DkePgS0XEWhghr2Ls%2FOPrU8gWIPhzVff5Chx7rufQ4uUbvgbqGD%2FTx7Ka1xSwaFkZIVWMwjZiisYaTNdUvh7lVXv4RDQ%3D HTTP/1.1" 200 395 "-" "Habari/0.7"
173.45.230.87 - - [02/Jun/2011:02:38:20 +0000] "GET /georgiathorpe.com/cron/1306982900.1781?asyncronous=%7BSSHA512%7DZUQCWXG5z89tkmlBsnzNuPG6iELFiNlKChzSGU9s0m98X54pAuewr6tXQx5Zpye6N2L%2BMeqG5EAkudICyjJ%2BVMk7uAg%3D HTTP/1.1" 200 395 "-" "Habari/0.7"
173.45.230.87 - - [02/Jun/2011:02:38:21 +0000] "GET /georgiathorpe.com/cron/1306982901.8281?asyncronous=%7BSSHA512%7DAvwSwknOFuT8lvRutUG9%2B2NazUxc1RCETOpSQ9apcgk1vVHQaEygD6%2Bi3qzQkw%2Fb9dNm58ULjlB8pFBjOwNoqTrKZfQ%3D HTTP/1.1" 200 395 "-" "Habari/0.7"
173.45.230.87 - - [02/Jun/2011:02:38:21 +0000] "GET /georgiathorpe.com/cron/1306982901.9281?asyncronous=%7BSSHA512%7DMyeHKAnEeTm2fVD1sPQpFtCZ45imNILNAktDGKbnQYuDF6L6By7Yzkb34%2BL3I%2F17q5NVAcMtJ3h08xZp4sQaOQxKqI4%3D HTTP/1.1" 200 395 "-" "Habari/0.7"
173.45.230.87 - -
object SuperGlobal Object
(
[vocabulary] => Array
(
[tags:term] => Array
(
[0] => jdlfjks
)
)
@michaeltwofish
michaeltwofish / gist:1016261
Created June 9, 2011 07:37
Custom lithium finder
<?php
// Create a finder for popular tags
static::finder('popular', function($self, $params, $chain) {
$params['options']['joins'] = array(new Query(array(
'source' => 'candidate_tags',
'constraint' => array ('Tag.id' => 'candidate_tags.tag_id'),
'group' => 'tag_id',
)));
$params['options']['fields'] = array('tag_id as id', 'name', 'client_id', 'count(tag_id) as theCount');
$params['options']['order'] = 'theCount DESC';