Memuat
Memuat
Watch every step above performed live, with English narration.
0 plays
Class book
Page 1 / 6
Cover: Class 5G Resource Allocation with Deep RL #5: Training a Deep Q-Network Agent for Resource Allocation
Click a page or use ◀ ▶ to turn · swipe on mobile · to enlarge
Want to go deeper?
Join one of our courses or ask us directly on WhatsApp.
Picked from the software, topic, and level of “Class 5G Resource Allocation Deep RL #5: Tutorial Deep Q-Network from Scratch with PyTorch for Resource Block and 5G Power Allocation: replay buffer, target network, Double DQN. Episode 5 of the 5G Resource Allocation Deep Reinforcement Learning Series.”.
Other ways we can help with Python.
Learn with a mentor
Scheduled AI & Machine Learning courses with live guidance and a certificate.

Multi-Objective Optimization Course: NSGA-II, MOPSO & Hybrid Algorithms (Python)

ECG Arrhythmia Classification Course with Wavelet & Deep Learning (PyTorch)

ANFIS + PSO/GA Course for Non-Linear Time Series Forecasting (Python)
Have it built for you
No time to learn Python? Our team can do the project for you.

Python Machine Learning — Prediction Models, Customer Segmentation, Fraud Detection & AI Apps

AI Image Creation with Stable Diffusion — Unlimited Custom Visual Production
★ 4.9

AI Image & Video Creation with Leonardo AI — All-in-One Visuals for Business
★ 4.9
Get notified about new Python classes
At most one email a week. Unfollow anytime with one click.
The full narration of this video. The current sentence is highlighted while the video plays; click any sentence to jump there.
This is the final result, the DeepQ Network agent we wrote from scratch with PyTorch, learning to schedule resource blocks and manage power solely through trial and error. In just a few minutes, the throughput increases from around 8 to 20 megabits per second. Let's get started. Hello, welcome to episode five of the 5G resource allocation series with Deep Reinforcement Learning. The environment is now ready. Today we are writing the DeepQ Network algorithm, an algorithm famous for successfully playing Atari games at a human level, and training it to allocate network resources.
Create file dekien.pe The Q network is a multilayer perceptron with two hidden layers of 128 neurons, which receives the state and outputs Q values for the 24 actions, which is an estimate of the total future reward if that action is taken. The Ripley buffer stores up to 100,000 transitions, then takes random samples for training, so that sequential and correlated data does not disrupt learning.
The dekien agent class has two networks. The trained Q network, and the target network which is copied every 1,000 steps to keep the target learning stable. The select function uses epsilon greedy, with the epsilon probability agent trying a random action for exploration, otherwise selecting the action with the highest Q value. The learn function uses double the QN target, the Q network selects the best action in the next state, the target network evaluates it, so the estimated value isn't too optimistic. The Uber loss and gradient clipping make training resilient to large rewards.
Create a train file named dekien.py We train for 30 episodes, each with 200 slots or 2000 decisions, with a different random network in each episode so the agent doesn't memorize one layout. Epsilon decreases linearly from 1 to 0.05 in the first part of training, and the agent learns every two decisions. After completion, the weights are saved to dekien_ allocation.pt, then we plot the training curve.
Run At the beginning, when the agent is still trying many random actions, the throughput is around 8 to 15 megabits per second. After epsilon is small, the reward rises above 1700 and throughput is around 20 megabits per second, with energy efficiency above 2 megabits per joule. Let's look at the graph. Total reward and throughput spike after episode 15, when the agent stops exploring and starts using its knowledge. The ups and downs are normal because each episode uses an old layout, with different users. Some are easy and some are hard. Loss hue increases at the beginning when the buffer starts filling with various experiences, then slowly decreases as the estimated queue value becomes more accurate. Done. We have written a deep queue network from scratch with ripley buffer,
epsilon greedy, target network, and double the QN, then trained the resource allocation agent. In the final episode, we evaluated it against all benchmark schedulers. Working on a thesis, dissertation, or research in the field of telecommunications and artificial intelligence? Cerdas Inovasi Digital helps implement cellular network research, from 5G simulators, channel models and SINR, proportional fair and waterfilling schedulers, up to deep reinforcement learning with PyTorch, as well as offering Python programming courses for electrical engineering and telecommunications. Want to master the entire series, from resource block concepts to QN agent energy efficiency evaluation? All 6 episodes, complete with PDF step-by-step guides and source code, are available to premium tutorial subscribers. Subscribe starting at Rp69.000 per month, save 28% with the 12-month package, or pay once Rp999.000 for lifetime access. Thank you for watching, see you in the next episode.
Type a question or keyword; we find the part of this episode that explains it and jump the video there.
Notes are saved with the current video time and are only visible to you.
Stuck on a step? Ask here; the instructor and other learners can answer.
No questions yet.

Cerdas Inovasi Digital Team
Software developers, BIM & 3D engineers, and AI practitioners
We build software, BIM models, games and AI automations for clients every day, and turn that hands-on work into step-by-step classes: every step is shown on screen and comes with a PDF guide you can keep.
See our clients →