Skip to content

Instantly share code, notes, and snippets.

raymondjplante / softmax.php
Created October 4, 2016 18:21
Softmax calculation for PHP (useful for logistic classifications)
View softmax.php
function softmax(array $v){
//Just in case values are passed in as string, apply floatval
$v = array_map('exp',array_map('floatval',$v));
$sum = array_sum($v);
foreach($v as $index => $value) {
$v[$index] = $value/$sum;
View gist:c306ee4acf42c04df5bf
; php options
pid = /var/run/hhvm/pid
; hhvm specific
;hhvm.server.port = 9000
hhvm.server.type = fastcgi
raymondjplante / SplClassLoader.php
Last active December 15, 2015 20:59 — forked from jwage/SplClassLoader.php
Autoloader functions should do their magic then return true or false (that way a later autoloader can maybe succeed). Requiring a file without the checking first if it's valid will fatal error.
View SplClassLoader.php
* SplClassLoader implementation that implements the technical interoperability
* standards for PHP 5.3 namespaces and class names.
* // Example which loads classes for the Doctrine Common package in the
* // Doctrine\Common namespace.