yatsm.cli.train module

Command line interface for training classifiers on YATSM output

yatsm.cli.train.algo_diagnostics(cfg, X, y, row, col, algo, n_fold, make_plots=True)[source]

Display algorithm diagnostics for a given X and y

Parameters:
  • cfg – YATSM configuration dictionary
  • X – X feature input used in classification
  • y – y labeled examples
  • row – row pixel locations of y
  • col – column pixel locations of y
  • algo – classifier used from scikit-learn
  • n_fold – number of folds for crossvalidation
  • make_plots – show diagnostic plots (default: True)
yatsm.cli.train.find_result_attributes(cfg)[source]

Return result attributes relevant for training a classifier

At this time, the only relevant information is the design information, design (OrderedDict) and design_matrix (str)

Parameters:cfg – YATSM configuration dictionary
Returns:dictionary of result attributes
Return type:dict
yatsm.cli.train.get_training_inputs(cfg, exit_on_missing=False)[source]

Returns X features and y labels specified in config file

Parameters:
  • cfg – YATSM configuration dictionary
  • exit_on_missing – exit if input feature cannot be found
Returns:

matrix of feature inputs for each training data sample y (np.ndarray): array of labeled training data samples row (np.ndarray): row pixel locations of y col (np.ndarray): column pixel locations of y labels (np.ndarraY): label of y if found, else None

Return type:

X (np.ndarray)

yatsm.cli.train.is_cache_old(cache_file, training_file)[source]

Indicates if cache file is older than training data file

Parameters:
  • cache_file – filename of the cache file
  • training_file – filename of the training data file
Returns:

True if the cache file is older than the training data file

and needs to be updated; False otherwise

Return type:

bool