Sunday, 16 June 2019

Apply the Min-Max Normalization technique to following result data and normalize them in the range [ 0.0 to 100.0 ] . Prepare the merit list according to normalization result and assign merit number. Data Mining and Business Intelligence GTU 2170715




Code :
               import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;

public class MinMaxNormalization
{

        public static void main(String[] args)
        {
                Student[] st = new Student[8];
                st[0] = new Student('A',9.1);
                st[1] = new Student('C',4.0);
                st[2] = new Student('E',5.4);
                st[3] = new Student('G',7.2);
                st[4] = new Student('B',3.7);
                st[5] = new Student('D',2.1);
                st[6] = new Student('F',3.8);
                st[7] = new Student('H',3.1);

                for(int i=0;i<4;i++)
                {
                        st[i].gen = minmax(0.0,10.0,0.0,100.0,st[i].uni);
                        st[i+4].gen = minmax(0.0,4.0,0.0,100.0,st[i+4].uni);
                }

                Arrays.sort(st);
                System.out.println("Name | Norm result | University Result ");
                for(int i=7;i>=0;i--)
                        System.out.println(st[i].name+" | "+st[i].gen+" | "+st[i].uni);
        }

        public static double minmax(double min,double max,double nmin,double
nmax,double val)
        {
                return ((val-min)*(nmax-nmin)/(max-min))+nmin;
        }
}

Student.java

public class Student implements Comparable<Student>
{
        public double uni,gen;
        public char name;
        public Student(char n,double u)
        {
                uni = u;
                name = n;
        }

        public int compareTo(Student compare)
        {
                double comp = compare.gen;
                return Double.compare(this.gen, comp);
        }
}

1 comment:

It's time To increase blogging capability. To have a chance to contribute in digital world. Any Interested People who want to make t...