def fit(self, method=None, **kwargs):
        """ Fits a model

        Parameters
        ----------
        method : str
            A fitting method (e.g 'MLE'). Defaults to model specific default method.

        Returns
        ----------
        None (stores fit information)
        """

        cov_matrix = kwargs.get('cov_matrix', None)
        iterations = kwargs.get('iterations', 1000)
        nsims = kwargs.get('nsims', 10000)
        optimizer = kwargs.get('optimizer', 'RMSProp')
        batch_size = kwargs.get('batch_size', 12)
        mini_batch = kwargs.get('mini_batch', None)
        map_start = kwargs.get('map_start', True)
        learning_rate = kwargs.get('learning_rate', 0.001)
        record_elbo = kwargs.get('record_elbo', None)
        quiet_progress = kwargs.get('quiet_progress', False)

        if method is None:
            method = self.default_method
        elif method not in self.supported_methods:
            raise ValueError("Method not supported!")

        if method == 'MLE':
            return self._optimize_fit(self.neg_loglik, **kwargs)
        elif method == 'PML':
            return self._optimize_fit(self.neg_logposterior, **kwargs)   
        elif method == 'M-H':
            return self._mcmc_fit(nsims=nsims, method=method, cov_matrix=cov_matrix,
                map_start=map_start, quiet_progress=quiet_progress)
        elif method == "Laplace":
            return self._laplace_fit(self.neg_logposterior) 
        elif method == "BBVI":
            if mini_batch is None:
                posterior = self.neg_logposterior
            else:
                posterior = self.mb_neg_logposterior
            return self._bbvi_fit(posterior, optimizer=optimizer, iterations=iterations,
                batch_size=batch_size, mini_batch=mini_batch, map_start=map_start, 
                learning_rate=learning_rate, record_elbo=record_elbo, quiet_progress=quiet_progress)
        elif method == "OLS":
            return self._ols_fit()
def fit ( self , method = None , ** kwargs ) : cov_matrix = kwargs . get ( 'cov_matrix' , None ) iterations = kwargs . get ( 'iterations' , 1000 ) nsims = kwargs . get ( 'nsims' , 10000 ) optimizer = kwargs . get ( 'optimizer' , 'RMSProp' ) batch_size = kwargs . get ( 'batch_size' , 12 ) mini_batch = kwargs . get ( 'mini_batch' , None ) map_start = kwargs . get ( 'map_start' , True ) learning_rate = kwargs . get ( 'learning_rate' , 0.001 ) record_elbo = kwargs . get ( 'record_elbo' , None ) quiet_progress = kwargs . get ( 'quiet_progress' , False ) if method is None : method = self . default_method elif method not in self . supported_methods : raise ValueError ( "Method not supported!" ) if method == 'MLE' : return self . _optimize_fit ( self . neg_loglik , ** kwargs ) elif method == 'PML' : return self . _optimize_fit ( self . neg_logposterior , ** kwargs ) elif method == 'M-H' : return self . _mcmc_fit ( nsims = nsims , method = method , cov_matrix = cov_matrix , map_start = map_start , quiet_progress = quiet_progress ) elif method == "Laplace" : return self . _laplace_fit ( self . neg_logposterior ) elif method == "BBVI" : if mini_batch is None : posterior = self . neg_logposterior else : posterior = self . mb_neg_logposterior return self . _bbvi_fit ( posterior , optimizer = optimizer , iterations = iterations , batch_size = batch_size , mini_batch = mini_batch , map_start = map_start , learning_rate = learning_rate , record_elbo = record_elbo , quiet_progress = quiet_progress ) elif method == "OLS" : return self . _ols_fit ( )
Fits a model

        Parameters
        ----------
        method : str
            A fitting method (e.g 'MLE'). Defaults to model specific default method.

        Returns
        ----------
        None (stores fit information)