// FeatureScaling normalizes every columns with "feature scaling".
FeatureScaling normalizes every columns with "feature scaling".
// FeatureScaling normalizes every columns with " feature scaling " .
func (d CustomData) FeatureScaling() [][]float64 {
	if d.RawData.ColSize() == 0 {
		return [][]float64{}
	}
	out := make([][]float64, d.RawData.RowSize())
	for i := 0; i < len(out); i++ {
		out[i] = make([]float64, d.RawData.ColSize())
	}
	for k := 0; k < d.RawData.ColSize(); k++ {
		max, min := d.RawData.Value(0, k), d.RawData.Value(0, k)
		for i := 0; i < d.RawData.RowSize(); i++ {
			if d.RawData.Value(i, k) > max {
				max = d.RawData.Value(i, k)
			} else if d.RawData.Value(i, k) < min {
				min = d.RawData.Value(i, k)
			}
		}
		for i := 0; i < d.RawData.RowSize(); i++ {
			out[i][k] = (d.RawData.Value(i, k) - min) / (max - min)
		}
	}
	return out
}
func ( d CustomData ) FeatureScaling ( ) [ ] [ ] float64 { if d . RawData . ColSize ( ) == 0 { return [ ] [ ] float64 { } } out := make ( [ ] [ ] float64 , d . RawData . RowSize ( ) ) for i := 0 ; i < len ( out ) ; i ++ { out [ i ] = make ( [ ] float64 , d . RawData . ColSize ( ) ) } for k := 0 ; k < d . RawData . ColSize ( ) ; k ++ { max , min := d . RawData . Value ( 0 , k ) , d . RawData . Value ( 0 , k ) for i := 0 ; i < d . RawData . RowSize ( ) ; i ++ { if d . RawData . Value ( i , k ) > max { max = d . RawData . Value ( i , k ) } else if d . RawData . Value ( i , k ) < min { min = d . RawData . Value ( i , k ) } } for i := 0 ; i < d . RawData . RowSize ( ) ; i ++ { out [ i ] [ k ] = ( d . RawData . Value ( i , k ) - min ) / ( max - min ) } } return out }
FeatureScaling normalizes every columns with "feature scaling".
FeatureScaling normalizes every columns with " feature scaling " .
// check size // find max and min // normalization