python Code 示例

来源:互联网 发布:java获取对象的属性值 编辑:程序博客网 时间:2024/05/08 05:48

1.  numpy load data

  def extract_data(filename):

        out = np.loadtxt(filename, dtype=np.str,delimiter=" ",comments=None);
  
      # Arrays to hold the labels and feature vectors.
      labels = out[:,2]
     labels = labels.reshape(labels.size,1)
      fvecs = out[:,3:]                                                                                                                                                  
  
     # Return a pair of the feature matrix and the one-hot label matrix.
      return fvecs,labels
  
原创粉丝点击