normalization - Normalize double array in java -
i have double arraylist dataset in java. want normalize data data clustering , function normalize data clustering in here normalization data cluster
input = {{-1.3,2.4,5.3.2.1,0.7},{6.4,-3.3,1.9.4.1,0.3}}
below code i've tried far, i'm not sure it's right normalization method
public void getminmax(){ min = new double[input.size()]; max = new double[input.size()]; for(int i=0; < 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; < 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])); } } }
Comments
Post a Comment