def learn_cltree(data, scope, root_var, alpha):
    if (root_var not in scope):
        raise RootVarError()
    (probs, j_probs) = compute_probs(data, alpha)
    mut_info = compute_mi_by_probs(probs, j_probs, np.log(j_probs))
    dtree_root = build_dependency_tree_from_mi(mut_info, scope, root_var)
    factors = compute_factors(probs, j_probs, dtree_root.get_tree()[1])
    factors_dict = {var: factors[scope.index(var)] for var in scope}
    return (dtree_root, factors_dict)
def learn_cltree(data, scope, root_var, alpha):
    if (root_var not in scope):
        raise RootVarError()
    (probs, j_probs) = compute_probs(data, alpha)
    mut_info = compute_mi_by_probs(probs, j_probs, np.log(j_probs))
    dtree_root = build_dependency_tree_from_mi(mut_info, scope, root_var)
    factors = compute_factors(probs, j_probs, dtree_root.get_tree()[1])
    factors_dict = {var: factors[scope.index(var)] for var in scope}
    return (dtree_root, factors_dict)