Я пытаюсь получить доступ к методу fit
на clf
объекта в моем Stock
классе, я получаю эту ошибку:несвязанный метод подходит() должен быть вызван DecisionTreeClassifier например, в качестве первого аргумента (получил со экземпляра вместо)
unbound method fit() must be called with DecisionTreeClassifier instance as first argument (got Stock instance instead)
Stock класс:
class Stock():
def __init__(self,equity, history):
self.equity = equity
self.history = history
self.clf = tree.DecisionTreeClassifier
# Couldn't use built-in comparable method
# This method is a workaround.
def exists(self, allCompanies):
exists = False;
for other in allCompanies:
if self.equity.sid == other.equity.sid:
exists = True
return exists
Где я инстанцировании класс:
....
arr.append(Stock(equity, history))
Где выбрасывается ошибка:
...
if current > prev:
Stock.clf.fit(Stock, 1)
else:
Stock.clf.fit(Stock, 0)
...