pybdt.util module

Some general utility functions used by pybdt.

pybdt.util.load(filename)

Load object directly from filename.

Parameters:

filename (str) – The filename containing the pickled object.

pybdt.util.load_sklearn(filename, feature_names, signal_id, key=None)

Load a classifier saved using sklearn.externals.joblib.dump().

Parameters:
  • filename (str) – The filename containing the saved classifier.

  • feature_names (list of str) – The names of the event features to use.

  • signal_id (int) – The signal class id: either 0 or 1.

  • key (str) – The key pointing to the classifier. If not given, the classifier must be the only object in the file.

pybdt.util.mkdir(path)

Like os.makedirs, except it is not an error if path already exists.

Parameters:

path (str) – The path to create.

pybdt.util.save(obj, filename)

Save obj directly to filename.

Parameters:
  • obj (object) – The object to save.

  • filename (str) – The filename.

pybdt.util.sklearn_to_BDTModel(sbdt, feature_names, signal_id)

Convert a scikit-learn classifier.

Parameters:
  • sbdt (sklearn classifier) – The scikit-learn classifier.

  • feature_names (list of str) – The names of the event features to use.

  • signal_id (int) – The signal class id: either 0 or 1.