IRS-Aided Localization: Dataset Generation Guide
How to generate training data for ML-based localization error minimization using IRS
1. Core Idea
For IRS-aided localization, there is NO external dataset available — just like the secrecy rate problem. You
generate synthetic data entirely from your channel model equations and geometry. The key difference
from the secrecy rate problem is:
Secrecy Rate (Song et al. 2021) Localization (Your Problem)
Received signal features
Input (X) CSI channel matrices
(RSS / AoA / ToA)
Optimal phase shifts θ True user position (x, y)
Label (Y)
(from AO/CVX solver) (you set this — free!)
Conventional solver
Label source Ground truth by construction
(AO, SDP)
Difficulty Need solver to run Labels are free
2. Dataset Structure
Depending on the signal feature used, there are two main approaches:
Option A — RSS-Based (Simplest)
Received Signal Strength (power) at BS for different IRS beam configurations at each user position.
Input X: [P_r1, P_r2, P_r3, P_r4] (received power for 4 IRS beam directions)
Label Y: (x, y) (true user position — you set this)
Option B — AoA/ToA-Based (More Accurate)
Angle of Arrival and Time of Arrival estimated from pilot signals, with AWGN noise added.
Input X: (AoA, ToA) + noise (from geometry + channel model)
Label Y: (x, y, z) (true 3D user position)
3. Key Papers and Where They Generate Data
Paper 1 (Most Direct Match)
"Machine Learning-Driven User Localization in RIS-Assisted Wireless Systems" — arXiv: 2510.23908 (Oct
2025)
How they generate the dataset (from Section III):
The RIS controller sweeps beams across 4 angular sectors (0-90 degree elevation plane). For each
user position on a simulation grid, they record the received signal power P_r (dBm) at the BS for each
of the 4 beam directions. This (power vector, angular position) pair is one training sample. The entire
dataset is built purely from simulation — no hardware, no external data.
for each user position (elevation, azimuth):
for each of 4 IRS beam configs:
simulate P_r using path loss + IRS reflection model
save [P_r1, P_r2, P_r3, P_r4] -> (elevation, azimuth) # one sample
Paper 2 (Open-Source Code Available)
"A Fingerprint Database Generation Method for RIS-Assisted Indoor Positioning" — arXiv: 2507.18927
(Dec 2025)
How they generate the dataset:
They simulate RSS fingerprints at each reference point on a grid using a cluster-based channel model
that captures RIS multipath behavior, physical and electromagnetic properties of the RIS elements,
and spatial consistency across neighboring positions. Open-source code is released with the paper.
for each reference point (known x, y grid position):
simulate RSS using cluster-based channel model + RIS properties
save [RSS_1, ..., RSS_N] -> (x, y) # fingerprint entry
Paper 3 (Geometry + AoA/ToA approach)
"Employing High-Dimensional RIS Information for RIS-aided Localization Systems" — arXiv: 2403.16521
Uses both two-step geometric methods (AoA/ToA estimation) and fingerprint-based methods. Dataset
generated entirely from simulation using the received signal at BS and RIS.
4. Minimum Working Python Code
import numpy as np
def generate_localization_dataset(N_samples=10000, N_ris=32, freq=27e9):
c = 3e8
lam = c / freq
X = [] # received signal features
Y = [] # true positions (labels)
# Fixed node positions
BS_pos = [Link]([0, 0, 5]) # Base station
RIS_pos = [Link]([10, 0, 3]) # IRS
for _ in range(N_samples):
# --- LABEL: Random user position (you control this) ---
ue_pos = [Link]([
[Link](5, 20), # x
[Link](-10, 10), # y
1.5 # z (fixed height)
])
# --- FEATURES: Simulate received power for 4 IRS beam configs ---
power_vector = []
for config in range(4):
theta = [Link](1j * [Link](0, 2*[Link], N_ris))
d_ue_ris = [Link](ue_pos - RIS_pos)
d_ris_bs = [Link](RIS_pos - BS_pos)
d_ue_bs = [Link](ue_pos - BS_pos)
g = (lam / (4*[Link]*d_ue_ris)) * [Link](N_ris) # UE-IRS
h = (lam / (4*[Link]*d_ris_bs)) * [Link](N_ris) # IRS-BS
P_ris = abs([Link](h, theta * g))**2
P_direct = (lam / (4*[Link]*d_ue_bs))**2
P_total = P_ris + P_direct + 1e-12
power_vector.append(10 * np.log10(P_total)) # dBm
[Link](power_vector)
[Link](ue_pos[:2]) # predict (x, y)
return [Link](X), [Link](Y)
# Generate dataset
X, Y = generate_localization_dataset(N_samples=10000)
[Link]('X_localization.npy', X)
[Link]('Y_localization.npy', Y)
print(f"Dataset: X={[Link]}, Y={[Link]}")
# Output: Dataset: X=(10000, 4), Y=(10000, 2)
5. Full Pipeline Summary
Step What You Do Output
1 Define geometry: place BS, IRS, user grid Node coordinates
2 Generate random user positions (uniform grid or random)Labels Y = (x,y)
Compute received power / AoA / ToA using channel model
3 Features X
equations for each position
4 Add AWGN noise to features (makes it realistic) Noisy X
5 Save 10,000 (X, Y) pairs — 90% train, 10% test Dataset .npy / .mat
6 Train DNN / CNN / Random Forest to predict (x,y) from XTrained ML model
7 Evaluate using RMSE localization error vs CRB/MLE baseline
Results / Paper
Key Insight: The 'simulator' is just your channel model equations in a for-loop. No external tool or dataset
is needed. You control the user position (label), compute what signal would be received at that position
(feature), and repeat 10,000 times. That IS the dataset.
Prepared for Ankit Kumar, IIT Patna — 6G Beam Management & IRS Research