src/estimagic/optimization/pounders_auxiliary.py
def update_initial_residual_model(
    initial_residual_model, x_candidate, residuals_candidate
):
    """Update linear and square terms of the initial residual model.

    Args:
        initial_residual_model (dict): Dictionary containing the parameters
            of the initial residual model, including "intercepts",
            "linear_terms", and "square terms".
        x_candidate (np.ndarray): Vector of centered x candidates of shape (n,).
        residuals_candidate (np.ndarray): Array of the corresponding centered
            residuals of shape (n, nobs).

    Returns:
        residual_model_updated (dict): Dictionary containing the parameters of
            the residual model with update "linear_terms" and "square_terms".
    """
    residual_model_updated = initial_residual_model.copy()
    n, n_obs = x_candidate.shape[0], residuals_candidate.shape[1]

    residual_model_updated["linear_terms"] = np.linalg.solve(
        x_candidate, residuals_candidate
    )
    residual_model_updated["square_terms"] = np.zeros((n_obs, n, n))

    return residual_model_updated
Update linear and square terms of the initial residual model.

    Args:
        initial_residual_model (dict): Dictionary containing the parameters
            of the initial residual model, including "intercepts",
            "linear_terms", and "square terms".
        x_candidate (np.ndarray): Vector of centered x candidates of shape (n,).
        residuals_candidate (np.ndarray): Array of the corresponding centered
            residuals of shape (n, nobs).

    Returns:
        residual_model_updated (dict): Dictionary containing the parameters of
            the residual model with update "linear_terms" and "square_terms".
    
Update linear and square terms of the initial residual model.
Update linear and square terms of the initial residual model .
def update_initial_residual_model(
    initial_residual_model, x_candidate, residuals_candidate
):
    residual_model_updated = initial_residual_model.copy()
    n, n_obs = x_candidate.shape[0], residuals_candidate.shape[1]
    residual_model_updated["linear_terms"] = np.linalg.solve(
        x_candidate, residuals_candidate
    )
    residual_model_updated["square_terms"] = np.zeros((n_obs, n, n))
    return residual_model_updated
def update_initial_residual_model ( initial_residual_model , x_candidate , residuals_candidate ) : residual_model_updated = initial_residual_model . copy ( ) n , n_obs = x_candidate . shape [ 0 ] , residuals_candidate . shape [ 1 ] residual_model_updated [ "linear_terms" ] = np . linalg . solve ( x_candidate , residuals_candidate ) residual_model_updated [ "square_terms" ] = np . zeros ( ( n_obs , n , n ) ) return residual_model_updated
Update linear and square terms of the initial residual model.
Update linear and square terms of the initial residual model .
"""Update linear and square terms of the initial residual model.

    Args:
        initial_residual_model (dict): Dictionary containing the parameters
            of the initial residual model, including "intercepts",
            "linear_terms", and "square terms".
        x_candidate (np.ndarray): Vector of centered x candidates of shape (n,).
        residuals_candidate (np.ndarray): Array of the corresponding centered
            residuals of shape (n, nobs).

    Returns:
        residual_model_updated (dict): Dictionary containing the parameters of
            the residual model with update "linear_terms" and "square_terms".
    """
residual_model_updated (dict): Dictionary containing the parameters of
the residual model with update "linear_terms" and "square_terms".
residual_model_updated ( dict ) : Dictionary containing the parameters of the residual model with update " linear_terms " and " square_terms " .
initial_residual_model
Dictionary containing the parameters
of the initial residual model, including "intercepts",
"linear_terms", and "square terms".
Dictionary containing the parameters of the initial residual model including " intercepts " " linear_terms " and " square terms " .
x_candidate
Vector of centered x candidates of shape (n,).
Vector of centered x candidates of shape ( n ) .
residuals_candidate
Array of the corresponding centered
residuals of shape (n, nobs).
Array of the corresponding centered residuals of shape ( n nobs ) .