module ChaosDetector::Utils::TensorUtil
Public Class Methods
normalize_matrix(matrix)
click to toggle source
Return new matrix that is normalized from 0.0(min) to 1.0(max)
# File lib/chaos_detector/utils/tensor_util.rb, line 8 def normalize_matrix(matrix) mag = matrix.row_size raise ArgumentError if matrix.column_size != mag lo, hi = matrix.minmax Matrix.build(mag) do |row, col| ChaosDetector::Utils::LerpUtil.delerp(matrix[row, col], min: lo, max: hi) end end