returns the central vector of a list of vectors
185454
def centroid(data, method=median):
    ""
    out = []
    for i in range(len(data[0])):
        out.append(method([x[i] for x in data]))
    return tuple(out)
78715
def one_hot(cls, n, l):
        
        v = [0.0] * l
        v[n] = 1.0
        return Vector(v)
115837
def get_input_vector(self, ind):
        
        dim = self.get_dimension()
        b = fasttext.Vector(dim)
        self.f.getInputVector(b, ind)
        return np.array(b)
608190
def vector(p1, p2):
    
    return None if len(p1) != len(p2) else np.array([p2[i] - p1[i] for i in xrange(len(p1))])
1271561
def filter_vectors(self, input_list):
        
        try:
            # Return filtered (vector, data, distance )tuple list. Will fail
            # if input is list of (vector, data) tuples.
            return [x for x in input_list if x[2] < self.distance_threshold]
        except:
            # Otherwise just return input list
            return input_list
994211
def _calculate_vector(self, operation, left, right):
        
        result = []
        if len(right) == 1:
            right = _to_numeric(right[0])
            for iteml in left:
                iteml = _to_numeric(iteml)
                result.append(self.binops_math[operation](iteml, right))
        elif len(left) == 1:
            left = _to_numeric(left[0])
            for itemr in right:
                itemr = _to_numeric(itemr)
                result.append(self.binops_math[operation](left, itemr))
        elif len(left) == len(right):
            for iteml, itemr in zip(left, right):
                iteml = _to_numeric(iteml)
                itemr = _to_numeric(itemr)
                result.append(self.binops_math[operation](iteml, itemr))
        else:
            raise FilteringRuleException("Uneven length of math operation '{}' operands".format(operation))
        return result
163164
def vectors(self, array):
        
        if array.ndim != 2:
            raise AssertionError('vector array must be a 2-dimensional array')
        elif array.shape[1] != 3:
            raise RuntimeError('vector array must be 3D')
        elif array.shape[0] != self.n_points:
            raise RuntimeError('Number of vectors be the same as the number of points')

        self.point_arrays[DEFAULT_VECTOR_KEY] = array
        self.active_vectors_name = DEFAULT_VECTOR_KEY
1359477
def from_list(a, order='F'):
        
        d = len(a)  # Number of cores
        res = vector()
        n = _np.zeros(d, dtype=_np.int32)
        r = _np.zeros(d+1, dtype=_np.int32)
        cr = _np.array([])
        for i in xrange(d):
            cr = _np.concatenate((cr, a[i].flatten(order)))
            r[i] = a[i].shape[0]
            r[i+1] = a[i].shape[2]
            n[i] = a[i].shape[1]
        res.d = d
        res.n = n
        res.r = r
        res.core = cr
        res.get_ps()
        return res
68778
def getOrderVectorsEGMM(self):
        

        orderVectors = []
        for preference in self.preferences:
            orderVectors.append(preference.getOrderVectorEGMM())
        return orderVectors
472923
function pivotVector(vectors=[]) {
              return vectors.reduce((result, val, index/*, arr*/) => {
                val.forEach((vecVal, i) => {
                  (index === 0)
                    ? (result.push([vecVal, ]))
                    : (result[ i ].push(vecVal));
                });
                return result;
              }, []);
            }
337423
def get_neutral(array_list):
    
    res = []
    for x in array_list:
        res.append(np.zeros_like(x))
    return res
886929
def _compute_centers(self, X, sparse, rs):
        """"""

        super(GRBFRandomLayer, self)._compute_centers(X, sparse, rs)

        centers = self.components_['centers']
        sorted_distances = np.sort(squareform(pdist(centers)))
        self.dF_vals = sorted_distances[:, -1]
        self.dN_vals = sorted_distances[:, 1]/100.0
        #self.dN_vals = 0.0002 * np.ones(self.dF_vals.shape)

        tauNum = np.log(np.log(self.grbf_lambda) /
                        np.log(1.0 - self.grbf_lambda))

        tauDenom = np.log(self.dF_vals/self.dN_vals)

        self.tau_vals = tauNum/tauDenom

        self._extra_args['taus'] = self.tau_vals
1164346
def sum(self, vector):
        """"""
        return self.from_list(
            [x + vector.vector[i] for i, x in self.to_list()]
        )
821190
def centroid(X):
    
    C = np.sum(X, axis=0) / len(X)
    return C
783735
def vector(x, y=None, z=0.0):
    
    if y is None:  # assume x is already [x,y,z]
        return np.array(x, dtype=np.float64)
    return np.array([x, y, z], dtype=np.float64)
1318079
def center
      center = Vector3.new()
      @vertices.each do |vertex|
        center += vertex
      end
      center /= @vertices.size
      return center
    end
306434
def vectorize(self, token_list):
        '''
        
        '''
        vector_list = [self.__collection.tf_idf(token, self.__collection) for token in token_list]
        return vector_list