Class: NMatrix
- Inherits:
-
Object
- Object
- NMatrix
- Defined in:
- lib/cass/extensions.rb
Overview
Added functionality in NArray matrix class.
Instance Method Summary collapse
-
#corr ⇒ Object
Compute and return the column-wise correlation matrix for an NMatrix.
Instance Method Details
#corr ⇒ Object
Compute and return the column-wise correlation matrix for an NMatrix.
5 6 7 8 9 10 11 12 13 14 |
# File 'lib/cass/extensions.rb', line 5 def corr n = self.shape[0] n.times { |i| col = self[i,true] sd = col.stddev self[i,true] = ((col.sbt!(col.mean))/sd).to_a.flatten } #p self.to_a (self.transpose*self)/(self.shape[1]-1).to_f end |