| Python zip() 函数
  参考链接:Python zip() 函数
 Python dict() 函数
  pandas.get_dummies 的用法 get_dummies 是利用pandas实现one hot encode的方式
 
  CSR-matrix稀疏矩阵(附demo)
 
  Python enumerate() 函数
 
   python coo_matrix的理解和用法
  NumPy和SciPy - .todense()和.toarray()之间的区别
 
   one-hot encoding和常规label的转化 
  coo_matrix 
   Scipy 稀疏矩阵
 
 
 mtx = sparse.coo_matrix((3, 4), dtype=np.int8)
print(mtx.todense())
>>> [[0 0 0 0]
     [0 0 0 0]
     [0 0 0 0]]
row = np.array([0, 3, 1, 0])
col = np.array([0, 3, 1, 2])
data = np.array([4, 5, 7, 9])
mtx = sparse.coo_matrix((data, (row, col)), shape=(4, 4))
print(mtx)
>>>   (0, 0)    4
      (3, 3)    5
      (1, 1)    7
      (0, 2)    9
print(mtx.todense())
>>> [[4 0 9 0]
     [0 7 0 0]
     [0 0 0 0]
     [0 0 0 5]]
row = np.array([0, 0, 1, 3, 1, 0, 0])
col = np.array([0, 2, 1, 3, 1, 0, 0])
data = np.array([1, 1, 1, 1, 1, 1, 1])
mtx = sparse.coo_matrix((data, (row, col)), shape=(4, 4))
print(mtx.todense())
>>> [[3 0 1 0]
     [0 2 0 0]
     [0 0 0 0]
     [0 0 0 1]]
print(mtx[2, 3])
>>> Traceback (most recent call last):
  File "/Users/shenyi/Documents/Untitled.py", line 21, in <module>
    print(mtx[2, 3])
TypeError: 'coo_matrix' object is not subscriptable
 eye(m[, n, k, dtype, format]):对角线为1的稀疏矩阵identity(n[, dtype, format]):单位矩阵
 diags(diagonals[, offsets, shape, format, dtype]):构造对角矩阵(含偏移量)
 
  torch.from_numpy(ndarray) 功能及举例
 
   pytorch中torch.manual_seed()的理解
 
    每次运行的结果是相同的
 import argparse模块总结
  关于python中.item()的用法 
   torch.optim.Adam优化器参数学习 
  model.train() 在使用pytorch构建神经网络的时候,训练过程中会在程序上方添加一句model.train(),作用是启用batch normalization和drop out。
 
  参考链接:pytorch model.train() |