I have a double arraylist dataset in Java. I want to normalize the data for data clustering , the function to normalize data for clustering is in here normalization for data cluster
input = {{-1.3,2.4,5.3.2.1,0.7},{6.4,-3.3,1.9.4.1,0.3}}
Below is the code I've tried so far, but I'm not sure it's the right normalization method
public void getMinMax(){
min = new double[input.size()];
max = new double[input.size()];
for(int i=0; i < input.size(); i++){
min[i] = 0;
max[i] = 0;
for(int j = 0; j < input.get(i).size(); j++){
if(input.get(i).get(j) >= max[i]){
max[i] = input.get(i).get(j);
} else if(input.get(i).get(j) <= min[i]){
min[i] = input.get(i).get(j);
}
}
}
}
private void normalizeMaxMin() {
for(int i=0; i < input.size(); i++){
for(int j = 0; j < input.get(i).size(); j++){
input.get(i).set(j, (input.get(i).get(j) - min[i]) / (max[i] - min[i]));
}
}
}