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
type Perceptron | |
learning_rate | |
threshold | |
weights::Array{Float64, 1} | |
max_iters::Integer | |
function Perceptron(num_units::Integer=1, threshold::Float64=0.0, learning_rate::Float64=0.1, max_iters::Integer=1000) | |
weights = init_weights(num_units) | |
new(learning_rate, threshold, weights, max_iters) | |
end |
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
from itertools import product | |
from random import choice | |
# Cool story, bro. alternatives | |
# by @andrewdanks | |
# Prints all combinations iff True; prints a random sentence otherwise. | |
print_all_combos = False | |
story_adjectives = ['intriguing', 'riveting', 'gripping', 'fascinating', 'compelling', 'charming', 'dazzling'] |
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 simple utility function for rendering a sequence of templates in express for node. | |
Usage: | |
var utils = require('./utils'); | |
utils.renderTemplates(res, ['header', 'about', 'footer'], {title: 'About'}); | |
*/ | |
module.exports.renderTemplates = function(res, templates, params, callback, error_callback) { | |
// By default we just send the html in the response |
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
# Author: Pieter Noordhuis | |
# Description: Simple demo to showcase Redis PubSub with EventMachine | |
# | |
# Update 7 Oct 2010: | |
# - This example does *not* appear to work with Chrome >=6.0. Apparently, | |
# the WebSocket protocol implementation in the cramp gem does not work | |
# well with Chrome's (newer) WebSocket implementation. | |
# | |
# Requirements: | |
# - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby |