(self, domain, data=None, id=None)
Construct a new data instance.

        :param domain: domain that describes the instance's variables
        :type domain: Orange.data.Domain
        :param data: instance's values
        :type data: Orange.data.Instance or a sequence of values
        :param id: instance id
        :type id: hashable value
Construct a new data instance.
Construct a new data instance .
def __init__(self, domain, data=None, id=None):
        """
        Construct a new data instance.

        :param domain: domain that describes the instance's variables
        :type domain: Orange.data.Domain
        :param data: instance's values
        :type data: Orange.data.Instance or a sequence of values
        :param id: instance id
        :type id: hashable value
        """
        if data is None and isinstance(domain, Instance):
            data = domain
            domain = data.domain

        self._domain = domain
        if data is None:
            self._x = np.repeat(Unknown, len(domain.attributes))
            self._y = np.repeat(Unknown, len(domain.class_vars))
            self._metas = np.array([var.Unknown for var in domain.metas],
                                   dtype=object)
            self._weight = 1
        elif isinstance(data, Instance) and data.domain == domain:
            self._x = np.array(data._x)
            self._y = np.atleast_1d(np.array(data._y))
            self._metas = np.array(data._metas)
            self._weight = data._weight
        else:
            self._x, self._y, self._metas = domain.convert(data)
            self._y = np.atleast_1d(self._y)
            self._weight = 1

        if id is not None:
            self.id = id
        else:
            from Orange.data import Table
            self.id = Table.new_id()
def __init__ ( self , domain , data = None , id = None ) : if data is None and isinstance ( domain , Instance ) : data = domain domain = data . domain self . _domain = domain if data is None : self . _x = np . repeat ( Unknown , len ( domain . attributes ) ) self . _y = np . repeat ( Unknown , len ( domain . class_vars ) ) self . _metas = np . array ( [ var . Unknown for var in domain . metas ] , dtype = object ) self . _weight = 1 elif isinstance ( data , Instance ) and data . domain == domain : self . _x = np . array ( data . _x ) self . _y = np . atleast_1d ( np . array ( data . _y ) ) self . _metas = np . array ( data . _metas ) self . _weight = data . _weight else : self . _x , self . _y , self . _metas = domain . convert ( data ) self . _y = np . atleast_1d ( self . _y ) self . _weight = 1 if id is not None : self . id = id else : from Orange . data import Table self . id = Table . new_id ( )