Saturday, 8 September 2018

Preprocessing of Noisy Data. Data Mining and Business Intelligence GTU 2170715


Consider the following values for age attribute of total 9 records:
4,8,15,21,21,24,25,28,34
Implement smoothing by bin medians to smooth these data, using a suitable bin depth.

       Code :
import java.util.*;

public class p5
{
    public static void main(String[] args)
    {
        Scanner s = new Scanner(System.in);
  
        int i;
        System.out.println("Enter Size of Data:");
        int size = s.nextInt();
        int bin[] = new int[size];
       
        System.out.println("Enter Data:");
        for(i=0;i<size;i++)
        {
            bin[i] = s.nextInt();
        }
      
        Arrays.sort(bin);
      
        System.out.println("Sorting is:");
        for(i=0;i<size;i++)
        {
            System.out.println(""+bin[i]);
        }
      
        i=0;
        int k=0,j,temp=0,l=0;
     
        while(i!=((size)/3))
        {
            for(j=0;j<3;j++)
            {
                                         if(j<1)
                                         {
                                                     int a = bin[k+1];
                                                     bin[k+2]=a;
                                                     bin[k] = bin[k+1];
                                         }
                k++;
            }
            i++;
        }

        System.out.println("Final Output: ");
        for(j=0;j<size;j++)
        {
                System.out.println(""+bin[j]);
        }
    }
}

No comments:

Post a 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...