Collect representative data
Replace synthetic examples with a dataset that matches the target device inputs and pre-processing pipeline before pruning experiments.
Prune models for mobile. Measure latency and size.
Model pruning removes redundant weights or nodes to reduce model size and inference cost for mobile devices. Practical pruning work includes measuring latency, memory use and accuracy trade-offs on representative edge inputs.
Learning concept · Not a validated service
Model pruning removes redundant weights or nodes to reduce model size and inference cost for mobile devices. Practical pruning work includes measuring latency, memory use and accuracy trade-offs on representative edge inputs.
A proposed application is an on-device classifier for battery-powered sensors where reduced model size lowers memory and energy costs. Any deployed system should retain a human-in-the-loop for critical decisions and be validated on real device telemetry.
Replace synthetic examples with a dataset that matches the target device inputs and pre-processing pipeline before pruning experiments.
Fit a simple, well-documented baseline model and record its accuracy, size and latency to serve as the pruning reference.
Iteratively prune weights or tree nodes, combine with quantisation, and measure accuracy and model file size after each change.
Measure latency, memory and battery cost on the target hardware and compare to acceptance thresholds; monitor post-deploy drift.
The supplied starter trains a DecisionTreeClassifier on synthetic classification data, times repeated predictions on a single sample to estimate per-sample latency, and prints tree depth and node count. It does not perform pruning, quantisation, model export, or any mobile runtime evaluation.
X, y = make_classification(n_samples=1000, n_features=12, n_informative=8, random_state=42)
model = DecisionTreeClassifier(max_depth=6, random_state=42)
model.fit(X, y)
sample = X[:1]
start = time.perf_counter()The code uses synthetic data (make_classification) and a scikit-learn DecisionTree with no pruning or compression steps. It only measures a crude in-process latency by calling predict in a loop and does not export a compact model format (for example TensorFlow Lite or ONNX), run on-device, or evaluate accuracy on realistic edge inputs.
A proposed extension: train a real model on representative sensor or camera data, apply magnitude or structured pruning and integer quantisation, export to TensorFlow Lite or ONNX, then measure latency and memory on the target device.
This is a potential application pathway, not a delivered product. The supplied starter does not implement this service or validate it with real users.
Networkers Home runs this topic inside its Network Engineering Course, with placement support and hands-on labs.