(
            self, data: Table, progress_callback: Callable = dummy_callback
    )
return data
Transforms data to the model domain if possible.

        Parameters
        ----------
        data
            Data to be transformed to the model domain
        progress_callback
            Callback - callable - to report the progress

        Returns
        -------
        Transformed data table

        Raises
        ------
        DomainTransformationError
            Error indicates that transformation is not possible since domains
            are not compatible
Transforms data to the model domain if possible.
Transforms data to the model domain if possible .
def data_to_model_domain(
            self, data: Table, progress_callback: Callable = dummy_callback
    ) -> Table:
        """
        Transforms data to the model domain if possible.

        Parameters
        ----------
        data
            Data to be transformed to the model domain
        progress_callback
            Callback - callable - to report the progress

        Returns
        -------
        Transformed data table

        Raises
        ------
        DomainTransformationError
            Error indicates that transformation is not possible since domains
            are not compatible
        """
        if data.domain == self.domain:
            return data

        progress_callback(0)
        if self.original_domain.attributes != data.domain.attributes \
                and data.X.size \
                and not all_nan(data.X):
            progress_callback(0.5)
            new_data = data.transform(self.original_domain)
            if all_nan(new_data.X):
                raise DomainTransformationError(
                    "domain transformation produced no defined values")
            progress_callback(0.75)
            data = new_data.transform(self.domain)
            progress_callback(1)
            return data

        progress_callback(0.5)
        data = data.transform(self.domain)
        progress_callback(1)
        return data
def data_to_model_domain ( self , data : Table , progress_callback : Callable = dummy_callback ) -> Table : if data . domain == self . domain : return data progress_callback ( 0 ) if self . original_domain . attributes != data . domain . attributes and data . X . size and not all_nan ( data . X ) : progress_callback ( 0.5 ) new_data = data . transform ( self . original_domain ) if all_nan ( new_data . X ) : raise DomainTransformationError ( "domain transformation produced no defined values" ) progress_callback ( 0.75 ) data = new_data . transform ( self . domain ) progress_callback ( 1 ) return data progress_callback ( 0.5 ) data = data . transform ( self . domain ) progress_callback ( 1 ) return data