TypeError:|TypeError: Only length-1 arrays can be converted to Python scalars
#p1Vect也是一个向量
p1Vect = math.log(p1Num / p1Denom)
p0Vect = math.log(p0Num / p0Denom)
报错如下:
TypeError: Only length-1 arrays can be converted to Python scalars
【TypeError:|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)]
转载于:https://www.cnblogs.com/flyingcr/p/10326862.html
推荐阅读
- 由Uncaught|由Uncaught TypeError: this.player.startMoveAt is not a function引申
- Python|Python TypeError: 'module' object is not callable 原因分析
- 11月18日:I|11月18日:I choose only peace
- AnnotationTransactionAttributeSource is only available on Java 1.5 and higher
- ART 的 interpret-only模式源码及调用流程 & QuickCompiler后端调用流程
- Type|Type annotations can only be used in TypeScript files.ts(8010)
- Python3|Python3 TypeError: only size-1 arrays can be converted to Python scalars
- TypeError: Object of type ‘datetime‘ is not JSON serializable
- robot framework 报错TypeError: not unicode的解决办法直接修改为click element
- TypeError:|TypeError: an integer is required (got type str)