Registrations Closing Soon for DevOps Certification Training by CloudxLab | Registrations Closing in

  Enroll Now

Winsorization Method or Percentile Capping

This method is similar to IQR method. If any value exceeds the value of the 99th percentile or is below the 1st percentile then they are treated as outliers.

INSTRUCTIONS
  • First, we will import Numpy as np

    import numpy as <<your code goes here>>
    
  • Then, we will use the same datapoints we used ealier

    x = [5, 5, 5, -99, 5, 5, 5, 5, 5, 5, 88, 5, 5, 5]
    
  • Now, we will define a function winsorization_outliers to detect the outliers

    def <<your code goes here>>(data):
        outlier=[]
        q1 = np.percentile(data, 1)
        q3 = np.percentile(data, 99)
        for i in data:
            if i > q3 or i < q1:
                outlier.append(i)
        print("Outliers:",outlier)
    
  • Finally, we will call this function using our datapoints

    winsorization_outliers(<<your code goes here>>)
    

No hints are availble for this assesment

Answer is not availble for this assesment


Note - Having trouble with the assessment engine? Follow the steps listed here

Loading comments...