#p1Vect也是一个向量
    p1Vect = math.log(p1Num / p1Denom)
    p0Vect = math.log(p0Num / p0Denom)

报错如下:

TypeError: Only length-1 arrays can be converted to Python scalars

原因:

math.log()不能直接处理矩阵

resolution:

  #p1Vect也是一个向量
    p1Vect = [math.log(x) for x in (p1Num / p1Denom)]
    p0Vect = [math.log(x) for x in (p0Num / p0Denom)]

 

相关文章:

  • 2021-12-13
  • 2022-01-05
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-04-08
  • 2021-12-27
  • 2021-06-30
  • 2022-12-23
  • 2021-06-01
  • 2021-10-06
相关资源
相似解决方案