Skip to content

Single-Output Regression

Train a model that predicts a single scalar property (formation energy, bandgap, bulk modulus, …).

Command

train_alignn.py \
  --root_dir "alignn/examples/sample_data" \
  --config "alignn/examples/sample_data/config_example.json" \
  --output_dir=temp

What you need

The bundled sample_data trains OPT-bandgap on 50 JARVIS-DFT materials. The data was generated by generate_sample_data_reg.py — adapt it to build a larger dataset or use your own structures.

Output

After training finishes, --output_dir contains:

  • best_model.pt — the model checkpoint with the lowest validation loss
  • history_train.json, history_val.json — per-epoch metrics
  • prediction_results_test_set.csv — predictions on the held-out test set

CLI reference

train_alignn.py -h

Tips

  • Use batch_size: 32 or 64 in the config for real trainings.
  • If you need to train on one set and evaluate on another, set n_train, n_val, n_test and keep_data_order: true.
  • For datasets hosted by jarvis-tools, the alignn/scripts/ directory has ready-to-run scripts that download and train in one step.

See also