1. What is normalization:
Normalization is the method of taking a set of numbers (greater than 1) and making 1 the maximum value, 0 the minimum value, and the rest of the data in percentages. For example: 1, 2, 3..., then the normalization is: 0, 0.5, 1
2. Normalization step:
E.g. 2, 4, 6
(1) Find the minimum and maximum values of a set of numbers, and then calculate the difference between the maximum and minimum values.
min = 2; max = 6; r = max - min = 4
(2) Each number in the array is subtracted from the smallest value
2, 4, 6 becomes 0, 2, 4.
(3) and then remove the difference r
0, 2, 4 becomes 0, 0.5, 1
You get the normalized array.
3. Use python to normalize the numbers in each column of a matrix.
import numpy as np def autoNorm(data): # Pass in a matrix mins = (0) # Returns the smallest element in each column of the data matrix, returning a list maxs = (0) # Returns the largest element in each column of the data matrix, returning a list ranges = maxs - mins #Maximum value list - Minimum value list = Difference list normData = ((data)) # Generate a normData all-0 matrix of the same specification as the data matrix to hold the normalized data row = [0] # Returns the number of rows in the data matrix normData = data - (mins,(row,1)) Each column of the #data matrix is subtracted from the minimum value of each column. normData = normData / (ranges,(row,1)) Each column of the #data matrix is divided by the difference of each column (difference = maximum value of a column - minimum value of a column) return normData arr = ([[8,7,8],[4,3,1],[6,9,8]]) print(autoNorm(arr)) Print results: [[ 1. 0.66666667 1. ] [ 0. 0. 0. ] [ 0.5 1. 1. ]]
Above this on python3 a group of values of the normalization method explained is all that I share with you, I hope to give you a reference, and I hope you support me more.