我正在使用Pomegranate 库 来实现 HMM。我正在按照文档所说的使用该from_samples
函数,该函数说参数之一labels
应该是:
An array of state labels for each sequence. This is only used in ‘labeled’ training. If used this must be comprised of n lists where n is the number of sequences to train on, and each of those lists must have one label per observation. Default is None.
我的代码是:
model = HiddenMarkovModel('Gestures').from_samples(
NormalDistribution, 3, training, labels=[0, 1, 2], algorithm='labeled')
我得到错误:
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
这没有意义,因为我正在输入一个数组,但我想它认为我应该输入一个布尔值?