Skip to content

Instantly share code, notes, and snippets.

View lokeshh's full-sized avatar
🌴
On vacation

Lokesh Sharma lokeshh

🌴
On vacation
View GitHub Profile
lokeshh:~/workspace/nmatrix (master) $ bundle exec rake clean
lokeshh:~/workspace/nmatrix (master) $ rake compile --trace nmatrix_plugins=lapacke
** Invoke compile (first_time)
** Invoke compile:x86_64-linux (first_time)
** Invoke compile:nmatrix:x86_64-linux (first_time)
** Invoke copy:nmatrix:x86_64-linux:2.2.1 (first_time)
** Invoke lib/ (first_time, not_needed)
** Invoke tmp/x86_64-linux/nmatrix/2.2.1/nmatrix.so (first_time)
** Invoke tmp/x86_64-linux/nmatrix/2.2.1/Makefile (first_time)
** Invoke tmp/x86_64-linux/nmatrix/2.2.1 (first_time)
In file included from /usr/include/c++/4.8/bits/hashtable.h:35:0,
from /usr/include/c++/4.8/unordered_map:47,
from lol.cpp:2:
/usr/include/c++/4.8/bits/hashtable_policy.h: In instantiation of ‘struct std::__detail::_Hash_code_base<std::array<int, 2ul>, std::pair<const std::array<int, 2ul>, int>, std::__detail::_Select1st, std::hash<std::array<int, 2ul> >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, true>’:
/usr/include/c++/4.8/bits/hashtable_policy.h:1402:10: required from ‘struct std::__detail::_Hashtable_base<std::array<int, 2ul>, std::pair<const std::array<int, 2ul>, int>, std::__detail::_Select1st, std::equal_to<std::array<int, 2ul> >, std::hash<std::array<int, 2ul> >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Hashtable_traits<true, false, true> >’
/usr/include/c++/4.8/bits/hashtable.h:174:11: required from ‘class std::_Hashtable<std::array<int, 2ul>, std::pair<const std::array<int, 2ul>, int>,

Daru

Pull Requests [Merged]:

NoMethodError: undefined method `keys' for nil:NilClass
/var/lib/gems/2.1.0/gems/daru-0.1.2/lib/daru/index.rb:122:in `key'
/var/lib/gems/2.1.0/gems/gnuplotrb-0.3.3/lib/gnuplotrb/staff/dataset.rb:252:in `get_daru_columns'
/var/lib/gems/2.1.0/gems/gnuplotrb-0.3.3/lib/gnuplotrb/staff/dataset.rb:281:in `init_daru_vector'
/var/lib/gems/2.1.0/gems/gnuplotrb-0.3.3/lib/gnuplotrb/staff/dataset.rb:67:in `initialize'
/var/lib/gems/2.1.0/gems/gnuplotrb-0.3.3/lib/gnuplotrb/plot.rb:273:in `new'
/var/lib/gems/2.1.0/gems/gnuplotrb-0.3.3/lib/gnuplotrb/plot.rb:273:in `dataset_from_any'
/var/lib/gems/2.1.0/gems/gnuplotrb-0.3.3/lib/gnuplotrb/plot.rb:289:in `block in parse_datasets_array'
/var/lib/gems/2.1.0/gems/gnuplotrb-0.3.3/lib/gnuplotrb/plot.rb:289:in `map'
/var/lib/gems/2.1.0/gems/gnuplotrb-0.3.3/lib/gnuplotrb/plot.rb:289:in `parse_datasets_array'
<html lang='en'>
<head>
<title>Nyaplot</title>
<script src="http://cdnjs.cloudflare.com/ajax/libs/require.js/2.1.14/require.min.js"></script>
<script>if(window['d3'] === undefined ||
window['Nyaplot'] === undefined){
var path = {"d3":"https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min","downloadable":"http://cdn.rawgit.com/domitry/d3-downloadable/master/d3-downloadable"};
(venv) lokeshh:~/workspace/sciruby-notebooks (update_notebooks) $ gem uninstall statsample
You have requested to uninstall the gem:
statsample-2.0.1
sciruby-full-0.2.7 depends on statsample (~> 2.0)
statsample-bivariate-extension-1.2.0 depends on statsample (~> 2.0)
statsample-glm-0.2.1 depends on statsample (~> 2.0)
If you remove this gem, these dependencies will not be met.
Continue with Uninstall? [yN] y
module CategoricalData
def size
20
end
end
class Vector
def initialize type = nil
self.extend(CategoricalData) if type == :category
end
class Formula
  Formula class will be used by Statsample to parse a regression formula.
  It consist of two data members.
  attr_accessor :left_terms # This will store all the left terms. For example: ['y'] in case of 'y ~ a*b'
  attr_accessor :right_terms # This will store all the right terms. For example: ['a', 'b', ['a', 'b']]
  # in case of 'y ~ a*b'
  
  It will expose 'from_formula' function to the statsample to parse formulas
  For example to parse the formula 'y ~ a*b', Statsample will call the following function
=begin
Usage:
To convert expressions involving '*', '/' and brackets to expressions only involving '+' and ':' use #from_formula
>> Formula.new.from_formula '(a+b):(c+d)'
=> "a:c+a:d+b:c+b:d"
>> Formula.new.from_formula 'a*b*c*d'
=> "a+b+a:b+c+a:c+b:c+a:b:c+d+a:d+b:d+a:b:d+c:d+a:c:d+b:c:d+a:b:c:d"
=end
class Formula

Implement Formula language and categorical variable support in Statsample::Regression

Below is how Statsample performs regression.

def self.multiple(ds,y_var, opts=Hash.new)
  missing_data= (opts[:missing_data].nil? ) ? :listwise : opts.delete(:missing_data)
  if missing_data==:pairwise
     Statsample::Regression::Multiple::RubyEngine.new(ds,y_var, opts)
 else