# Path: classifip/representations/credalset.py
# class CredalSet(object):
#     def __init__(self,spacesize):
#     def addconstraints(self,constmat):
#     def delconstraints(self,constdel):
#     def isproper(self):
#     def issubsetmask(array):
#     def getlowerprobability(self,subset):
#     def getupperprobability(self,subset):
#     def isreachable(self):
#     def setreachableprobability(self):
#     def getmaximindecision(self,utilities=None):
#     def getmaximaxdecision(self, utilities=None):
#     def gethurwiczdecision(self,alpha,utilities=None):
#     def getmaximaldecision(self, utilities=None):
#     def getintervaldomdecision(self, utilities=None):
#     def solvelowerexpectation(self,obj):
#     def getlowerexpectation(self,obj):
#     def getupperexpectation(self,obj):
#     def __str__(self):
# 
# Path: classifip/representations/intervalsProbability.py
# class IntervalsProbability(CredalSet):
#     def __init__(self,lproba):
#     def isproper(self):
#     def getlowerprobability(self,subset):
#     def getupperprobability(self,subset):
#     def getlowerexpectation(self,function):
#     def isreachable(self):
#     def setreachableprobability(self):
#     def __str__(self):
#     def __and__(self,other):
#     def __or__(self,other):
#     def __add__(self,other):


import random
import pickle
import numpy as np
from classifip.representations import credalset,intervalsProbability
from scipy.stats import rv_discrete
                expInf = NDtree.node.proba.getlowerexpectation(function=np.array(
                            [cost[class_values.index(NDtree.left.node.label[0])],
                             lowerExp(NDtree.right)])) 
            elif NDtree.right.node.count() == 1:
                expInf = NDtree.node.proba.getlowerexpectation(function=np.array(
                            [lowerExp(NDtree.left), 
                             cost[class_values.index(NDtree.left.node.label[0])]])) 
                          
            else:
                expInf = NDtree.node.proba.getlowerexpectation(function=np.array(
                            [lowerExp(NDtree.left), 
                             lowerExp(NDtree.right)])) 
            return expInf
            
        return lowerExp(self)
    
    def getlowerprobability(self, subset):
        """Compute lower probability of an event expressed in binary code. 
        
        :param subset: the event of interest (a 1xn vector containing 1 for elements
            in the event, 0 otherwise.)
        :param type: :class:`~numpy.array`
        :returns: lower probability value
        :rtype: float
        
        """
        if subset.__class__.__name__ != 'ndarray':
            raise Exception('Expecting a numpy array as argument')
        if subset.size != self.nbDecision:
            raise Exception('Subset incompatible with the frame size')

# Path: classifip/representations/credalset.py
# class CredalSet(object):
#     def __init__(self,spacesize):
#     def addconstraints(self,constmat):
#     def delconstraints(self,constdel):
#     def isproper(self):
#     def issubsetmask(array):
#     def getlowerprobability(self,subset):
#     def getupperprobability(self,subset):
#     def isreachable(self):
#     def setreachableprobability(self):
#     def getmaximindecision(self,utilities=None):
#     def getmaximaxdecision(self, utilities=None):
#     def gethurwiczdecision(self,alpha,utilities=None):
#     def getmaximaldecision(self, utilities=None):
#     def getintervaldomdecision(self, utilities=None):
#     def solvelowerexpectation(self,obj):
#     def getlowerexpectation(self,obj):
#     def getupperexpectation(self,obj):
#     def __str__(self):
# 
# Path: classifip/representations/intervalsProbability.py
# class IntervalsProbability(CredalSet):
#     def __init__(self,lproba):
#     def isproper(self):
#     def getlowerprobability(self,subset):
#     def getupperprobability(self,subset):
#     def getlowerexpectation(self,function):
#     def isreachable(self):
#     def setreachableprobability(self):
#     def __str__(self):
#     def __and__(self,other):
#     def __or__(self,other):
#     def __add__(self,other):


# Path: classifip/representations/binaryTree.py
import random
import pickle
import numpy as np
from classifip.representations import credalset,intervalsProbability
from scipy.stats import rv_discrete

                expInf = NDtree.node.proba.getlowerexpectation(function=np.array(
                            [cost[class_values.index(NDtree.left.node.label[0])],
                             lowerExp(NDtree.right)])) 
            elif NDtree.right.node.count() == 1:
                expInf = NDtree.node.proba.getlowerexpectation(function=np.array(
                            [lowerExp(NDtree.left), 
                             cost[class_values.index(NDtree.left.node.label[0])]])) 
                          
            else:
                expInf = NDtree.node.proba.getlowerexpectation(function=np.array(
                            [lowerExp(NDtree.left), 
                             lowerExp(NDtree.right)])) 
            return expInf
            
        return lowerExp(self)
    
    def getlowerprobability(self, subset):
        """Compute lower probability of an event expressed in binary code. 
        
        :param subset: the event of interest (a 1xn vector containing 1 for elements
            in the event, 0 otherwise.)
        :param type: :class:`~numpy.array`
        :returns: lower probability value
        :rtype: float
        
        """
        if subset.__class__.__name__ != 'ndarray':
            raise Exception('Expecting a numpy array as argument')
        if subset.size != self.nbDecision:
            raise Exception('Subset incompatible with the frame size')

        if not credalset.CredalSet.issubsetmask(subset):