Data Preparation¶
This project separates raw chemistry data from model-ready feature tables. The current source of truth is src.cli.process_features for file generation and src.training.datasets.prepare_dataset for training-time ingestion.
Raw input expectations¶
python -m src.cli.process_features expects:
- a CSV with a
SMILEScolumn - either an
IDcolumn or anamecolumn
Any other columns are preserved in the generated outputs. That includes metadata such as Known, so training configs should explicitly drop non-feature columns.
Canonical example¶
python -m src.cli.process_features data/example/raw/psychlight_a.csv \
--output-dir data/example/processed/psychlight_a
That command generates current-format files next to the checked-in legacy exports.
Generated files¶
The current CLI writes:
| File | Source in code | Notes |
|---|---|---|
<name>_descriptors.csv |
RDKit descriptor block in src.cli.process_features |
Includes the original columns, kekule_smiles, and descriptor columns from src/features/descriptors.py. |
<name>_mordred.csv |
Mordred descriptor block | Includes the original columns, kekule_smiles, and Mordred descriptors. |
<name>_morgan.csv |
Morgan fingerprint block | Includes the original columns, kekule_smiles, and morgan_bit_<i> columns. |
<name>_dpk.csv |
Optional DeepPK merge step | Written only when --deeppk-post is enabled. |
<name>_dpk.smi |
Optional DeepPK submission input | Exact SMILES file submitted to DeepPK. |
<name>_deeppk_extra.csv |
Optional DeepPK mismatch output | Written only when DeepPK returns unmatched rows. |
Note
Older checked-in files in this repository may still use the legacy *_rdkit.csv descriptor name. The current CLI writes *_descriptors.csv.
CLI flags¶
Key flags:
--output-dir: output directory, defaultdata/processed--fingerprint-radius: Morgan radius, default3--fingerprint-bits: number of fingerprint bits, default1024--deeppk-post: enable DeepPK submission--deeppk-pred-type: DeepPK prediction mode, defaultadmet--deeppk-email: optional contact email forwarded to DeepPK--deeppk-poll-interval: polling interval in seconds, default60--deeppk-timeout: timeout in seconds, default3600
What prepare_dataset does at training time¶
src.training.datasets.prepare_dataset performs the training-side cleanup:
- Load the CSV from the dataset config.
- Resolve
target_columnand eitherfeature_columnsordrop_columns. - Sanitize feature names with
sanitize_feature_columns. - Apply descriptor-specific or fingerprint-specific cleaning.
- Build
pre_model_stepssuch asVarianceThresholdorTruncatedSVD. - Remove unusable rows, then hash the cleaned dataset for reproducibility.
Descriptor datasets¶
Descriptor datasets:
- can use
feature_engineering.numeric_from_strings - may set
drop_na: true - otherwise drop all-NaN columns and median-impute remaining numeric NaNs
- do not auto-enable variance thresholding or SVD, but configs can turn them on
Fingerprint datasets¶
Fingerprint datasets:
- are coerced to numeric
- drop rows with NaNs after coercion
- are cast to
float32 - auto-enable
variance_thresholdwith a default threshold of0.01when not overridden - auto-enable
svdwith a defaultn_componentsof10when not overridden
Training config expectations¶
The refreshed starter configs assume the canonical psychlight_a flow and explicitly drop metadata columns:
That Known drop matters because the feature CLI preserves it in the generated CSVs.
DeepPK behavior¶
DeepPK handling in the current code path is:
aromatic_to_kekuleconverts SMILES to kekulized form._prepare_deeppk_artifactswrites the initial_dpk.csvand_dpk.smi._submit_and_poll_deeppksubmits the.smifile and polls until completion or timeout._merge_deeppk_resultsmerges returned records back into the CSV.- If extra records remain unmatched, the CLI writes
<name>_deeppk_extra.csv.
If no valid kekulized SMILES are available, the command fails early instead of submitting malformed input.