def targets( ctx: click.Context, shapefile: str, record: Tuple[str, ...], name: str, every: int, dtype: str, normalise: bool, random_seed: int, ) -> None: """Build target file from shapefile.""" record_list = list(record) categorical = dtype == "categorical" batchMB = ctx.obj.batchMB catching_f = errors.catch_and_exit(targets_entrypoint) catching_f( batchMB, shapefile, record_list, name, every, categorical, normalise, random_seed, )
def traintest(ctx: click.Context, targets: str, split: Tuple[int, ...], random_seed: int, name: str, features: str, halfwidth: int) -> None: """Extract training and testing data to train and validate a model.""" fold, nfolds = split catching_f = errors.catch_and_exit(traintest_entrypoint) catching_f(targets, fold, nfolds, random_seed, name, halfwidth, ctx.obj.nworkers, features, ctx.obj.batchMB)
def predict( ctx: click.Context, config: str, checkpoint: str, data: str ) -> None: """Predict using a learned model.""" catching_f = errors.catch_and_exit(predict_entrypoint) catching_f(config, checkpoint, data, ctx.obj.batchMB, ctx.obj.gpu)
def train( ctx: click.Context, data: str, config: str, maxpoints: Optional[int], random_seed: int, ) -> None: """Train a model specified by an sklearn input configuration.""" catching_f = errors.catch_and_exit(train_entrypoint) catching_f(data, config, maxpoints, random_seed, ctx.obj.batchMB)
def tifs(ctx: click.Context, categorical: Tuple[str, ...], continuous: Tuple[str, ...], normalise: bool, name: str, ignore_crs: bool) -> None: """Build a tif stack from a set of input files.""" nworkers = ctx.obj.nworkers batchMB = ctx.obj.batchMB cat_list = list(categorical) con_list = list(continuous) catching_f = errors.catch_and_exit(tifs_entrypoint) catching_f(nworkers, batchMB, cat_list, con_list, normalise, name, ignore_crs)
def train(ctx: click.Context, data: str, config: str, epochs: int, batchsize: int, test_batchsize: int, iterations: Optional[int], checkpoint: Optional[str] ) -> None: """Train a model specified by a config file.""" log.info("Ignoring batch-mb option, using specified or default batchsize") catching_f = errors.catch_and_exit(train_entrypoint) catching_f(data, config, epochs, batchsize, test_batchsize, iterations, ctx.obj.gpu, checkpoint)
def query( ctx: click.Context, strip: Tuple[int, int], name: str, features: str, halfwidth: int ) -> None: """Extract query data for making prediction images.""" catching_f = errors.catch_and_exit(query_entrypoint) catching_f(features, ctx.obj.batchMB, ctx.obj.nworkers, halfwidth, strip, name)