Skip to content

Commit

Permalink
improve documentation of utils modules
Browse files Browse the repository at this point in the history
resolves #502
I reviewed the utils modules to check for docstrings, and decided to import set_seed into the top-level API to make it easier to find
  • Loading branch information
sammlapp committed Sep 11, 2024
1 parent 341d077 commit d79c214
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions opensoundscape/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@
from .annotations import BoxedAnnotations
from .preprocess.utils import show_tensor, show_tensor_grid
from .localization import SpatialEvent, SynchronizedRecorderArray
from .utils import set_seed
3 changes: 2 additions & 1 deletion opensoundscape/ml/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,11 @@ def collate_audio_samples_to_tensors(batch):


def check_labels(label_df, classes):
"""check that classes and label_df.columns are the same, otherwise raise a helpful error"""
class_err = """
Train and validation datasets must have same classes
and class order as model object. Consider using
`train_df=train_df[cnn.classes]` or `cnn.classes=train_df.columns`
`train_df=train_df[cnn.classes]` or `cnn.change_classes(train_df.columns)`
before training.
"""
assert list(classes) == list(label_df.columns), class_err
Expand Down

0 comments on commit d79c214

Please sign in to comment.