37. Supervised API¶
This page documents supervised baseline APIs. For CLI usage, see the CLI reference.
37.1 What it is for¶
The supervised brick exposes baseline classifiers with multiple backends (numpy, sklearn, torch). [1][2]
37.2 Examples¶
List classifiers and backends:
from modssc.supervised import available_classifiers
print(available_classifiers())
Create a classifier (auto backend):
from modssc.supervised import create_classifier
clf = create_classifier("knn", backend="numpy", params={"k": 3})
Backends and metadata are defined in src/modssc/supervised/registry.py. [2]
37.3 Common classifier IDs¶
lstm_scratch(Torch LSTM for text sequences, extra:supervised-torch)audio_cnn_scratch(Torch CNN for spectrograms, extra:supervised-torch)graphsage_inductive(Torch Geometric GraphSAGE, extra:supervised-torch-geometric)
Use modssc supervised info <classifier_id> or classifier_info() to inspect required extras.
37.4 API reference¶
Supervised baselines for ModSSC.
This brick provides classic supervised classifiers used as baselines in SSL papers. It is designed to be backend-agnostic (numpy, scikit-learn, torch, etc.).
37.5
available_classifiers(*, available_only=False)
¶
List classifiers and their backends.
37.5.0.1 Parameters¶
available_only: If True, filter out backends whose required module is not importable.
Source code in src/modssc/supervised/api.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | |
37.6
create_classifier(classifier_id, *, backend='auto', params=None, runtime=None)
¶
Instantiate a classifier.
37.6.0.1 Notes¶
- backend="auto" selects the first available backend from preferred_backends.
- params are passed to the backend constructor (after runtime injection).
Source code in src/modssc/supervised/api.py
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | |