Minor fix.
This commit is contained in:
@@ -126,7 +126,7 @@ class TableExchange {
|
||||
// Put the found subtable to the end.
|
||||
SubTableType subtable_copy = *it;
|
||||
(*it) = received_subtables_[process_id].front();
|
||||
received_subtables_[process_id].pop_front();
|
||||
received_subtables_[process_id].pop_front();
|
||||
received_subtables_[process_id].push_back(subtable_copy);
|
||||
return &(received_subtables_[process_id].back());
|
||||
}
|
||||
|
||||
+4
-2
@@ -287,8 +287,10 @@ void MixedLogitDCM<TableType>::Compute(
|
||||
parameters.zeros(table_.num_parameters());
|
||||
sampling.Init(
|
||||
parameters, &table_, num_data_samples, num_integration_samples);
|
||||
sampling.SimulatedLoglikelihoodGradient(&gradient);
|
||||
sampling.SimulatedLoglikelihoodHessian(&hessian);
|
||||
double negative_simulated_loglikelihood =
|
||||
sampling.NegativeSimulatedLogLikelihood();
|
||||
sampling.NegativeSimulatedLogLikelihoodGradient(&gradient);
|
||||
sampling.NegativeSimulatedLogLikelihoodHessian(&hessian);
|
||||
|
||||
// Enter the trust region loop.
|
||||
do {
|
||||
|
||||
+26
-2
@@ -159,6 +159,30 @@ class MixedLogitDCMSampling {
|
||||
|
||||
public:
|
||||
|
||||
/** @brief Returns the negative simulated loglikelihood.
|
||||
*/
|
||||
double NegativeSimulatedLogLikelihood() const {
|
||||
return - this->SimulatedLogLikelihood();
|
||||
}
|
||||
|
||||
/** @brief Returns the gradient of the negative simulated
|
||||
* log-likelihood objective.
|
||||
*/
|
||||
void NegativeSimulatedLogLikelihoodGradient(
|
||||
arma::vec *negative_likelihood_gradient) const {
|
||||
this->SimulatedLogLikelihoodGradient(negative_likelihood_gradient);
|
||||
(*negative_likelihood_gradient) = - (*negative_likelihood_gradient);
|
||||
}
|
||||
|
||||
/** @brief Returns the hessian of the negative simulated
|
||||
* log-likelihood objective.
|
||||
*/
|
||||
void NegativeSimulatedLogLikelihoodHessian(
|
||||
arma::mat *negative_likelihood_hessian) const {
|
||||
this->SimulatedLogLikelihoodHessian(negative_likelihood_hessian);
|
||||
(*negative_likelihood_hessian) = - (*negative_likelihood_hessian);
|
||||
}
|
||||
|
||||
/** @brief Returns the parameters associated with the sampling.
|
||||
*/
|
||||
const arma::vec ¶meters() const {
|
||||
@@ -199,7 +223,7 @@ class MixedLogitDCMSampling {
|
||||
* likelihood score objective. This completes the
|
||||
* computation of Equation 8.14 in the paper.
|
||||
*/
|
||||
void SimulatedLoglikelihoodHessian(
|
||||
void SimulatedLogLikelihoodHessian(
|
||||
arma::mat *likelihood_hessian) const {
|
||||
|
||||
likelihood_hessian->set_size(
|
||||
@@ -249,7 +273,7 @@ class MixedLogitDCMSampling {
|
||||
* likelihood score objective. This computes Equation 8.7
|
||||
* in the paper.
|
||||
*/
|
||||
void SimulatedLoglikelihoodGradient(
|
||||
void SimulatedLogLikelihoodGradient(
|
||||
arma::vec *likelihood_gradient) const {
|
||||
|
||||
likelihood_gradient->set_size(dcm_table_->num_parameters());
|
||||
|
||||
Reference in New Issue
Block a user