This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; http://en.wikipedia.org/wiki/Decision_tables | |
;; http://rosettacode.org/wiki/Decision_tables | |
;; this example is ported from the pico lisp example | |
(defn yes? [condition] | |
(print (str (first condition) "? ")) | |
(flush) | |
(loop [reply (read-line)] | |
(cond | |
(contains? #{"T" "Y" "YES" "Yes" "y" "yes" "true" "1"} reply) true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A quick introduction to python for math students (Paul English <[email protected]>) | |
################################################################################ | |
# Python Setup | |
################################################################################ | |
# 1. Install python 2.7 (or 3.0, both should work well) | |
# 2. Install pip | |
# 3. Install numpy using the command line tool pip | |
# pip intall numpy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn argmax [f coll] (reduce (fn [a b] (if (> (f a) (f b)) a b)) coll)) | |
(defn fools-constant [C N] | |
(let [n (argmax #(mod % 1) | |
(for [n (range 1 N)] (* C n)))] | |
[n (/ n C)])) | |
(fools-constant Math/PI 100) | |
(fools-constant Math/E 100) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
api = $resource('http://127.0.0.1/api/v1/:type/:id', | |
{ | |
type: '@type' | |
id: '@id' | |
}, | |
{ | |
get: {method: 'GET'} | |
post: {method: 'POST', headers: {'Content-Type': 'application/json'}} | |
del: {method: 'DELETE', headers: {'Content-Type': 'application/json'}} | |
create: {method: 'POST', headers: {'Content-Type': 'application/json'}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> summary(factor.train) | |
ACTION RESOURCE MGR_ID ROLE_ROLLUP_1 ROLE_ROLLUP_2 | |
0: 1897 4675 : 839 770 : 152 117961 :21407 118300 : 4424 | |
1:30872 79092 : 484 2270 : 99 117902 : 742 118343 : 3945 | |
25993 : 409 2594 : 82 91261 : 721 118327 : 2641 | |
75078 : 409 1350 : 71 118315 : 498 118225 : 2547 | |
3853 : 404 2014 : 67 118212 : 400 118386 : 1796 | |
6977 : 299 16850 : 66 118290 : 398 118052 : 1665 | |
(Other):29925 (Other):32232 (Other): 8603 (Other):15751 | |
ROLE_DEPTNAME ROLE_TITLE ROLE_FAMILY_DESC ROLE_FAMILY |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Generated on 2013-04-18 using generator-webapp 0.1.7 | |
'use strict'; | |
var lrSnippet = require('grunt-contrib-livereload/lib/utils').livereloadSnippet; | |
var mountFolder = function (connect, dir) { | |
return connect.static(require('path').resolve(dir)); | |
}; | |
// # Globbing | |
// for performance reasons we're only matching one level down: | |
// 'test/spec/{,*/}*.js' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Description: | |
# None | |
# | |
# Dependencies: | |
# None | |
# | |
# Configuration: | |
# None | |
# | |
# Commands: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var probability = { | |
normal: function(x, mean, stddev) { | |
var y = (1 / (stddev * Math.sqrt(2 * Math.PI))) * Math.pow(Math.E, - (Math.pow(x - mean, 2) / (2 * Math.pow(stddev, 2)))); | |
//console.log('normal', x, mean, stddev, y); | |
return y; | |
}, | |
logNormal: function(x, mean, stddev) { | |
var y = (1 / (x * Math.sqrt(2 * Math.PI * Math.pow(stddev, 2)))) * Math.pow(Math.E, - (Math.pow(Math.log(x) - mean, 2) / (2 * Math.pow(stddev, 2)))); | |
//console.log('logNormal', x, mean, stddev, y); | |
y = isFinite(y) ? y : 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
brain = require('brain') | |
life = new brain.NeuralNetwork() | |
assert = require('assert') | |
_ = require('underscore') | |
THRESHOLD = 0.35 | |
SIZE = 10 | |
class Matrix | |
state: [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\documentclass[12pt]{article} | |
\usepackage{graphicx} | |
\pagestyle{empty} | |
\setcounter{secnumdepth}{2} | |
\topmargin=0cm | |
\oddsidemargin=0cm | |
\textheight=22.0cm |