コード例 #1
0
def run_ctm(X, args):
    logging.info("Estimating BIC tree:")
    # Instantiates BIC object with received parameters
    bic = BIC(args.penalty,
              df_method=args.df,
              keep_data=keep(args),
              perl_compatible=args.perl_compatible)
    bic.fit(X)
    tree = bic.context_tree
    logging.info("Tree found:")
    logging.info(tree.to_str(reverse=True))
    save_file(tree, args)
    check_consistency(tree, args)
コード例 #2
0
def test_perl_compatibility(sample_pl_compat):
    bic = BIC(2000, keep_data=False, perl_compatible=True)
    bic.fit(sample_pl_compat)
    # perl version doesn't have the empty node
    assert bic.context_tree.to_str() == '0 1'