"""Implementation of some multi-objective functions.:author: Michel Bierlaire:date: Fri Jul 14 18:35:29 2023A multi-objective function takes the estimation results, and returnsseveral indicators. The indicators should be such that the lower, thebetter. If an indicator must be maximized, the opposite value should bereturned."""importnumpyasnpfrombiogeme.deprecatedimportdeprecatedfrombiogeme.results_processingimportEstimationResults
[docs]defloglikelihood_dimension(results:EstimationResults)->list[float]:"""Function returning the negative log likelihood and the number of parameters, designed for multi-objective optimization :param results: estimation results :type results: biogeme.results.bioResults """ifresults.raw_estimation_resultsisNone:return[float(np.finfo(np.float32).max),float(np.finfo(np.float32).max)]return[-results.final_log_likelihood,results.number_of_parameters]
[docs]defaic_bic_dimension(results:EstimationResults)->list[float]:"""Function returning the AIC, BIC and the number of parameters, designed for multi-objective optimization :param results: estimation results :type results: biogeme.results.bioResults """ifresults.raw_estimation_resultsisNone:return[float(np.finfo(np.float32).max),float(np.finfo(np.float32).max),float(np.finfo(np.float32).max),]return[results.akaike_information_criterion,results.bayesian_information_criterion,results.number_of_parameters,]