KiTE.validation

 1from KiTE import no_none_arg
 2
 3
 4@no_none_arg
 5def check_attributes(X, e, iterations=1000, n_jobs=1):
 6    """
 7    Check whether the input attributes are in proper format. If not exit with an Error message.
 8    """
 9    if X.shape[0] != e.shape[0]:
10        raise ValueError(
11            f"Incompatible dimension for X and e matrices. X and e should have the same feature dimension: X.shape[0] = {X.shape[0]} while e.shape[0] = {e.shape[0]}."
12        )
13    if not (isinstance(iterations, int) and iterations >= 2):
14        raise ValueError(
15            f"iterations has incorrect type or less than 2. iterations: {iterations}"
16        )
17    if not (isinstance(n_jobs, int) and n_jobs >= 1):
18        raise ValueError(f"n_jobs is incorrect type or less than 1. n_jobs: {n_jobs}")
19
20
21@no_none_arg
22def check_credible_vector_args(Y, Yr_up, Yr_down, alpha):
23    """
24    Check arguments of construct_credible_error_vector()
25    """
26    if Y.flatten().shape[0] != Yr_up.flatten().shape[0]:
27        raise ValueError(
28            f"Incompatible dimension for Y and Yr_up matrices. Y and Yr_up should have the same feature dimension: Y.shape[0] == {Y.shape[0]} while Yr.shape[0] == {Yr_up.shape[0]}."
29        )
30    if Y.flatten().shape[0] != Yr_down.flatten().shape[0]:
31        raise ValueError(
32            f"Incompatible dimension for Y and Yr matrices. Y and Yr should have the same feature dimension. Y.shape[0] == {Y.shape[0]} while Yr_down.shape[0] == {Yr_down.shape[0]}."
33        )
34    if alpha < 0 or alpha > 1:
35        raise ValueError(
36            f"Incompatible value for alpha. alpha should be a real value between 0 and 1: alpha == {alpha}"
37        )
@no_none_arg
def check_attributes(X, e, iterations=1000, n_jobs=1):
 5@no_none_arg
 6def check_attributes(X, e, iterations=1000, n_jobs=1):
 7    """
 8    Check whether the input attributes are in proper format. If not exit with an Error message.
 9    """
10    if X.shape[0] != e.shape[0]:
11        raise ValueError(
12            f"Incompatible dimension for X and e matrices. X and e should have the same feature dimension: X.shape[0] = {X.shape[0]} while e.shape[0] = {e.shape[0]}."
13        )
14    if not (isinstance(iterations, int) and iterations >= 2):
15        raise ValueError(
16            f"iterations has incorrect type or less than 2. iterations: {iterations}"
17        )
18    if not (isinstance(n_jobs, int) and n_jobs >= 1):
19        raise ValueError(f"n_jobs is incorrect type or less than 1. n_jobs: {n_jobs}")

Check whether the input attributes are in proper format. If not exit with an Error message.

@no_none_arg
def check_credible_vector_args(Y, Yr_up, Yr_down, alpha):
22@no_none_arg
23def check_credible_vector_args(Y, Yr_up, Yr_down, alpha):
24    """
25    Check arguments of construct_credible_error_vector()
26    """
27    if Y.flatten().shape[0] != Yr_up.flatten().shape[0]:
28        raise ValueError(
29            f"Incompatible dimension for Y and Yr_up matrices. Y and Yr_up should have the same feature dimension: Y.shape[0] == {Y.shape[0]} while Yr.shape[0] == {Yr_up.shape[0]}."
30        )
31    if Y.flatten().shape[0] != Yr_down.flatten().shape[0]:
32        raise ValueError(
33            f"Incompatible dimension for Y and Yr matrices. Y and Yr should have the same feature dimension. Y.shape[0] == {Y.shape[0]} while Yr_down.shape[0] == {Yr_down.shape[0]}."
34        )
35    if alpha < 0 or alpha > 1:
36        raise ValueError(
37            f"Incompatible value for alpha. alpha should be a real value between 0 and 1: alpha == {alpha}"
38        )

Check arguments of construct_credible_error_vector()