Skip to content

Commit

Permalink
Restructure estimagic.
Browse files Browse the repository at this point in the history
  • Loading branch information
janosg committed Jul 11, 2024
1 parent 192f072 commit 8774da9
Show file tree
Hide file tree
Showing 34 changed files with 40 additions and 46 deletions.
10 changes: 5 additions & 5 deletions src/estimagic/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from estimagic.estimation.estimate_ml import LikelihoodResult, estimate_ml
from estimagic.estimation.estimate_msm import MomentsResult, estimate_msm
from estimagic.estimation.msm_weighting import get_moments_cov
from estimagic.inference.bootstrap import BootstrapResult, bootstrap
from estimagic.visualization.estimation_table import (
from estimagic.estimate_ml import LikelihoodResult, estimate_ml
from estimagic.estimate_msm import MomentsResult, estimate_msm
from estimagic.msm_weighting import get_moments_cov
from estimagic.bootstrap import BootstrapResult, bootstrap
from estimagic.estimation_table import (
estimation_table,
render_html,
render_latex,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
from pybaum import leaf_names, tree_flatten, tree_just_flatten, tree_unflatten

from optimagic.batch_evaluators import joblib_batch_evaluator
from estimagic.inference.bootstrap_ci import calculate_ci
from estimagic.inference.bootstrap_helpers import check_inputs
from estimagic.inference.bootstrap_outcomes import get_bootstrap_outcomes
from estimagic.inference.shared import calculate_estimation_summary
from estimagic.bootstrap_ci import calculate_ci
from estimagic.bootstrap_helpers import check_inputs
from estimagic.bootstrap_outcomes import get_bootstrap_outcomes
from estimagic.shared_covs import calculate_estimation_summary
from optimagic.parameters.block_trees import matrix_to_block_tree
from optimagic.parameters.tree_registry import get_registry
from optimagic.utilities import get_rng
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import numpy as np
from scipy.stats import norm

from estimagic.inference.bootstrap_helpers import check_inputs
from estimagic.bootstrap_helpers import check_inputs


def calculate_ci(
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from optimagic.batch_evaluators import process_batch_evaluator
from estimagic.inference.bootstrap_helpers import check_inputs
from estimagic.inference.bootstrap_samples import get_bootstrap_indices
from estimagic.bootstrap_helpers import check_inputs
from estimagic.bootstrap_samples import get_bootstrap_indices


def get_bootstrap_outcomes(
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@

from optimagic.differentiation.derivatives import first_derivative, second_derivative
from optimagic.exceptions import InvalidFunctionError, NotAvailableError
from estimagic.inference.ml_covs import (
from estimagic.ml_covs import (
cov_cluster_robust,
cov_hessian,
cov_jacobian,
cov_robust,
cov_strata_robust,
)
from estimagic.inference.shared import (
from estimagic.shared_covs import (
FreeParams,
calculate_ci,
calculate_estimation_summary,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
from pybaum import leaf_names, tree_just_flatten

from optimagic.differentiation.derivatives import first_derivative
from estimagic.estimation.msm_weighting import get_weighting_matrix
from estimagic.msm_weighting import get_weighting_matrix
from optimagic.exceptions import InvalidFunctionError
from estimagic.inference.msm_covs import cov_optimal, cov_robust
from estimagic.inference.shared import (
from estimagic.msm_covs import cov_optimal, cov_robust
from estimagic.shared_covs import (
FreeParams,
calculate_ci,
calculate_estimation_summary,
Expand All @@ -33,7 +33,7 @@
from optimagic.parameters.conversion import Converter, get_converter
from optimagic.parameters.space_conversion import InternalParams
from optimagic.parameters.tree_registry import get_registry
from estimagic.sensitivity.msm_sensitivity import (
from estimagic.msm_sensitivity import (
calculate_actual_sensitivity_to_noise,
calculate_actual_sensitivity_to_removal,
calculate_fundamental_sensitivity_to_noise,
Expand Down
Empty file.
File renamed without changes.
File renamed without changes.
6 changes: 0 additions & 6 deletions src/estimagic/inference/__init__.py

This file was deleted.

File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import pandas as pd

from optimagic.exceptions import INVALID_INFERENCE_MSG
from estimagic.inference.shared import process_pandas_arguments
from estimagic.shared_covs import process_pandas_arguments
from optimagic.utilities import robust_inverse


Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pandas as pd

from optimagic.exceptions import INVALID_INFERENCE_MSG
from estimagic.inference.shared import process_pandas_arguments
from estimagic.shared_covs import process_pandas_arguments
from optimagic.utilities import robust_inverse


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
import numpy as np
import pandas as pd
from optimagic.exceptions import INVALID_SENSITIVITY_MSG
from estimagic.inference.msm_covs import cov_robust
from estimagic.inference.shared import process_pandas_arguments
from estimagic.msm_covs import cov_robust
from estimagic.shared_covs import process_pandas_arguments
from optimagic.utilities import robust_inverse


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from pybaum import tree_just_flatten
from scipy.linalg import block_diag

from estimagic.inference.bootstrap import bootstrap
from estimagic.bootstrap import bootstrap
from optimagic.parameters.block_trees import block_tree_to_matrix, matrix_to_block_tree
from optimagic.parameters.tree_registry import get_registry
from optimagic.utilities import robust_inverse
Expand Down
Empty file.
File renamed without changes.
Empty file.
2 changes: 1 addition & 1 deletion tests/estimagic/estimation/test_estimate_ml.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import pytest
import scipy as sp
import statsmodels.api as sm
from estimagic.estimation.estimate_ml import estimate_ml
from estimagic.estimate_ml import estimate_ml
from estimagic.examples.logit import logit_derivative, logit_hessian, logit_loglike
from estimagic.examples.logit import logit_loglike_and_derivative as llad
from numpy.testing import assert_array_equal
Expand Down
2 changes: 1 addition & 1 deletion tests/estimagic/estimation/test_estimate_msm.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import pandas as pd
import pytest
from optimagic.optimization.optimize_result import OptimizeResult
from estimagic.estimation.estimate_msm import estimate_msm
from estimagic.estimate_msm import estimate_msm
from optimagic.shared.check_option_dicts import (
check_numdiff_options,
check_optimization_options,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import numpy as np
import pandas as pd
from estimagic.estimation.estimate_msm import estimate_msm
from estimagic.estimate_msm import estimate_msm
from optimagic.parameters.tree_registry import get_registry
from numpy.testing import assert_array_almost_equal as aaae
from pybaum import tree_just_flatten
Expand Down
2 changes: 1 addition & 1 deletion tests/estimagic/estimation/test_msm_weighting.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import numpy as np
import pandas as pd
import pytest
from estimagic.estimation.msm_weighting import (
from estimagic.msm_weighting import (
_assemble_block_diagonal_matrix,
get_moments_cov,
get_weighting_matrix,
Expand Down
4 changes: 2 additions & 2 deletions tests/estimagic/inference/test_bootstrap_ci.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import numpy as np
import pandas as pd
import pytest
from estimagic.inference.bootstrap_ci import calculate_ci
from estimagic.inference.bootstrap_ci import check_inputs
from estimagic.bootstrap_ci import calculate_ci
from estimagic.bootstrap_ci import check_inputs
from optimagic.parameters.tree_registry import get_registry
from pybaum import tree_just_flatten

Expand Down
2 changes: 1 addition & 1 deletion tests/estimagic/inference/test_bootstrap_outcomes.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import pandas as pd
import pytest
from optimagic.batch_evaluators import joblib_batch_evaluator
from estimagic.inference.bootstrap_outcomes import (
from estimagic.bootstrap_outcomes import (
_get_bootstrap_outcomes_from_indices,
get_bootstrap_outcomes,
)
Expand Down
2 changes: 1 addition & 1 deletion tests/estimagic/inference/test_bootstrap_samples.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import numpy as np
import pandas as pd
import pytest
from estimagic.inference.bootstrap_samples import (
from estimagic.bootstrap_samples import (
_convert_cluster_ids_to_indices,
_get_bootstrap_samples_from_indices,
get_bootstrap_indices,
Expand Down
4 changes: 2 additions & 2 deletions tests/estimagic/inference/test_ml_covs.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import numpy as np
import pandas as pd
import pytest
from estimagic.inference import ml_covs
from estimagic.inference.ml_covs import (
from estimagic import ml_covs
from estimagic.ml_covs import (
_clustering,
_sandwich_step,
_stratification,
Expand Down
2 changes: 1 addition & 1 deletion tests/estimagic/inference/test_msm_covs.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import numpy as np
import pandas as pd
import pytest
from estimagic.inference.msm_covs import cov_optimal, cov_robust
from estimagic.msm_covs import cov_optimal, cov_robust
from optimagic.utilities import get_rng
from numpy.testing import assert_array_almost_equal as aaae
from pandas.testing import assert_frame_equal
Expand Down
2 changes: 1 addition & 1 deletion tests/estimagic/inference/test_shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import numpy as np
import pandas as pd
import pytest
from estimagic.inference.shared import (
from estimagic.shared_covs import (
_to_numpy,
calculate_estimation_summary,
get_derivative_case,
Expand Down
4 changes: 2 additions & 2 deletions tests/estimagic/sensitivity/test_msm_sensitivity.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import pytest
from estimagic.config import EXAMPLE_DIR
from optimagic.differentiation.derivatives import first_derivative
from estimagic.inference.msm_covs import cov_optimal
from estimagic.sensitivity.msm_sensitivity import (
from estimagic.msm_covs import cov_optimal
from estimagic.msm_sensitivity import (
calculate_actual_sensitivity_to_noise,
calculate_actual_sensitivity_to_removal,
calculate_fundamental_sensitivity_to_noise,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import pandas as pd
import pytest
from estimagic.config import EXAMPLE_DIR
from estimagic.estimation.estimate_msm import estimate_msm
from estimagic.estimate_msm import estimate_msm
from numpy.testing import assert_array_almost_equal as aaae
from scipy import stats

Expand Down
2 changes: 1 addition & 1 deletion tests/estimagic/visualization/test_estimation_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import pytest
import statsmodels.api as sm
from estimagic.config import EXAMPLE_DIR
from estimagic.visualization.estimation_table import (
from estimagic.estimation_table import (
_apply_number_format,
_check_order_of_model_names,
_convert_frame_to_string_series,
Expand Down
2 changes: 1 addition & 1 deletion tests/estimagic/visualization/test_lollipop_plot.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import numpy as np
import pandas as pd
from estimagic.visualization.lollipop_plot import lollipop_plot
from estimagic.lollipop_plot import lollipop_plot


def test_lollipop_plot_runs():
Expand Down

0 comments on commit 8774da9

Please sign in to comment.