@staticmethod
    def fitDiscretePowerLaw(x, xmins = None):
        
        xmax = numpy.max(x)
        if xmins == None:
            xmin = numpy.max(numpy.array([numpy.min(x), 1]))
            xmins = numpy.arange(xmin, xmax)

        #Note that x must have at least 2 unique elements 
        if xmins.shape[0] == 0:
            return -1, -1, numpy.min(x)

        alphas = numpy.arange(1.5, 3.5, 0.01)
        ksAlpha = numpy.zeros((xmins.shape[0], 2))

        for j in range(xmins.shape[0]):
            xmin = xmins[j]
            z = x[x >= xmin]
            n = z.shape[0]

            sumLogx = numpy.sum(numpy.log(z))
            likelyhoods = numpy.zeros(alphas.shape[0])
            
            for i in range(alphas.shape[0]):
                likelyhoods[i] = -n*numpy.log(scipy.special.zeta(alphas[i], xmin)) -alphas[i]*sumLogx
        
            k = numpy.argmax(likelyhoods)

            #Compute KS statistic
            cdf = numpy.cumsum(numpy.bincount(z)[xmin:xmax]/float(n))
            fit = numpy.arange(xmin, xmax)**-alphas[k] /scipy.special.zeta(alphas[k], xmin)
            fit = numpy.cumsum(fit)
            ksAlpha[j, 0] = numpy.max(numpy.abs(cdf - fit))
            ksAlpha[j, 1] = alphas[k]

        i = numpy.argmin(ksAlpha[:, 0])

        return ksAlpha[i, 0], ksAlpha[i, 1], xmins[i]
Deletes snapshot policies for the account.
dataset/ETHPy150Open charanpald/APGL/apgl/util/Util.py/Util.fitDiscretePowerLaw--crossover with--dataset/ETHPy150Open jasonhancock/cloudstack-python-client/CloudStack/Client.py/Client.deleteSnapshotPolicies