Python中的numpy函数的使用ones,zeros,eye
在看别人写的代码时,看到的不知道的函数,就在这里记下来。
原文是这样用的:
1 weights = ones((numfeatures,1))
在python中help():
import numpy as np help(np.ones)
1 Help on function ones in module numpy.core.numeric: 2 3 ones(shape, dtype=None, order='C') 4 Return a new array of given shape and type, filled with ones. 5 6 Parameters 7 ---------- 8 shape : int or sequence of ints 9 Shape of the new array, e.g., ``(2, 3)`` or ``2``. 10 dtype : data-type, optional 11 The desired data-type for the array, e.g., `numpy.int8`. Default is 12 `numpy.float64`. 13 order : { 'C', 'F'}, optional 14 Whether to store multidimensional data in C- or Fortran-contiguous 15 (row- or column-wise) order in memory. 16 17 Returns 18 ------- 19 out : ndarray 20 Array of ones w