# Path: concept_formation/cobweb3.py
# class Cobweb3Tree(CobwebTree):
# class Cobweb3Node(CobwebNode):
#     def __init__(self, scaling=0.5, inner_attr_scaling=True):
#     def clear(self):
#     def get_inner_attr(self, attr):
#     def update_scales(self, instance):
#     def cobweb(self, instance):
#     def ifit(self, instance):
#     def increment_counts(self, instance):
#     def update_counts_from_node(self, node):
#     def expected_correct_guesses(self):
#     def pretty_print(self, depth=0):
#     def get_weighted_values(self, attr, allow_none=True):
#     def predict(self, attr, choice_fn="most likely", allow_none=True):
#     def probability(self, attr, val):
#     def log_likelihood(self, child_leaf):
#     def is_exact_match(self, instance):
#     def output_json(self):


from math import log
from concept_formation.cobweb3 import cv_key
import copy
      the tree root times the number of clusters
    * :math:`n` is the number of instances.

    Given the particular math of AICc I decided that is n-k-1 = 0 then the
    function will return float('inf').

    :param clusters: A unique set of cluster concepts from the tree
    :type clusters: {:class:`CobwebNode<concept_formation.cobweb.CobwebNode>`,
        :class:`CobwebNode<concept_formation.cobweb.CobwebNode>`, ...}
    :param tree: The tree that the clusters come from (used to calculated
        number of parameters)
    :type tree: :class:`CobwebTree <concept_formation.cobweb.CobwebTree>`,
        :class:`Cobweb3Tree <concept_formation.cobweb3.Cobweb3Tree>`, or
        :class:`TrestleTree <concept_formation.trestle.TrestleTree>`
    :param instances: The set of clustered instances
    :type instances: [:ref:`Instance<instance-rep>`,
        :ref:`Instance<instance-rep>`, ...]
    :returns: The AIC of the clustering
    :rtype: float
    """
    ll = 0
    n = len(leaves)
    k = 0

    for i, conc in enumerate(clusters):
        ll += conc.log_likelihood(leaves[i])

    for conc in set(clusters):
        for attr in conc.attrs():
            for val in conc.av_counts[attr]:

# Path: concept_formation/cobweb3.py
# class Cobweb3Tree(CobwebTree):
# class Cobweb3Node(CobwebNode):
#     def __init__(self, scaling=0.5, inner_attr_scaling=True):
#     def clear(self):
#     def get_inner_attr(self, attr):
#     def update_scales(self, instance):
#     def cobweb(self, instance):
#     def ifit(self, instance):
#     def increment_counts(self, instance):
#     def update_counts_from_node(self, node):
#     def expected_correct_guesses(self):
#     def pretty_print(self, depth=0):
#     def get_weighted_values(self, attr, allow_none=True):
#     def predict(self, attr, choice_fn="most likely", allow_none=True):
#     def probability(self, attr, val):
#     def log_likelihood(self, child_leaf):
#     def is_exact_match(self, instance):
#     def output_json(self):


# Path: concept_formation/cluster.py
from math import log
from concept_formation.cobweb3 import cv_key
import copy

      the tree root times the number of clusters
    * :math:`n` is the number of instances.

    Given the particular math of AICc I decided that is n-k-1 = 0 then the
    function will return float('inf').

    :param clusters: A unique set of cluster concepts from the tree
    :type clusters: {:class:`CobwebNode<concept_formation.cobweb.CobwebNode>`,
        :class:`CobwebNode<concept_formation.cobweb.CobwebNode>`, ...}
    :param tree: The tree that the clusters come from (used to calculated
        number of parameters)
    :type tree: :class:`CobwebTree <concept_formation.cobweb.CobwebTree>`,
        :class:`Cobweb3Tree <concept_formation.cobweb3.Cobweb3Tree>`, or
        :class:`TrestleTree <concept_formation.trestle.TrestleTree>`
    :param instances: The set of clustered instances
    :type instances: [:ref:`Instance<instance-rep>`,
        :ref:`Instance<instance-rep>`, ...]
    :returns: The AIC of the clustering
    :rtype: float
    """
    ll = 0
    n = len(leaves)
    k = 0

    for i, conc in enumerate(clusters):
        ll += conc.log_likelihood(leaves[i])

    for conc in set(clusters):
        for attr in conc.attrs():
            for val in conc.av_counts[attr]:

                if val == cv_key: