---
title: "Ehsan Mazaheri Tehrani | Lead Data Scientist"
description: "Lead Data Scientist. Six years owning ML systems from data pipeline to canary rollout. PhD in Electrical Engineering, 2026."
url: "https://emazaheri.com"
---

# Ehsan Mazaheri Tehrani

> I turn noisy data into systems that hold up in production.

Lead Data Scientist. Six years owning ML systems from data pipeline to canary rollout. PhD in Electrical Engineering, 2026. Based in Toronto, Canada.

ORCID: https://orcid.org/0000-0003-1681-8635

## Selected work

### Decade-scale grid capacity planning

Energentis · 2025 to present

Physics-informed transformer that forecasts power system capacity needs 10 to 20 years out.

- **Problem:** Utilities plan infrastructure on horizons where demand, weather, policy and technology all move at once. Incumbent tools extrapolate.
- **Constraint:** Fifty-plus data sources with different cadences and geographies, and time-correlated data where an ordinary random split leaks the future into training.
- **Approach:** Extended a transformer to multimodal inputs (time series, spatial, and spatio-temporal features) with physical constraints in the loss. Built an Azure lakehouse with automated ETL, chronological splits, and train-only scaling statistics.
- **Result:** 17% MAPE on decade-scale forecasts, verified against the incumbent capacity-planning baseline.
- **Result:** 50+ sources in the lakehouse, verified automated ETL, schema validated.
- **Stack:** PyTorch, Transformers, Azure Data Lake, Data Factory, Python

### ML platform for distributed energy resources

IEMS Solutions for Honeywell Forge · 2024

Cloud-native microservices that run ML models against 20,000 devices across 200 utilities.

- **Problem:** Utilities needed to forecast and shape virtual power plant capacity in near real time, and the models had to be updated without risking live grid operations.
- **Constraint:** Every prediction had to be traceable to its training data and commit. Updates could not be trusted until proven against live traffic.
- **Approach:** FastAPI services on Kubernetes with shadow and canary rollout. Models disaggregate EV charging from feeder load and regroup DERs. MLflow and DVC version models and data; schema and range validation guard the feature pipelines.
- **Result:** 30% peak demand reduction, verified per feeder and utility segment, not aggregate only.
- **Result:** 20000 DERs under load test, verified across 200+ utilities.
- **Stack:** FastAPI, Kubernetes, Docker, MLflow, DVC, LangChain, PyTest

### CheeGol: plant identification at scale

DigiNext, DigiKala Ventures · 2022 to 2024

Co-founded an AI SaaS that identifies plants from user photos and recommends care.

- **Problem:** Photos from real users are blurry, cropped, and badly lit. A model that scores well on a clean split fails in the field.
- **Constraint:** Inference had to run cheaply enough for a pre-seed startup, on small instances, for 8,000 species.
- **Approach:** Trained and fine-tuned CV models in PyTorch, added YOLO-based disease symptom detection, quantized and containerized for low-latency serving. Led a React Native app and MERN web platform around it.
- **Result:** 95% accuracy on user-submitted photos, verified 8,000+ species, real uploads.
- **Result:** $100k pre-seed raised, verified DigiKala Ventures.
- **Stack:** PyTorch, YOLO, FastAPI, Docker, React Native, MongoDB, Node.js

### LLM agents for outage management

IEMS Solutions · 2024

Agents that read operator messages and locate outages faster than manual triage.

- **Problem:** Outage reports arrive as unstructured messages. Identifying the fault location was a manual bottleneck before restoration could begin.
- **Constraint:** Open-source models only, running inside the utility's environment.
- **Approach:** LangChain agents over open-source LLMs that parse, classify, and geolocate reports and hand structured tickets to the restoration workflow.
- **Result:** 40% faster outage identification, verified measured on message-to-ticket time.
- **Stack:** LangChain, Open-source LLMs, FastAPI, Python

## How it ships

The ML lifecycle as an iterative loop, not a one-way pipeline. Platform is cross-cutting: it runs under every stage rather than following them.

### Frame

Turn a business complaint into inputs, outputs and an objective, with a non-ML baseline that has to be beaten first.

Tools: Problem framing, Non-ML baselines, Objective decoupling, Metric design, Cost of a wrong prediction

### Data

Move raw data in from many sources without losing order or provenance, then curate what the model actually trains on.

Tools: Apache Spark, Kafka, Airflow, Azure Data Lake, Data Factory, PostgreSQL, TimescaleDB, MongoDB, Neo4j, Redis, Data lineage

### Features

Turn signals into inputs a model can learn from, with leakage-safe splits and statistics taken from the train split only.

Tools: Pandas, NumPy, STFT and wavelets, Fourier analysis, Scikit-learn, DVC

### Model

Start simple, then earn the complexity, with physics in the loss where the domain allows it.

Tools: PyTorch, JAX, TensorFlow, XGBoost, Transformers, Hugging Face, LangChain, LangGraph, Claude Agent SDK, Weaviate

### Evaluate

Decide whether the candidate is good enough to ship. How fast this gate clears, not how fast the model trains, sets how fast the loop turns.

Tools: MLflow, Slice-based evaluation, Calibration, Shadow deployment, Canary release, A/B testing, PyTest, Selenium

### Serve

Put the model behind an API that survives real traffic.

Tools: FastAPI, TorchServe, ONNX, Docker, NGINX, Quantization

### Observe

Know when the data or the model drifts before the business does, and work out which of those changes is worth acting on.

Tools: Grafana, Prometheus, Loki, Data validation, Drift detection

### Platform

Storage and compute, orchestration, registries and reproducible environments. Not a step after the others, but the layer every step runs on.

Tools: Terraform, Ansible, Kubernetes, Azure (AKS, Functions, Key Vault), AWS (EC2, S3, ECR), GitHub Actions, Azure DevOps

## Timeline

### Roles

**Lead Data Scientist**, Energentis (Contract) · Toronto · Sep 2025 to Present

- Architected a physics-informed transformer for 10 to 20 year capacity expansion planning over multimodal grid, weather, demand and regulatory data.
- Reached 17% MAPE on decade-scale horizons against the incumbent baseline.
- Designed an Azure lakehouse with automated ETL for 50+ sources, chronological splits and train-only scaling to prevent leakage.
- Worked with policy and partnerships teams to align model capabilities with regulatory requirements.

**Lead Data Scientist**, IEMS Solutions · Toronto · Jan 2024 to Dec 2024

- Led ML integration into Honeywell Forge's DERMS platform.
- Built a FastAPI, Docker and Kubernetes microservices platform load-tested to 20,000 DERs across 200+ utilities, with shadow and canary rollout.
- Disaggregated EV charging and optimized DER grouping, cutting peak demand 30% per feeder.
- Instrumented monitoring, validation and full lineage with MLflow and DVC.
- Built LangChain agents on open-source LLMs that cut outage identification time 40%.

**Software Engineer, AI**, DigiNext, DigiKala Ventures · Tehran · Feb 2022 to Mar 2024

- Co-founded CheeGol, an AI plant identification SaaS, and raised $100k pre-seed.
- Trained and deployed CV models holding 95% accuracy across 8,000+ species on real user photos.
- Quantized and containerized inference to run on smaller instances.
- Led a React Native app and MERN web platform; mentored junior developers.

**Machine Learning Researcher**, University of Tehran · Tehran · Aug 2017 to Aug 2019

- Systematic review of applied ML for fault diagnosis in electrical machines.
- Built fault diagnosis models in Python and PyTorch.

### Study

**PhD, Electrical Engineering**, University of Tehran · Tehran · Sep 2019 to Sep 2026 (expected)

Dissertation: Methodology of applying physics-informed machine learning for fault diagnosis in permanent magnet synchronous machines under scarcity of data.

**MSc, Electrical Engineering**, University of Tehran · Tehran · Sep 2014 to Jul 2017

**BSc, Electrical Engineering**, Isfahan University of Technology · Isfahan · Sep 2009 to Sep 2013

## Lab

Research rebuilt to run in the browser, one lab per page. Each is interactive and has no Markdown equivalent; its page's Markdown twin describes what it shows.

### [Motor-fault classifier](https://emazaheri.com/lab/motor-fault)

Pick a fault, watch its signature appear in the spectrum, and see a 1D CNN call it from the raw current.

### [Inverse PINN flux observer](https://emazaheri.com/lab/flux-observer)

A physics-informed network is trained from scratch in your browser to find a motor's magnet strength from its terminals alone.

## Open source

Side projects with public code. Every number is quoted from the project's own README or tests.

### [ios-agent](https://github.com/emazaheri/ios-agent)

Give an AI agent an iPhone. It checks every step it takes.

- **243 tokens** per screen on a physical iPhone, from 140 raw nodes (README, measured on iOS 26.6 over Wi-Fi)
- **39/39** tasks passed, 41 observations against a floor of 39 (README, 13 tasks x 3 runs)
- **1,061** tests that run offline (README, CI badge)

Python, MIT. Runs on macOS and iOS. Stack: Python, MCP, LangGraph, XCUITest, Textual.

Docs: https://emazaheri.github.io/ios-agent/

## Book

**Fault Diagnosis of Permanent Magnets Machines**

Jawad Faiz, Ehsan Mazaheri-Tehrani, Bashir-Mahdi Ebrahimi. Wiley-IEEE Press, 2026. Edition 1, 448 pages, hardcover. ISBN 978-1-394-42497-9.

Written with Jawad Faiz and Bashir-Mahdi Ebrahimi for engineers who keep permanent magnet machines running, and for graduate courses on condition monitoring. It sets each fault against its induction-machine counterpart, and closes with repair strategies and what it takes to run these diagnostics in the field.

[Wiley](https://www.wiley.com/en-us/Fault+Diagnosis+of+Permanent+Magnets+Machines-p-9781394424979) · [Amazon](https://www.amazon.ca/dp/1394424973)

## Research and credentials

### Peer-reviewed publications

- 2025. Physics-Informed Neural Network Approach to Diagnosing Uniform Demagnetization Faults in Permanent Magnet Synchronous Machines. *IEEE Access* (journal). https://doi.org/10.1109/ACCESS.2025.3627638
- 2022. Airgap and stray magnetic flux monitoring techniques for fault diagnosis of electrical machines: An overview. *IET Electric Power Applications* (journal). https://doi.org/10.1049/elp2.12157
- 2019. A Fast Phase Variable abc Model of Brushless PM Motors Under Demagnetization Faults. *IEEE Transactions on Industrial Electronics* (journal). https://doi.org/10.1109/TIE.2018.2868320
- 2017. A novel demagnetization fault detection of brushless DC motors based on current time-series features. *IEEE SDEMPED* (conference). https://doi.org/10.1109/DEMPED.2017.8062350
- 2016. Demagnetization Modeling and Fault Diagnosing Techniques in Permanent Magnet Machines under Stationary and Non-Stationary Conditions: An Overview. *IEEE Transactions on Industry Applications* (journal). https://doi.org/10.1109/TIA.2016.2608950

### Awards

- 2009. Top 0.3% of 300,000+. Nationwide university entrance exam, mathematics and physics branch.
- 2019. PhD admission through the talent program. University of Tehran.
- 2019. Scientia PhD Scholarship. UNSW, Australia. $52,000 AUD per year.

### Certifications

- [Databricks Certified Machine Learning Professional](https://www.credential.net/2e23bf1c-eec3-47d3-a7eb-c5fa036a69b4). Databricks, 2026-09.
- [AI Engineer for Data Scientists Associate](https://www.datacamp.com/certificate/AEDS0012679439801). DataCamp, 2026-08.
- [Databricks Certified Associate Developer for Apache Spark 3.0](https://credentials.databricks.com/38ccf444-cb1d-4c12-bbb4-159305dd086b). Databricks, 2024-11.
- [Data Engineer in Python](https://www.datacamp.com/statement-of-accomplishment/track/db868ca400da9a0796b18f767c7fd5fed68543b4). DataCamp, 2024-11.
- [AWS Certified Cloud Practitioner](https://www.credly.com/badges/48a3089e-ac21-41fc-b347-88e71bd98b71). Amazon Web Services, 2023-11.
- [Data Scientist Associate](https://www.datacamp.com/certificate/DSA0016083786527). DataCamp, 2023-11.
- [Generative AI with Large Language Models](https://www.coursera.org/account/accomplishments/certificate/ZFBDS8C4TPML). DeepLearning.AI, 2023-11.
- [Deep Learning with Python and PyTorch](https://courses.edx.org/certificates/0d534e4084e04a0298b267916d31a125). IBM via edX, 2023-03.

## Engineering notes

Long-form notes at https://emazaheri.com/notes. RSS at https://emazaheri.com/notes/feed.xml.

- [Reading a motor spectrum without overreading it](https://emazaheri.com/notes/reading-a-motor-spectrum). What each fault in the Lab does to a machine, why it lands where it does in the spectrum, and where the simulation is kinder than a real drive.

## Contact

- Email: ehsan@emazaheri.com
- github: https://github.com/emazaheri
- linkedin: https://www.linkedin.com/in/emazaheri
- scholar: https://scholar.google.com/citations?user=RI3zvw4AAAAJ
