src/estimagic/optimization/pounders_auxiliary.py
def update_residual_model_with_new_accepted_x(residual_model, x_candidate):
    """Use accepted candidate to update residual model.

    Args:
        residual_model (dict): Dictionary containing the parameters of
            the residual model, i.e. <"intercepts", "linear_terms", and
            "square terms".
        x_candidate (np.ndarray): Vector of centered x candidates of shape (n,).

    Returns:
        residual_model (dict): Dictionary containing the parameters of the
            residual model with updated "intercepts" and "linear_terms".
    """
    residual_model_updated = residual_model.copy()

    residual_model_updated["intercepts"] = (
        residual_model["intercepts"]
        + np.dot(x_candidate, residual_model["linear_terms"])
        + 0.5 * np.dot(np.dot(x_candidate, residual_model["square_terms"]), x_candidate)
    )
    residual_model_updated["linear_terms"] = (
        residual_model["linear_terms"]
        + np.dot(residual_model["square_terms"], x_candidate).T
    )

    return residual_model_updated
Use accepted candidate to update residual model.

    Args:
        residual_model (dict): Dictionary containing the parameters of
            the residual model, i.e. <"intercepts", "linear_terms", and
            "square terms".
        x_candidate (np.ndarray): Vector of centered x candidates of shape (n,).

    Returns:
        residual_model (dict): Dictionary containing the parameters of the
            residual model with updated "intercepts" and "linear_terms".
    
Use accepted candidate to update residual model.
Use accepted candidate to update residual model .
def update_residual_model_with_new_accepted_x(residual_model, x_candidate):
    residual_model_updated = residual_model.copy()
    residual_model_updated["intercepts"] = (
        residual_model["intercepts"]
        + np.dot(x_candidate, residual_model["linear_terms"])
        + 0.5 * np.dot(np.dot(x_candidate, residual_model["square_terms"]), x_candidate)
    )
    residual_model_updated["linear_terms"] = (
        residual_model["linear_terms"]
        + np.dot(residual_model["square_terms"], x_candidate).T
    )
    return residual_model_updated
def update_residual_model_with_new_accepted_x ( residual_model , x_candidate ) : residual_model_updated = residual_model . copy ( ) residual_model_updated [ "intercepts" ] = ( residual_model [ "intercepts" ] + np . dot ( x_candidate , residual_model [ "linear_terms" ] ) + 0.5 * np . dot ( np . dot ( x_candidate , residual_model [ "square_terms" ] ) , x_candidate ) ) residual_model_updated [ "linear_terms" ] = ( residual_model [ "linear_terms" ] + np . dot ( residual_model [ "square_terms" ] , x_candidate ) . T ) return residual_model_updated
Use accepted candidate to update residual model.
Use accepted candidate to update residual model .
"""Use accepted candidate to update residual model.

    Args:
        residual_model (dict): Dictionary containing the parameters of
            the residual model, i.e. <"intercepts", "linear_terms", and
            "square terms".
        x_candidate (np.ndarray): Vector of centered x candidates of shape (n,).

    Returns:
        residual_model (dict): Dictionary containing the parameters of the
            residual model with updated "intercepts" and "linear_terms".
    """
residual_model (dict): Dictionary containing the parameters of the
residual model with updated "intercepts" and "linear_terms".
residual_model ( dict ) : Dictionary containing the parameters of the residual model with updated " intercepts " and " linear_terms " .
residual_model
Dictionary containing the parameters of
the residual model, i.e. <"intercepts", "linear_terms", and
"square terms".
Dictionary containing the parameters of the residual model i . e . < " intercepts " " linear_terms " and " square terms " .
x_candidate
Vector of centered x candidates of shape (n,).
Vector of centered x candidates of shape ( n ) .