def export(self, class_name, method_name, export_data=False,
               export_dir='.', export_filename='data.json',
               export_append_checksum=False, **kwargs):
        """
        Port a trained estimator to the syntax of a chosen programming language.

        Parameters
        ----------
        :param class_name : string
            The name of the class in the returned result.
        :param method_name : string
            The name of the method in the returned result.
        :param export_data : bool, default: False
            Whether the model data should be saved or not.
        :param export_dir : string, default: '.' (current directory)
            The directory where the model data should be saved.
        :param export_filename : string, default: 'data.json'
            The filename of the exported model data.
        :param export_append_checksum : bool, default: False
            Whether to append the checksum to the filename or not.

        Returns
        -------
        :return : string
            The transpiled algorithm with the defined placeholders.
        """
        # Arguments:
        self.class_name = class_name
        self.method_name = method_name

        # Estimator:
        est = self.estimator

        self.n_features = len(est.sigma_[0])
        self.n_classes = len(est.classes_)

        temp_type = self.temp('type')
        temp_arr = self.temp('arr')
        temp_arr_ = self.temp('arr[]')
        temp_arr__ = self.temp('arr[][]')

        # Create class prior probabilities:
        priors = [temp_type.format(self.repr(c)) for c in est.class_prior_]
        priors = ', '.join(priors)
        self.priors = temp_arr_.format(type='double', name='priors',
                                       values=priors)

        # Create sigmas:
        sigmas = []
        for sigma in est.sigma_:
            tmp = [temp_type.format(self.repr(s)) for s in sigma]
            tmp = temp_arr.format(', '.join(tmp))
            sigmas.append(tmp)
        sigmas = ', '.join(sigmas)
        self.sigmas = temp_arr__.format(type='double', name='sigmas',
                                        values=sigmas)

        # Create thetas:
        thetas = []
        for theta in est.theta_:
            tmp = [temp_type.format(self.repr(t)) for t in theta]
            tmp = temp_arr.format(', '.join(tmp))
            thetas.append(tmp)
        thetas = ', '.join(thetas)
        self.thetas = temp_arr__.format(type='double', name='thetas',
                                        values=thetas)

        if self.target_method == 'predict':
            # Exported:
            if export_data and os.path.isdir(export_dir):
                self.export_data(export_dir, export_filename,
                                 export_append_checksum)
                return self.predict('exported')
            # Separated:
            return self.predict('separated')
def export ( self , class_name , method_name , export_data = False , export_dir = '.' , export_filename = 'data.json' , export_append_checksum = False , ** kwargs ) : self . class_name = class_name self . method_name = method_name est = self . estimator self . n_features = len ( est . sigma_ [ 0 ] ) self . n_classes = len ( est . classes_ ) temp_type = self . temp ( 'type' ) temp_arr = self . temp ( 'arr' ) temp_arr_ = self . temp ( 'arr[]' ) temp_arr__ = self . temp ( 'arr[][]' ) priors = [ temp_type . format ( self . repr ( c ) ) for c in est . class_prior_ ] priors = ', ' . join ( priors ) self . priors = temp_arr_ . format ( type = 'double' , name = 'priors' , values = priors ) sigmas = [ ] for sigma in est . sigma_ : tmp = [ temp_type . format ( self . repr ( s ) ) for s in sigma ] tmp = temp_arr . format ( ', ' . join ( tmp ) ) sigmas . append ( tmp ) sigmas = ', ' . join ( sigmas ) self . sigmas = temp_arr__ . format ( type = 'double' , name = 'sigmas' , values = sigmas ) thetas = [ ] for theta in est . theta_ : tmp = [ temp_type . format ( self . repr ( t ) ) for t in theta ] tmp = temp_arr . format ( ', ' . join ( tmp ) ) thetas . append ( tmp ) thetas = ', ' . join ( thetas ) self . thetas = temp_arr__ . format ( type = 'double' , name = 'thetas' , values = thetas ) if self . target_method == 'predict' : if export_data and os . path . isdir ( export_dir ) : self . export_data ( export_dir , export_filename , export_append_checksum ) return self . predict ( 'exported' ) return self . predict ( 'separated' )
Port a trained estimator to the syntax of a chosen programming language.

        Parameters
        ----------
        :param class_name : string
            The name of the class in the returned result.
        :param method_name : string
            The name of the method in the returned result.
        :param export_data : bool, default: False
            Whether the model data should be saved or not.
        :param export_dir : string, default: '.' (current directory)
            The directory where the model data should be saved.
        :param export_filename : string, default: 'data.json'
            The filename of the exported model data.
        :param export_append_checksum : bool, default: False
            Whether to append the checksum to the filename or not.

        Returns
        -------
        :return : string
            The transpiled algorithm with the defined placeholders.