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
class SimpleLinearRegression | |
def initialize(xs, ys) | |
@xs, @ys = xs, ys | |
if @xs.length != @ys.length | |
raise "Unbalanced data. xs need to be same length as ys" | |
end | |
end | |
def y_intercept | |
mean(@ys) - (slope * mean(@xs)) |
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 source_paths | |
[File.expand_path(File.dirname(__FILE__))] | |
end | |
apply 'base.rb' | |
# Template specific commands to go here |
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
{ | |
"auto_complete_commit_on_tab": true, | |
"bold_folder_labels": true, | |
"detect_indentation": true, | |
"dictionary": "Packages/Language - English/en_GB.dic", | |
"ensure_newline_at_eof_on_save": true, | |
"font_size": 12.0, | |
"ignored_packages": | |
[ | |
"Vintage" |
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
class ExpressionValidator < ActiveModel::EachValidator | |
def validate_each(record, attribute, value) | |
begin | |
Dentaku(value) | |
rescue Exception => e | |
record.errors[attribute] << (options[:message] || e.message) | |
end | |
end | |
end |