Class: Uranai::FeatureNormalizer
- Inherits:
-
Object
- Object
- Uranai::FeatureNormalizer
- Defined in:
- lib/uranai/feature_normalizer.rb
Instance Method Summary collapse
-
#initialize(feature) ⇒ FeatureNormalizer
constructor
A new instance of FeatureNormalizer.
- #normalize ⇒ Object
Constructor Details
#initialize(feature) ⇒ FeatureNormalizer
Returns a new instance of FeatureNormalizer.
5 6 7 |
# File 'lib/uranai/feature_normalizer.rb', line 5 def initialize(feature) @feature = feature end |
Instance Method Details
#normalize ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'lib/uranai/feature_normalizer.rb', line 9 def normalize (matrix_feature - matrix_mean) .transpose .to_a .zip(std_of_each_feature) .map do |arr| arr[0].map { |ele| ele / arr[1] } end end |