Python Perceptron类在我使用numpy.dot时导致Typeerror

Python Perceptron类在我使用numpy.dot时导致Typeerror,python,numpy,class,neural-network,Python,Numpy,Class,Neural Network,我目前正试图进入机器学习,但我被困在更新的实施。 我目前的代码是 import numpy as np 类MCP(): 但是代码已经在预测部分抱怨了 a=train[0] print(a) >> ['4.9', '3.0', '1.4', '0.2', '0 '] 我希望我的预测是a[0:4]和权重[0.0.0.0]的点积 出现此错误 TypeError: ufunc 'multiply' did not contain a loop with signature matc

我目前正试图进入机器学习,但我被困在更新的实施。 我目前的代码是

import numpy as np
类MCP():

但是代码已经在预测部分抱怨了

 a=train[0]
 print(a)
 >> ['4.9', '3.0', '1.4', '0.2', '0 ']
我希望我的预测是a[0:4]和权重[0.0.0.0]的点积

出现此错误

TypeError: ufunc 'multiply' did not contain a loop with signature matching typesdtype (<U3) dtype (<U3) dtype (<U3)         

TypeError:ufunc'multiply'不包含签名匹配typesType的循环(不能将
dot/matmul
与字符串一起使用。它需要可以乘法和求和的对象。您需要更多注意此函数输入的
dtype
。请参阅
print(a)中的引号
?这意味着
train
(数组)包含字符串,而不是数字。这不会造成问题,但我建议为
train
函数使用不同的名称。我应该如何将列表中的字符串项转换为所需的类型?我尝试了一些转换,但到目前为止都失败
np.array(a,float)
应生成一个数字数组。
TypeError: ufunc 'multiply' did not contain a loop with signature matching typesdtype (<U3) dtype (<U3) dtype (<U3)