Class: Matrix

Inherits:
Object
  • Object
show all
Defined in:
lib/aprendizaje_maquina/matrixx.rb

Instance Method Summary collapse

Instance Method Details

#add_onesObject

[View source]

2
3
4
5
6
# File 'lib/aprendizaje_maquina/matrixx.rb', line 2

def add_ones
	matrix = self.to_a.map{ |i| i.insert(0,1) }
	matrix = Matrix.rows(matrix,copy = true)
	matrix
end

#normalizeObject

[View source]

8
9
10
11
12
13
14
15
# File 'lib/aprendizaje_maquina/matrixx.rb', line 8

def normalize
	array = []
	self.column_count.times do |i|
		array << self.column(i).normalize
	end
	matrix_normal = Matrix.rows(array,copy = true).transpose
	matrix_normal
end