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
1. When I load c9.io for the first time, no styles are loaded from cdn.c9.io and I get a screen [like this](http://puu.sh/nBEwg/b9cf73fe0e.png). | |
2. After going to status.c9.io, which needs me to fill out a [captcha](http://puu.sh/nBEGI/92762b043c.jpg). I am able to see my dashboard with proper styling, but is still missing some resources all of which are from cdn.c9.io. | |
3. [See screenshot of above](http://puu.sh/nBEN9/3b9a868896.png) Note the missing glyphicons in this picture. [And a dropbox link to the console logs](https://www.dropbox.com/s/stn8rl62ndz50v1/c9.io-1457627113298.log?dl=0) | |
4. Now when I click on "Open" to open my workspace. It gets [stuck loading](http://puu.sh/nBF5n/427dde3458.png). Here's the [dropbox log for that](https://www.dropbox.com/s/jcujwnsvb4uvc9a/ide.c9.io-1457627242366_stuck_Loading.log?dl=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
describe Statistical::Distribution::DistNameGoesHere do | |
describe '.new' do | |
context 'when called with no arguments' | |
context 'when upper and lower bounds are specified' | |
end | |
describe '#pdf' do | |
context 'when called with x < lower' | |
context 'when called with x > upper' | |
context 'when called with x in [lower, upper]' |
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
# require all the rngs defined in lib/statistical/rng | |
require 'statistical/rng/uniform' | |
module Statistical | |
module Rng | |
# :nodoc: | |
# Dynamically add constant RNG_TYPES when called | |
def self.const_missing(cname) | |
if cname == 'RNG_TYPES'.to_sym |
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
state = 1 | |
counter = 0 | |
# Customary: "Here be evil" | |
# For a live version, see: https://repl.it/BiiG/1 | |
loop do | |
puts [state, counter].inspect | |
case state | |
when 1 |
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
module Distribution | |
module Binomial | |
module Ruby_ | |
class << self | |
# Returns a `Proc`object that yields a random integer `k` <= `n` | |
# which is binomially distributed with mean np and variance np(1-p) | |
# This method uses Luc Devroye's "Rejection Method" from page 533 | |
# of his text: "Non-Uniform Random Variate Generation." | |
# | |
# @param n [Fixnum] the total number of trials |
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
# When the mean is still small, but the probability of success | |
# is not miniscule. Covers n > 20 | |
# Taken from "The Generation of Binomial Random Variates" | |
# Wolfgang Hormann (http://epub.wu.ac.at/1242/1/document.pdf) | |
# This is algorithm BTRD from the text | |
# This is a precalculated table for correction terms in | |
# stirling's approximation to log(k!) each index corresponds | |
# to a seperate value of k | |
fc_table = [0.08106146679532726, 0.04134069595540929, |
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
# Returns the inverse-CDF or the quantile given the probability `prob`, | |
# the total number of trials `n` and the number of successes `k` | |
# Note: This is a binary search under the hood and is a candidate for | |
# updates once more stable techniques are found. | |
# This still needs to be optimized and benchmarked against | |
# the vanilla quantile | |
# | |
# @paran qn [Float] the cumulative function value to be inverted | |
# @param n [Fixnum, Bignum] total number of trials | |
# @param prob [Float] probabilty of success in a single independant trial |
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
def rb_rand_entropy(num_trials) | |
a = Array.new(num_trials) {rand(100)} | |
p = [] | |
0.upto(99) do |i| | |
p[i] = a.count(i) / num_trials.to_f | |
end | |
return p.map {|c| -c * Math.log(c)}.reduce(:+) | |
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
module GoodnessOfFit | |
# All goodness of fit helpers go here | |
## Pearson's chi squared test for goodness of fit | |
# == References | |
# * http://stattrek.com/chi-square-test/goodness-of-fit.aspx?Tutorial=AP | |
# * https://en.wikipedia.org/wiki/Degrees_of_freedom_(statistics)#Residuals | |
# | |
# The null hypothesis is always that the +candidate+ does belong to | |
# the +target+ distribution. |
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
Pending: (Failures listed here are expected and do not affect your suite's status) | |
1) Distribution::Uniform singleton it should behave like uniform engine .rng should generate sequences with the right mean & variance | |
# This method is very innacurrate due to the low convergence rate | |
# ./spec/uniform_spec.rb:8 | |
2) Distribution::Uniform Distribution::Uniform::Ruby_ it should behave like uniform engine .rng should generate sequences with the right mean & variance | |
# This method is very innacurrate due to the low convergence rate | |
# ./spec/uniform_spec.rb:8 |