Python 什么会导致-->;TypeError:float()参数必须是字符串或数字,而不是';方法';

Python 什么会导致-->;TypeError:float()参数必须是字符串或数字,而不是';方法';,python,machine-learning,decision-tree,sklearn-pandas,kaggle,Python,Machine Learning,Decision Tree,Sklearn Pandas,Kaggle,在kaggle泰坦尼克号比赛中尝试我的双手 我运行了下面的代码,并在标题中得到了错误消息。我可能做错了什么 # run decision tree model on the data and printing the accuracy from sklearn import tree decision_tree = tree.DecisionTreeClassifier(max_depth=3) model = decision_tree.fit(trainData, trainLabels)

在kaggle泰坦尼克号比赛中尝试我的双手

我运行了下面的代码,并在标题中得到了错误消息。我可能做错了什么

# run decision tree model on the data and printing the accuracy
from sklearn import tree

decision_tree = tree.DecisionTreeClassifier(max_depth=3)
model = decision_tree.fit(trainData, trainLabels)

accuracy = model.score(valData, valLabels) * 100
accuracy

因为在代码中没有显示对
float
的调用,所以很难说。但通常是由于忘记在函数名后面加上
()
来调用它。您至少应该提供整个错误回溯(它包含有关错误来源的有价值的信息)。你应该努力提供一个良好的环境。