How to use the hmmlearn.hmm.BernoulliMultiHMM function in hmmlearn

To help you get started, we’ve selected a few hmmlearn examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ringw / homer / moonshine / models / train_barlines_hmm.py View on Github external
def fit(files):
    HMM_FILE = os.path.join(os.path.dirname(__file__), 'barlines_hmm.pkl')

    model = hmm.BernoulliMultiHMM(n_components=100)

    staves = []
    for filename in files:
        try:
            pages = moonshine.open(filename)
        except Exception:
            import traceback
            traceback.print_exc()
            continue
        if not (0 < len(pages) <= 100):
            continue
        print filename
        for page in pages:
            gc.collect()
            page.preprocess()
            if type(page.staff_dist) is not int: