(X, Y, maxorder, maxiter, m, K, R, alpha, lambdax)
return [N, d, maxorder, maxiter,
            m, K, R, alpha, lambdax]
Perform checks to ensure all parameters are within usable/expected ranges.
Perform checks to ensure all parameters are within usable/expected ranges.
Perform checks to ensure all parameters are within usable / expected ranges .
def _check_settings(X, Y, maxorder, maxiter, m, K, R, alpha, lambdax):
    """Perform checks to ensure all parameters are within usable/expected ranges."""
    # Get dimensionality of numpy arrays
    N, d = X.shape
    y_row = Y.shape[0]

    # Now check input-output mismatch
    if d == 1:
        raise RuntimeError("Matrix X contains only a single column: No point to do sensitivity analysis when d = 1.")
    if N < 300:
        raise RuntimeError(f"Number of samples in matrix X, {N}, is insufficient. Need at least 300.")
    if N != y_row:
        raise RuntimeError(f"Dimension mismatch. The number of outputs ({y_row}) should match number of samples ({N})")
    if Y.size != N:
        raise RuntimeError("Y should be a N x 1 vector with one simulated output for each N parameter vectors.")

    if maxorder not in (1,2,3):
        raise RuntimeError(f"Field \"maxorder\" of options should be an integer with values of 1, 2 or 3, got {maxorder}")

    # Important next check for maxorder - as maxorder relates to d
    if (d == 2) and (maxorder > 2):
        raise RuntimeError("SALib-HDMR ERRROR: Field \"maxorder\" of options has to be 2 as d = 2 (X has two columns)")

    if maxiter not in np.arange(1, 1001):
        raise RuntimeError("Field \"maxiter\" of options should be an integer between 1 to 1000.")
    
    if m not in np.arange(1, 11):
        raise RuntimeError("Field \"m\" of options should be an integer between 1 to 10.")

    if K not in np.arange(1, 101):
        raise RuntimeError("Field \"K\" of options should be an integer between 1 to 100.")

    if R is None:
        R = y_row // 2
    elif R not in np.arange(300, N+1):
        raise RuntimeError(f"Field \"R\" of options should be an integer between 300 and {N}, the number of rows matrix X.")

    if (K == 1) and (R != y_row):
        R = y_row
    
    if alpha < 0.5 or alpha > 1.0:
        raise RuntimeError("Field \"alpha\" of options should be an integer between 0.5 to 1.0")

    if lambdax > 10.0:
        raise RuntimeError("SALib-HDMR WARNING: Field \"lambdax\" of options set rather large. Default: lambdax = 0.01")
    elif lambdax < 0.0:
        raise RuntimeError("Field \"lambdax\" (regularization term) of options cannot be smaller than zero. Default: 0.01")

    return [N, d, maxorder, maxiter,
            m, K, R, alpha, lambdax]
def _check_settings ( X , Y , maxorder , maxiter , m , K , R , alpha , lambdax ) : # Get dimensionality of numpy arrays N , d = X . shape y_row = Y . shape [ 0 ] # Now check input-output mismatch if d == 1 : raise RuntimeError ( "Matrix X contains only a single column: No point to do sensitivity analysis when d = 1." ) if N < 300 : raise RuntimeError ( f"Number of samples in matrix X, {N}, is insufficient. Need at least 300." ) if N != y_row : raise RuntimeError ( f"Dimension mismatch. The number of outputs ({y_row}) should match number of samples ({N})" ) if Y . size != N : raise RuntimeError ( "Y should be a N x 1 vector with one simulated output for each N parameter vectors." ) if maxorder not in ( 1 , 2 , 3 ) : raise RuntimeError ( f"Field \"maxorder\" of options should be an integer with values of 1, 2 or 3, got {maxorder}" ) # Important next check for maxorder - as maxorder relates to d if ( d == 2 ) and ( maxorder > 2 ) : raise RuntimeError ( "SALib-HDMR ERRROR: Field \"maxorder\" of options has to be 2 as d = 2 (X has two columns)" ) if maxiter not in np . arange ( 1 , 1001 ) : raise RuntimeError ( "Field \"maxiter\" of options should be an integer between 1 to 1000." ) if m not in np . arange ( 1 , 11 ) : raise RuntimeError ( "Field \"m\" of options should be an integer between 1 to 10." ) if K not in np . arange ( 1 , 101 ) : raise RuntimeError ( "Field \"K\" of options should be an integer between 1 to 100." ) if R is None : R = y_row // 2 elif R not in np . arange ( 300 , N + 1 ) : raise RuntimeError ( f"Field \"R\" of options should be an integer between 300 and {N}, the number of rows matrix X." ) if ( K == 1 ) and ( R != y_row ) : R = y_row if alpha < 0.5 or alpha > 1.0 : raise RuntimeError ( "Field \"alpha\" of options should be an integer between 0.5 to 1.0" ) if lambdax > 10.0 : raise RuntimeError ( "SALib-HDMR WARNING: Field \"lambdax\" of options set rather large. Default: lambdax = 0.01" ) elif lambdax < 0.0 : raise RuntimeError ( "Field \"lambdax\" (regularization term) of options cannot be smaller than zero. Default: 0.01" ) return [ N , d , maxorder , maxiter , m , K , R , alpha , lambdax ]