This file contains hidden or 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
=begin | |
One of my favorite equations from business school: the learning curve. | |
Human experience has shown that every time our experience with a single | |
task doubles, our efficiency increases by 20%. Our learning curve is | |
actually around 20%, with a 95% confidence rate around 10% and 30%. | |
This was the equation that founded BCG as they measured everything | |
related to the then-new aviation industry. It's been used to measure | |
all sorts of human tasks and has proven pretty resilient for people of | |
all kinds of backgrounds and aptitudes. |
This file contains hidden or 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
gem 'jquery-rails' | |
gem 'coffee-rails', '~> 3.1.1' | |
gem "haml-rails" | |
gem 'ruby-haml-js' |
This file contains hidden or 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
require 'active_support/core_ext' | |
class Hash | |
def recursive_symbolize_keys! | |
symbolize_keys! | |
values.each do |h| | |
case h | |
when Array | |
h.each{|vv| vv.recursive_symbolize_keys! if Hash === vv } |
This file contains hidden or 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
group :development, :test do | |
gem "growl_notify" | |
gem "guard-jasmine-headless-webkit" | |
# Can bring this back in when we're ready to go with 3.1 | |
# gem "jasmine-rails" | |
gem "jasmine-headless-webkit" | |
gem "rb-fsevent" | |
gem "guard-jammit", :git => "git://github.com/johnbintz/guard-jammit.git" | |
end |
This file contains hidden or 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
## Rails App Template | |
## Useful for Rails 3.0.x and Ruby 1.9.2 | |
## Run using $ rails new [appname] -JT -m tpl-basicapp.rb | |
# ======== | |
# = Gems = | |
# ======== | |
# pre-install spork, dydram and elastic_searchable | |
run "gem install spork -v 0.9.0.rc --pre" |
This file contains hidden or 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
module Confusion | |
module MatrixBehavior | |
# A matrix of the values (actual: rows, predicted: columns) | |
attr_reader :values | |
protected | |
def assert_matrix_behavior(opts) | |
assert_values(opts) | |
end |
This file contains hidden or 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
# ============================ | |
# = Load Server Dependencies = | |
# ============================ | |
require 'rack-flash' | |
require 'warden' | |
require 'sinatra' | |
require 'haml' | |
require 'sinatra_more/markup_plugin' | |
# =============================== |
This file contains hidden or 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
data_frame (master): plain_frame | |
Loading Data Frame version: 0.1.8 | |
>> df = DataFrame.from_csv('http://archive.ics.uci.edu/ml/machine-learning-databases/forest-fires/forestfires.csv') | |
=> DataFrame rows: 517 labels: [:x, :y, :month, :day, :ffmc, :dmc, :dc, :isi, :temp, :rh, :wind, :rain, :area] | |
>> df.month.categories | |
=> ["apr", "aug", "dec", "feb", "jan", "jul", "jun", "mar", "may", "nov", "oct", "sep"] | |
>> df.wind.categories | |
=> [0.4, 0.9, 1.3, 1.8, 2.2, 2.7, 3.1, 3.6, 4, 4.5, 4.9, 5.4, 5.8, 6.3, 6.7, 7.2, 7.6, 8, 8.5, 8.9, 9.4] | |
>> df.wind.add_category(0) {|e| e <= 5} | |
=> {0=>#<Proc:0x0259cdf4@(irb):4>} |
This file contains hidden or 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
# This is used when the data set's true max and min can't be calculated. | |
# It provides approximate values for normalization. | |
class PseudoNormalize | |
require 'mathn' | |
class << self | |
def process(opts={}) | |
sample = opts.delete(:sample) | |
opts = {:sample => sample} if opts.empty | |
pn = new(opts) | |
pn.process(*sample) |
This file contains hidden or 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
require 'rubygems' | |
require 'mlp' | |
require 'data_frame' | |
IRIS = {1 => 'Iris Setosa', 2 => 'Iris Versicolour', 3 => 'Iris Virginica'}.freeze | |
KEYS = {'Iris-setosa' => 1, 'Iris-versicolor' => 2, 'Iris-virginica' => 3}.freeze | |
@mlp = MLP.new(:hidden_layers => [4], :output_nodes => 3, :inputs => 4) | |
@df = DataFrame.new(:sepal_length, :sepal_width, :petal_length, :petal_width, :class) |
NewerOlder