Module Contents

lathe.bar(title, data, xlabel, xticklabels, ylabel, file=None, figsize=None, xlim=None, ylim=None, colors=['b', 'g', 'r', 'c', 'm', 'y', 'k'])[source]
lathe.plot(title, xdata, ydata, ylabel=None, file=None, figsize=None, xlim=None, ylim=None, colors=['b', 'g', 'r', 'c', 'm', 'y', 'k'], font_size=16)[source]
lathe.parse_args(parser=<function _parse_args>)[source]

Parse arguments from the command line.

Parameters:parser (function, optional) – The argument parsing function to use.
Returns:The parsed arguments.
Return type:argparse.Namespace
lathe.load(file_path, label_size=0, encode_nominal=True, one_hot_data=False, one_hot_targets=False, imputer=None, normalizer=None, shuffle=False)[source]

Load an ARFF file.

Parameters:
  • file_path (str) – The path of the ARFF formatted file to load.
  • label_size (int, optional) – The number of labels (outputs) the dataset to load has.
  • encode_nominal (bool, optional) – Whether or not to encode nominal atributes as integers.
  • one_hot_data (bool, optional) – Whether or not to use a one-hot encoder for nominal attributes in data. Defaults to whatever the value of encode_nominal is.
  • one_hot_targets (bool, optional) – Whether or not to use a one-hot encoder for nominal attributes in targets.
  • imputer (function, optional) – A 1 arity function that accepts the dataset to impute missing values over. e.g: sklearn.preprocessing.Imputer().fit_transform. Defaults to None.
  • normalizer (function, optional) – A 1 arity function that accepts the data to be scaled as a parameter and returns the scaled data. e.g: lathe.minmax_scale. Defaults to None.
  • shuffle (bool, optional) – Whether or not to shuffle the data.
Returns:

Tuple containing (attributes, data, targets). Where attributes is a list of tuples containing (attribute_name, attribute_type), data are the features and targets are the expected output for the dataset.

Return type:

(list, numpy.ndarray, numpy.ndarray)

Note

targets will be None unless label_size >= 1.

lathe.shuffle(features, labels)[source]
lathe.split(features, labels, percent)[source]
lathe.k_fold(data, n_splits, shuffle=False)[source]
lathe.minmax_scale(data, axis=0)[source]

Transforms features by scaling data along axis between 0-1.

Parameters:
  • data (np.ndarray) – The data to scale.
  • axis (int) – The axis to scale along.
Returns:

The scaled data.

Return type:

(np.ndarray)

lathe.measure_error(predictions, targets, rtol=0, evaluator=<function mse>)[source]
lathe.measure_accuracy(predictions, targets, rtol=0)[source]
lathe.evaluate(data, targets, predict_function, measure_functions=None, rtol=0, progress=False, *args)[source]
lathe.get_continuous_index(attributes)[source]
lathe.get_nominal_index(attributes)[source]

Submodules

lathe.checkpoint

lathe.checkpoint.load(path)[source]
lathe.checkpoint.save(path, checkpoint)[source]

lathe.metrics

lathe.metrics.mse(predictions, targets)[source]
lathe.metrics.rmse(predictions, targets)[source]