config
Package
- skll.config.fix_json(json_string)[source]
Fix incorrectly formatted quotes and capitalized booleans in JSON string.
- skll.config.load_cv_folds(folds_file, ids_to_floats=False)[source]
Load cross-validation folds from a CSV file.
The CSV file must contain two columns: example ID and fold ID (and a header).
- Parameters:
folds_file (
skll.types.PathOrStr
) – The path to a folds file to read.ids_to_floats (bool, default=False) – Whether to convert IDs to floats.
- Returns:
Dictionary with example IDs as the keys and fold IDs as the values. If ids_to_floats is set to True, the example IDs are floats but otherwise they are strings.
- Return type:
- Raises:
ValueError – If example IDs cannot be converted to floats and ids_to_floats is True.
- skll.config.locate_file(file_path, config_dir)[source]
Locate a file, given a file path and configuration directory.
- Parameters:
file_path (
skll.types.PathOrStr
) – The file to locate. Path may be absolute or relative.config_dir (
skll.types.PathOrStr
) – The path to the configuration file directory.
- Returns:
path_to_check – The normalized absolute path, if it exists.
- Return type:
- Raises:
FileNotFoundError – If the file does not exist.