pydataknot
Audio feature selection, model training, and hyperparameter optimization for Max/MSP DataKnot classifiers.
Installation
Requires Python >= 3.9
Recommend creating a virtual python environment:
python3 -m venv venv
source venv/bin/activate
Install via pip:
pip install --upgrade pip
pip install pydataknot
If you're performing hyperparameter optimization and want to use the Optuna Dashboard to inspect results:
pip install "pydataknot[dashboard]"
Usage
pydataknot includes a set of CLI tools that take as input json files produced from dk.classcreate in Max/MSP. To start, record a dataset using dk.classcreate and write to a json file.
Feature Selection
Select a subset of audio features for classification based on Minimum Redundancy Maximum Relevance (mRMR). The goal is to select features that correlate highly with classes (maximum relevancy) and have low correlation with other features (minimum redundancy).
This command will select 12 features from the dataset in dataset.json:
pydk-select data=dataset.json num_features=12
This will copy the dataset.json file, add the selected feature indices, and save this copy in an output directory outputs/feature_selection/{current-date}/{current-time}/.
Model Training
Train MLP classifiers using PyTorch.
This command will train a MLP on the dataset in dataset.json, the MLP will have two hidden layers each with 16 neurons (note the quotes around the layers list) and will be trained for 500 epochs:
pydk-train data=dataset.json mlp.hidden_layers="[16,16]" mlp.max_iters=500
Note: If you use the json that output from the feature selection step, training will use that subset of selected features.
Similar to feature selection, this will copy the input json file and save a copy in an output directory outputs/feature_selection/{current-date}/{current-time}/ with the trained model. dk.classmatch can load this json file and will automatically know to use the model trained here.
Run pydk-train --help to see a list of all possible arguments or check out flucoma-torch for more detailed information on arguments.
Hyperparameter Search
Perform a search over MLP parameters to find an architecture and training parameters optimized to your dataset. This uses optuna under the hood.
This command will perform a hyperparameter search consisting of 1000 trials (1000 different MLPs will be trained) where each MLP will be trained for 100 epochs.
pydk-optimize data=dataset.json mlp.max_iter=100 n_trials=1000
This could take several hours to complete.
The best resulting model and associated hyperparameters will be saved in the output directory outputs/feature_selection/{current-date}/{current-time}/. dk.classmatch can load the model file and will automatically know to use the model trained here.
See flucoma-torch for a
more detailed listing of possible arguments.
Feature Optimization
The number of input features can also be included for optimization by setting optimize_features=true. This will perform mRMR feature selection with different values for num_features to test which leads to the best performing model.
pydk-optimize data=dataset.json mlp.max_iter=100 n_trials=1000 optimize_features=true
Optuna Dashboard
To view all results in a web dashboard you can use the optuna dashboard. This is an optional dependency, to install it:
pip install "pydataknot[dashboard]"
During an optimizing study the results are stored in a database file (sqlite3) in the output directory corresponding to the study. Whether or not a sqlite3 file is saved depends on the argument sqlite,
which defaults to true.
For example:
optuna-dashboard sqlite:///outputs/optimize_classifier/2025-09-25/19-58-57/classifier_study.sqlite3
Metadata
Release files for pydataknot 0.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| pydataknot-0.0.4.tar.gz | 1.4 MB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pydataknot-0.0.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 1.5 MB
Release files / pydataknot-0.0.4.tar.gz
| Download URL | pydataknot-0.0.4.tar.gz |
|---|---|
| Size | 1.4 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f98f898b6711b06a84cd96700d749ab949ce5b98d708dcfb495637f3f8eb809c
|
|
BLAKE2b-256 checksum How to use checksums |
b4a4cc66b50a017ca557708f688581e1a8b2c3991c1ffb0072c59e873ac50118
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.4.20
|
Release files / pydataknot-0.0.4-py3-none-any.whl
| Download URL | pydataknot-0.0.4-py3-none-any.whl |
|---|---|
| Size | 21.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a3615817373bbedf98f6016c57db3a5a11695fd00b361bb0d0a72ff16576d0a0
|
|
BLAKE2b-256 checksum How to use checksums |
4c8b5947979acafe7a50aa284f52d36f373d5e844457f03fe49500bf7d53b955
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.4.20
|
Security for pydataknot 0.0.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.