Loading...

vastorbit.machine_learning.vast.linear_model.Lasso.get_match_index

static Lasso.get_match_index(x: str, col_list: list, str_check: bool = True) None

Returns the matching index. This function is used to simplify the overall code.

Parameters:
  • x (str) – Column’s name.

  • col_list (list) – List of columns.

  • str_check (bool, optional) – If set to True, checks if the formatted str is in the formatted list. No need for an exact match.

Returns:

index.

Return type:

int

Examples

The following code demonstrates the usage of the function.

# Import the VAST Model.
from vastorbit.machine_learning.vast.base import VASTModel

# Match
VASTModel.get_match_index('b', ['"A"', '"B"', '"C"'])

# str_check = False
VASTModel.get_match_index('b', ['"A"', '"B"', '"C"'], str_check = False)

# No Match
VASTModel.get_match_index('d', ['"A"', '"B"', '"C"'])

Note

These functions serve as utilities to construct others, simplifying the overall code.