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...)
```

```    points = N.array(points)
num, dim = points.shape

```
```    point  = N.array(point)
points = N.array(points)

```
```    data = N.array(data)
num = data.shape[0]
#
std = math.sqrt(var)
skew = N.add.reduce( (data - mean)**3)/(float(num-1)* std**3)
```

```            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
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
```

```                    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]):
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
print "Warning: removing time indices %s for gene %i" % (str(Numeric.compress(ma2dTakeInd == 0, Numeric.arange(ma2dTakeInd.shape[0]))), eIdx)
```

```    def getNumFilteredProbesCtrlNorm_MaxCV(self):
if type(self.__filterMaxCV) == types.NoneType:
self._setFilterMaxCV()

def getNumFilteredProbesCtrlNeg_MaxCV(self):
if type(self.__filterMaxCV) == types.NoneType:
self._setFilterMaxCV()
```
```    def getNumFilteredProbesOther_MaxCV(self):
if type(self.__filterMaxCV) == types.NoneType:
self._setFilterMaxCV()

def getNumFilteredProbesCtrlNorm_MinRatio(self):
if type(self.__filterMinRatio) == types.NoneType:
self._setFilterMinRatio()
```
```    def getNumFilteredProbesCtrlNeg_MinRatio(self):
if type(self.__filterMinRatio) == types.NoneType:
self._setFilterMinRatio()

```

```def average(data):
data = Numeric.array(data)

def variance(data):
data = Numeric.array(data)
```
```    bin_width = (max-min)/nbins
data = Numeric.floor((data - min)/bin_width).astype(Numeric.Int)
Numeric.arange(nbins)[:,Numeric.NewAxis], data), -1)
histo[-1] = histo[-1] + Numeric.add.reduce(Numeric.equal(nbins, data))
```

```        coefMax = self.getAppxCoef(arr2d, maxNumCoef)
curveMax = self.getAppxCurve(coefMax)
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)
MSdrop =(SSE2-SSE1) / (maxNumCoef-k)
F = MSdrop / MSE1
```
```        coefMax = self.getAppxCoef(arr2d, maxNumCoef)
curveMax = self.getAppxCurve(coefMax)
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)
MSdrop =(SSE2-SSE1) / (maxNumCoef-k)
F = MSdrop / MSE1
```

```def average(data):
data = Numeric.array(data)

def variance(data):
data = Numeric.array(data)
```
```    bin_width = (max-min)/nbins
data = Numeric.floor((data - min)/bin_width).astype(Numeric.Int)
Numeric.arange(nbins)[:,Numeric.NewAxis], data), -1)
histo[-1] = histo[-1] + Numeric.add.reduce(Numeric.equal(nbins, data))
```

```def average(data):
data = Numeric.array(data)

def variance(data):
data = Numeric.array(data)
```
```    bin_width = (max-min)/nbins
data = Numeric.floor((data - min)/bin_width).astype(Numeric.Int)
Numeric.arange(nbins)[:,Numeric.NewAxis], data), -1)
histo[-1] = histo[-1] + Numeric.add.reduce(Numeric.equal(nbins, data))
```

```def average(data):
data = Numeric.array(data)

def variance(data):
data = Numeric.array(data)
```
```    bin_width = (max-min)/nbins
data = Numeric.floor((data - min)/bin_width).astype(Numeric.Int)
Numeric.arange(nbins)[:,Numeric.NewAxis], data), -1)
histo[-1] = histo[-1] + Numeric.add.reduce(Numeric.equal(nbins, data))
```

```        distSorted = distances.take(indSorted)
# number of distances different from MA.masked
```    xall = Numeric.arange(data.shape[0])