(cls, domain, X, Y=None, metas=None, W=None,
                   attributes=None, ids=None)
return self
Construct a table from numpy arrays with the given domain. The number
        of variables in the domain must match the number of columns in the
        corresponding arrays. All arrays must have the same number of rows.
        Arrays may be of different numpy types, and may be dense or sparse.

        :param domain: the domain for the new table
        :type domain: Orange.data.Domain
        :param X: array with attribute values
        :type X: np.array
        :param Y: array with class values
        :type Y: np.array
        :param metas: array with meta attributes
        :type metas: np.array
        :param W: array with weights
        :type W: np.array
        :return:
Construct a table from numpy arrays with the given domain. The number
        of variables in the domain must match the number of columns in the
        corresponding arrays. All arrays must have the same number of rows.
        Arrays may be of different numpy types, and may be dense or sparse.
Construct a table from numpy arrays with the given domain . The number of variables in the domain must match the number of columns in the corresponding arrays . All arrays must have the same number of rows . Arrays may be of different numpy types and may be dense or sparse .
def from_numpy(cls, domain, X, Y=None, metas=None, W=None,
                   attributes=None, ids=None):
        """
        Construct a table from numpy arrays with the given domain. The number
        of variables in the domain must match the number of columns in the
        corresponding arrays. All arrays must have the same number of rows.
        Arrays may be of different numpy types, and may be dense or sparse.

        :param domain: the domain for the new table
        :type domain: Orange.data.Domain
        :param X: array with attribute values
        :type X: np.array
        :param Y: array with class values
        :type Y: np.array
        :param metas: array with meta attributes
        :type metas: np.array
        :param W: array with weights
        :type W: np.array
        :return:
        """
        X, Y, W = _check_arrays(X, Y, W, dtype='float64')
        metas, = _check_arrays(metas, dtype=object, shape_1=X.shape[0])
        ids, = _check_arrays(ids, dtype=int, shape_1=X.shape[0])

        if domain is None:
            domain = Domain.from_numpy(X, Y, metas)

        if Y is None:
            if not domain.class_vars or sp.issparse(X):
                Y = np.empty((X.shape[0], 0), dtype=np.float64)
            else:
                own_data = X.flags.owndata and X.base is None
                Y = X[:, len(domain.attributes):]
                X = X[:, :len(domain.attributes)]
                if own_data:
                    Y = Y.copy()
                    X = X.copy()
        if metas is None:
            metas = np.empty((X.shape[0], 0), object)
        if W is None or W.size == 0:
            W = np.empty((X.shape[0], 0))
        elif W.shape != (W.size, ):
            W = W.reshape(W.size).copy()

        if X.shape[1] != len(domain.attributes):
            raise ValueError(
                "Invalid number of variable columns ({} != {})".format(
                    X.shape[1], len(domain.attributes))
            )
        if Y.ndim == 1:
            if not domain.class_var:
                raise ValueError(
                    "Invalid number of class columns "
                    f"(1 != {len(domain.class_vars)})")
        elif Y.shape[1] != len(domain.class_vars):
            raise ValueError(
                "Invalid number of class columns ({} != {})".format(
                    Y.shape[1], len(domain.class_vars))
            )
        if metas.shape[1] != len(domain.metas):
            raise ValueError(
                "Invalid number of meta attribute columns ({} != {})".format(
                    metas.shape[1], len(domain.metas))
            )
        if not X.shape[0] == Y.shape[0] == metas.shape[0] == W.shape[0]:
            raise ValueError(
                "Parts of data contain different numbers of rows.")

        self = cls()
        with self.unlocked_reference():
            self.domain = domain
            self.X = X
            self.Y = Y
            self.metas = metas
            self.W = W
            self.n_rows = self.X.shape[0]
            if ids is None:
                cls._init_ids(self)
            else:
                self.ids = ids
            self.attributes = {} if attributes is None else attributes
        return self
def from_numpy ( cls , domain , X , Y = None , metas = None , W = None , attributes = None , ids = None ) : X , Y , W = _check_arrays ( X , Y , W , dtype = 'float64' ) metas , = _check_arrays ( metas , dtype = object , shape_1 = X . shape [ 0 ] ) ids , = _check_arrays ( ids , dtype = int , shape_1 = X . shape [ 0 ] ) if domain is None : domain = Domain . from_numpy ( X , Y , metas ) if Y is None : if not domain . class_vars or sp . issparse ( X ) : Y = np . empty ( ( X . shape [ 0 ] , 0 ) , dtype = np . float64 ) else : own_data = X . flags . owndata and X . base is None Y = X [ : , len ( domain . attributes ) : ] X = X [ : , : len ( domain . attributes ) ] if own_data : Y = Y . copy ( ) X = X . copy ( ) if metas is None : metas = np . empty ( ( X . shape [ 0 ] , 0 ) , object ) if W is None or W . size == 0 : W = np . empty ( ( X . shape [ 0 ] , 0 ) ) elif W . shape != ( W . size , ) : W = W . reshape ( W . size ) . copy ( ) if X . shape [ 1 ] != len ( domain . attributes ) : raise ValueError ( "Invalid number of variable columns ({} != {})" . format ( X . shape [ 1 ] , len ( domain . attributes ) ) ) if Y . ndim == 1 : if not domain . class_var : raise ValueError ( "Invalid number of class columns " f"(1 != {len(domain.class_vars)})" ) elif Y . shape [ 1 ] != len ( domain . class_vars ) : raise ValueError ( "Invalid number of class columns ({} != {})" . format ( Y . shape [ 1 ] , len ( domain . class_vars ) ) ) if metas . shape [ 1 ] != len ( domain . metas ) : raise ValueError ( "Invalid number of meta attribute columns ({} != {})" . format ( metas . shape [ 1 ] , len ( domain . metas ) ) ) if not X . shape [ 0 ] == Y . shape [ 0 ] == metas . shape [ 0 ] == W . shape [ 0 ] : raise ValueError ( "Parts of data contain different numbers of rows." ) self = cls ( ) with self . unlocked_reference ( ) : self . domain = domain self . X = X self . Y = Y self . metas = metas self . W = W self . n_rows = self . X . shape [ 0 ] if ids is None : cls . _init_ids ( self ) else : self . ids = ids self . attributes = { } if attributes is None else attributes return self