Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement a few fixes #490

Merged
merged 7 commits into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ infer_latex_dependencies = true
filterwarnings = [
"ignore:Using or importing the ABCs from 'collections'",
"ignore:the imp module is deprecated",
"ignore:indexing past lexsort depth may impact performance.",
"ignore:Method .ptp is deprecated and will be removed in a future version. Use numpy.ptp instead.",
"ignore:In a future version of pandas all arguments of concat except for the argument 'objs' will be keyword-only",
"ignore:Please use `MemoizeJac` from the `scipy.optimize` namespace",
Expand Down
7 changes: 7 additions & 0 deletions src/estimagic/estimation/estimate_msm.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
transform_free_cov_to_cov,
transform_free_values_to_params_tree,
)
from estimagic.optimization.optimize_result import OptimizeResult
from estimagic.optimization.optimize import minimize
from estimagic.parameters.block_trees import block_tree_to_matrix, matrix_to_block_tree
from estimagic.parameters.conversion import Converter, get_converter
Expand Down Expand Up @@ -328,6 +329,7 @@ def func(x):
_params=estimates,
_weights=weights,
_converter=converter,
_optimize_result=opt_res,
_internal_weights=internal_weights,
_internal_moments_cov=internal_moments_cov,
_internal_jacobian=int_jac,
Expand Down Expand Up @@ -463,6 +465,7 @@ class MomentsResult:
_internal_jacobian: np.ndarray
_empirical_moments: Any
_has_constraints: bool
_optimize_result: Union[OptimizeResult, None] = None
_jacobian: Any = None
_no_jacobian_reason: Union[str, None] = None
_cache: Dict = field(default_factory=dict)
Expand Down Expand Up @@ -504,6 +507,10 @@ def _get_free_cov(self, method, n_samples, bounds_handling, seed):
def params(self):
return self._params

@property
def optimize_result(self):
return self._optimize_result

@property
def weights(self):
return self._weights
Expand Down
2 changes: 1 addition & 1 deletion src/estimagic/visualization/estimation_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
suppress_performance_warnings.filter(category=pd.errors.PerformanceWarning)


@suppress_performance_warnings
def estimation_table(
models,
*,
Expand Down Expand Up @@ -229,6 +228,7 @@ def estimation_table(
return_type.write_text(out)


@suppress_performance_warnings
def render_latex(
body,
footer,
Expand Down
4 changes: 4 additions & 0 deletions tests/estimation/test_estimate_msm.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import numpy as np
import pandas as pd
import pytest
from estimagic.optimization.optimize_result import OptimizeResult
from estimagic.estimation.estimate_msm import estimate_msm
from estimagic.shared.check_option_dicts import (
check_numdiff_options,
Expand Down Expand Up @@ -64,6 +65,9 @@ def test_estimate_msm(simulate_moments, moments_cov, optimize_options):
# check that minimization works
aaae(calculated.params, expected_params)

# assert that optimization result exists and is of correct type
assert isinstance(calculated.optimize_result, OptimizeResult)

# check that cov works
calculated_cov = calculated.cov()
if isinstance(calculated_cov, pd.DataFrame):
Expand Down
Loading