hcet.py
def export_et(et, dataframe, basename):
    """
    writes out given elimination tree as a .res file containing the BN and
    a .jkl file containing the parent set scores
    """
    data = data_type.data(dataframe)
    total_score = 0.0
    all_scores = {}
    with open(basename + '.res', 'w') as outfile:
        eo = extract_eo(et)
        outfile.write("elim-order: ({})\n".format(",".join(map(str, eo))))
        for i in range(et.nodes.num_nds):
            parents = et.nodes[i].parents.display()
            parentstr = "({})".format(",".join(map(str, parents))) if parents else ""
            local_score = score_function(data, i, parents, metric='bic')
            all_scores[i] = {frozenset(parents): local_score}
            total_score += local_score
            outfile.write("{}: {:.2f}  {}\n".format(i, local_score, parentstr))
        outfile.write("Score: {:.2f}\n".format(total_score))
    write_jkl(all_scores, basename + ".jkl")
    return total_score

    writes out given elimination tree as a .res file containing the BN and
    a .jkl file containing the parent set scores
    
writes out given elimination tree as a .res file containing the BN and
a .jkl file containing the parent set scores
writes out given elimination tree as a . res file containing the BN and a . jkl file containing the parent set scores
def export_et(et, dataframe, basename):
    data = data_type.data(dataframe)
    total_score = 0.0
    all_scores = {}
    with open(basename + '.res', 'w') as outfile:
        eo = extract_eo(et)
        outfile.write("elim-order: ({})\n".format(",".join(map(str, eo))))
        for i in range(et.nodes.num_nds):
            parents = et.nodes[i].parents.display()
            parentstr = "({})".format(",".join(map(str, parents))) if parents else ""
            local_score = score_function(data, i, parents, metric='bic')
            all_scores[i] = {frozenset(parents): local_score}
            total_score += local_score
            outfile.write("{}: {:.2f}  {}\n".format(i, local_score, parentstr))
        outfile.write("Score: {:.2f}\n".format(total_score))
    write_jkl(all_scores, basename + ".jkl")
    return total_score
def export_et ( et , dataframe , basename ) : data = data_type . data ( dataframe ) total_score = 0.0 all_scores = { } with open ( basename + '.res' , 'w' ) as outfile : eo = extract_eo ( et ) outfile . write ( "elim-order: ({})\n" . format ( "," . join ( map ( str , eo ) ) ) ) for i in range ( et . nodes . num_nds ) : parents = et . nodes [ i ] . parents . display ( ) parentstr = "({})" . format ( "," . join ( map ( str , parents ) ) ) if parents else "" local_score = score_function ( data , i , parents , metric = 'bic' ) all_scores [ i ] = { frozenset ( parents ) : local_score } total_score += local_score outfile . write ( "{}: {:.2f}  {}\n" . format ( i , local_score , parentstr ) ) outfile . write ( "Score: {:.2f}\n" . format ( total_score ) ) write_jkl ( all_scores , basename + ".jkl" ) return total_score
writes out given elimination tree as a .res file containing the BN and
a .jkl file containing the parent set scores
writes out given elimination tree as a . res file containing the BN and a . jkl file containing the parent set scores
"""
    writes out given elimination tree as a .res file containing the BN and
    a .jkl file containing the parent set scores
    """
et
dataframe
basename