Files
burn/examples/simple-regression
Nathaniel Simard 8037309704 perf(core)!: improve compile times via opaque inner types to break dependency chain (#4977)
* Initial commit

* Improve compilation time

* Refactor device

* Device blob

* Improvements

* Autodiff fix

* Burn-std no cubecl dep

* WIP

* Autodiff

* Sanitize outside of generic

* Fix display compilation

* Clippy

* Improve device selection

* WIP

* Fix examples wip

* Fix fmt

* Cleanup

* Fmt

* Fix clippy

* Fix autodiff

* Fix test device

* Fix docs

* Fix tests

* Fmt

* Fix display

* Miri fix

* Improve comments

* Fix device

* Fix docs
2026-05-21 14:08:30 -04:00
..

Regression

The example shows you how to:

  • Define a custom dataset for regression problems. We implement the California Housing Dataset from HuggingFace hub. The dataset is also available as part of toy regression datasets in sklearndatasets.
  • Create a data pipeline from a raw dataset to a batched fast DataLoader with min-max feature scaling.
  • Define a Simple NN model for regression using Burn Modules.

Note


This example makes use of the HuggingFace datasets library to download the datasets. Make sure you have Python installed on your computer.

The example can be run like so:

git clone https://github.com/tracel-ai/burn.git
cd burn
# Use the --release flag to really speed up training.
echo "Using flex backend"
cargo run --example regression --release --features flex                   # CPU Flex Backend - f32
echo "Using tch backend"
export TORCH_CUDA_VERSION=cu128                                            # Set the cuda version
cargo run --example regression --release --features tch-gpu                # GPU Tch Backend - f32
cargo run --example regression --release --features tch-cpu                # CPU Tch Backend - f32
echo "Using wgpu backend"
cargo run --example regression --release --features wgpu