我正在https://github.com/udacity/AIND-Recognize上的 GitHub 上进行手语识别。
我有一个关于模型选择的问题。当我在那里运行这个单元格时
import warnings
from hmmlearn.hmm import GaussianHMM
def train_a_word(word, num_hidden_states, features):
warnings.filterwarnings("ignore", category=DeprecationWarning)
training = asl.build_training(features)
X, lengths = training.get_word_Xlengths(word)
model = GaussianHMM(n_components=num_hidden_states, n_iter=1000).fit(X, lengths)
logL = model.score(X, lengths)
return model, logL
demoword = 'BOOK'
model, logL = train_a_word(demoword, 3 , features=features_ground)
print("Number of states trained in model for {} is {}".format(demoword, model.n_components))
print("logL = {}".format(logL))
我有这个错误:
TypeError Traceback (most recent call last) in () 12 13 demoword = 'BOOK' ---> 14 model,
logL = train_a_word(demoword, 3 , features=features_ground) 15 print("Number of states
trained in model for {} is {}".format(demoword, model.n_components))
16 print("logL = {}".format(logL)) in train_a_word(word, num_hidden_states, features)
7 training = asl.build_training(features) 8 X, lengths = training.get_word_Xlengths(word)
----> 9 model = GaussianHMM(n_components=num_hidden_states, n_iter=1000).fit(X, lengths)
10 logL = model.score(X, lengths) 11 return model, logL
TypeError: fit() takes 2 positional arguments but 3 were given
我想不通,我想提一下,我们不应该修改这个单元格。