Did I find the right examples for you? yes no

All Samples(164)  |  Call(164)  |  Derive(0)  |  Import(0)
reduce(a, axis=0, dtype=None, out=None, keepdims=False)

Reduces `a`'s dimension by one, by applying ufunc along one axis.

Let :math:`a.shape = (N_0, ..., N_i, ..., N_{M-1})`.  Then
:math:`ufunc.reduce(a, axis=i)[k_0, ..,k_{i-1}, k_{i+1}, .., k_{M-1}]` =
the result of iterating `j` over :math:`range(N_i)`, cumulatively applying
ufunc to each :math:`a[k_0, ..,k_{i-1}, j, k_{i+1}, .., k_{M-1}]`.
For a one-dimensional array, reduce produces results equivalent to:
::(more...)

src/p/y/Pymol-script-repo-HEAD/modules/ADT/mglutil/math/usr.py   Pymol-script-repo(Download)
    points = N.array(points)
    num, dim = points.shape
    return N.add.reduce(points)/float(num)
 
 
    point  = N.array(point)
    points = N.array(points)
    return N.sqrt(N.add.reduce((points - point)**2, axis=1))
 
 
    data = N.array(data)
    num = data.shape[0]
    mean = N.add.reduce(data)/float(num)
    var = N.add.reduce((data - mean)**2)/float(num-1)
    #
    std = math.sqrt(var)
    skew = N.add.reduce( (data - mean)**3)/(float(num-1)* std**3)

src/o/r/Orange-Bioinformatics-2.5.25/orangecontrib/bio/widgets/Anova.py   Orange-Bioinformatics(Download)
            xi = self._arr2d.take(groupInd, 1)
            x_avrg[idx] = MA.average(MA.average(xi,1))                  # first average over replicas to obtain cell mean, then over factor A
            sum_count_x[idx] = Numeric.add.reduce(1./MA.count(xi,1))    # first count the number of measurements within cells, then sum inverses over factor A
            ##x_avrg[idx] = MA.average(MA.ravel(xi))                    # this is how Statistica computes it, but it is WRONG!
            ##sum_count_x[idx] = 1./MA.count(xi)                        # this is how Statistica computes it, but it is WRONG!
        # check if data is balanced
        rgLens = Numeric.array(map(lambda x: len(x), replicaGroupInd), Numeric.Int)
        isBalanced = Numeric.add.reduce((1.*rgLens/rgLens[0]) == Numeric.ones((len(rgLens)))) / len(rgLens) == 1
 
        # check for empty cells, raise exception if empty cells exist and addInteraction=1
        if addInteraction:
            ax1Ind = Numeric.concatenate(([0], Numeric.add.accumulate(rgLens)))
            for idx in range(rgLens.shape[0]):
                if Numeric.add.reduce(MA.count(arr2d[:,ax1Ind[idx]:ax1Ind[idx+1]],1) == 0) > 0:
            xi = self._arr2d.take(replicaInd, 1)
            x_avrg[idx] = MA.average(MA.average(xi,1))                  # first average over replicas to obtain cell mean, then over factor A
            sum_count_x[idx] = Numeric.add.reduce(1./MA.count(xi,1))    # first count the number of measurements within cells, then sum inverses over factor A
            ##x_avrg[idx] = MA.average(MA.ravel(xi))                    # this is how Statistica computes it, but it is WRONG!
            ##sum_count_x[idx] = 1./MA.count(xi)                        # this is how Statistica computes it, but it is WRONG!
 
        # check if data is balanced
        isBalanced = (1. * Numeric.add.reduce((1.*groupLens/groupLens[0]) == Numeric.ones(groupLens.shape[0])) / groupLens.shape[0]) == 1
 
        # check for empty cells; if exist and addInteraction=1, switch to no interaction and continue

src/o/r/Orange-Bioinformatics-2.5.25/orangecontrib/bio/widgets/prototypes/OWANOVA.py   Orange-Bioinformatics(Download)
                    numVariablesList.append(len(et.domain.variables))
            # test that all ExampleTables consist of equal number of examples and variables
            if len(numExamplesList) == 0 or Numeric.add.reduce(Numeric.equal(numExamplesList, numExamplesList[0])) != len(numExamplesList):
                self.dataStructure = None
                self.numExamples = -1
                self.infob.setText("Error: data files contain unequal number of examples, aborting ANOVA computation.")
                self.infoc.setText('')
            elif len(numVariablesList) == 0 or Numeric.add.reduce(Numeric.equal(numVariablesList, numVariablesList[0])) != len(numVariablesList):
        for aIdx in range(ma3d.shape[1]):
            for rIdx in range(groupLens.shape[0]):
                if Numeric.add.reduce(MA.count(ma3d[:,aIdx,ax2Ind[rIdx]:ax2Ind[rIdx+1]],1)) == 0:
                    tInd2rem.append(aIdx)
                    break
            for g,(i0,i1) in enumerate(zip(ax2Ind[:-1], ax2Ind[1:])):
                cellCount[:,g] = MA.count(ma2d[:,i0:i1], 1)
            ma2dTakeInd = Numeric.logical_not(Numeric.add.reduce(Numeric.equal(cellCount,0),1)) # 1 where to take, 0 where not to take
            if Numeric.add.reduce(ma2dTakeInd) != ma2dTakeInd.shape[0]:
                print "Warning: removing time indices %s for gene %i" % (str(Numeric.compress(ma2dTakeInd == 0, Numeric.arange(ma2dTakeInd.shape[0]))), eIdx)

src/o/r/Orange-Bioinformatics-2.5.25/orangecontrib/bio/widgets/prototypes/OWNormalize.py   Orange-Bioinformatics(Download)
    def getNumFilteredProbesCtrlNorm_MaxCV(self):
        if type(self.__filterMaxCV) == types.NoneType:
            self._setFilterMaxCV()
        return Numeric.add.reduce(Numeric.logical_and(self.__filterMaxCV, self._isProbeCtrlNormArr()))
 
    def getNumFilteredProbesCtrlNeg_MaxCV(self):
        if type(self.__filterMaxCV) == types.NoneType:
            self._setFilterMaxCV()
        return Numeric.add.reduce(Numeric.logical_and(self.__filterMaxCV, self._isProbeCtrlNegArr()))
    def getNumFilteredProbesOther_MaxCV(self):
        if type(self.__filterMaxCV) == types.NoneType:
            self._setFilterMaxCV()
        return Numeric.add.reduce(Numeric.logical_and(self.__filterMaxCV, self._isProbeOtherArr()))
 
 
    def getNumFilteredProbesCtrlNorm_MinRatio(self):
        if type(self.__filterMinRatio) == types.NoneType:
            self._setFilterMinRatio()
        return Numeric.add.reduce(Numeric.logical_and(self.__filterMinRatio, self._isProbeCtrlNormArr()))
    def getNumFilteredProbesCtrlNeg_MinRatio(self):
        if type(self.__filterMinRatio) == types.NoneType:
            self._setFilterMinRatio()
        return Numeric.add.reduce(Numeric.logical_and(self.__filterMinRatio, self._isProbeCtrlNegArr()))
 

src/p/y/Pymol-script-repo-HEAD/modules/pdb2pqr/contrib/numpy-1.1.0/numpy/oldnumeric/rng_stats.py   Pymol-script-repo(Download)
def average(data):
    data = Numeric.array(data)
    return Numeric.add.reduce(data)/len(data)
 
def variance(data):
    data = Numeric.array(data)
    return Numeric.add.reduce((data-average(data,axis=0))**2)/(len(data)-1)
    bin_width = (max-min)/nbins
    data = Numeric.floor((data - min)/bin_width).astype(Numeric.Int)
    histo = Numeric.add.reduce(Numeric.equal(
        Numeric.arange(nbins)[:,Numeric.NewAxis], data), -1)
    histo[-1] = histo[-1] + Numeric.add.reduce(Numeric.equal(nbins, data))

src/o/r/Orange-Bioinformatics-2.5.25/orangecontrib/bio/widgets/chipappx.py   Orange-Bioinformatics(Download)
        coefMax = self.getAppxCoef(arr2d, maxNumCoef)
        curveMax = self.getAppxCurve(coefMax)
        SSE1 = Numeric.add.reduce((arr2d-curveMax)**2,1)
        MSE1 = SSE1 / (arr2d.shape[1]-maxNumCoef)
        #print "SSE1[0], MSE1[0]",SSE1[0], MSE1[0]
            coefk = Numeric.concatenate((coefMax[:,:k], Numeric.zeros((shpk), Numeric.Float)),1)
            curvek = self.getAppxCurve(coefk)
            SSE2 = Numeric.add.reduce((arr2d-curvek)**2,1)
            MSdrop =(SSE2-SSE1) / (maxNumCoef-k)
            F = MSdrop / MSE1
        coefMax = self.getAppxCoef(arr2d, maxNumCoef)
        curveMax = self.getAppxCurve(coefMax)
        SSE1 = Numeric.add.reduce((arr2d-curveMax)**2,1)
        MSE1 = SSE1 / (arr2d.shape[1]-maxNumCoef)
        #print "SSE1[0], MSE1[0]",SSE1[0], MSE1[0]
            coefk = Numeric.concatenate((coefMax[:,:k], Numeric.zeros((shpk), Numeric.Float)),1)
            curvek = self.getAppxCurve(coefk)
            SSE2 = Numeric.add.reduce((arr2d-curvek)**2,1)
            MSdrop =(SSE2-SSE1) / (maxNumCoef-k)
            F = MSdrop / MSE1

src/s/p/Spherebot-Host-GUI-HEAD/InkscapePortable/App/Inkscape/python/Lib/site-packages/numpy/oldnumeric/rng_stats.py   Spherebot-Host-GUI(Download)
def average(data):
    data = Numeric.array(data)
    return Numeric.add.reduce(data)/len(data)
 
def variance(data):
    data = Numeric.array(data)
    return Numeric.add.reduce((data-average(data,axis=0))**2)/(len(data)-1)
    bin_width = (max-min)/nbins
    data = Numeric.floor((data - min)/bin_width).astype(Numeric.Int)
    histo = Numeric.add.reduce(Numeric.equal(
        Numeric.arange(nbins)[:,Numeric.NewAxis], data), -1)
    histo[-1] = histo[-1] + Numeric.add.reduce(Numeric.equal(nbins, data))

src/n/u/nupic-linux64-HEAD/lib64/python2.6/site-packages/numpy/oldnumeric/rng_stats.py   nupic-linux64(Download)
def average(data):
    data = Numeric.array(data)
    return Numeric.add.reduce(data)/len(data)
 
def variance(data):
    data = Numeric.array(data)
    return Numeric.add.reduce((data-average(data,axis=0))**2)/(len(data)-1)
    bin_width = (max-min)/nbins
    data = Numeric.floor((data - min)/bin_width).astype(Numeric.Int)
    histo = Numeric.add.reduce(Numeric.equal(
        Numeric.arange(nbins)[:,Numeric.NewAxis], data), -1)
    histo[-1] = histo[-1] + Numeric.add.reduce(Numeric.equal(nbins, data))

src/m/i/MissionPlanner-HEAD/Lib/site-packages/numpy/oldnumeric/rng_stats.py   MissionPlanner(Download)
def average(data):
    data = Numeric.array(data)
    return Numeric.add.reduce(data)/len(data)
 
def variance(data):
    data = Numeric.array(data)
    return Numeric.add.reduce((data-average(data,axis=0))**2)/(len(data)-1)
    bin_width = (max-min)/nbins
    data = Numeric.floor((data - min)/bin_width).astype(Numeric.Int)
    histo = Numeric.add.reduce(Numeric.equal(
        Numeric.arange(nbins)[:,Numeric.NewAxis], data), -1)
    histo[-1] = histo[-1] + Numeric.add.reduce(Numeric.equal(nbins, data))

src/o/r/Orange-Bioinformatics-2.5.25/orangecontrib/bio/widgets/chipimpute.py   Orange-Bioinformatics(Download)
        distSorted = distances.take(indSorted)
        # number of distances different from MA.masked
        numNonMasked = distSorted.shape[0] - Numeric.add.reduce(Numeric.asarray(MA.getmaskarray(distSorted), Numeric.Int))
        # number of distances to account for (K or less)
        if numNonMasked > 1:
    xall = Numeric.arange(data.shape[0])
    xallList = xall.tolist()
    for ii in Numeric.compress(Numeric.add.reduce(maskInv,0) > 1, range(data.shape[1])):    # run loess if the profile contains more than 2 values
        try:
            data[:,ii] = MA.array(statc.loess(zip(MA.compress(maskInv[:,ii], xall).tolist(), MA.compress(maskInv[:,ii], data[:,ii]).tolist()), xallList, windowSize))[:,1]

  1 | 2 | 3 | 4  Next