Showing posts with label Machine Learning. Show all posts
Showing posts with label Machine Learning. Show all posts

Friday, August 22, 2025

Masked Multihead Attention

I made a masked Multihead Attention mechanism for LLMs.

This is the code:


They are combined the context vectors in the last dimension each learning something different from the input x.





Thursday, July 11, 2024

MARL Multi Agent Reinforcement Learning

I made MARL (Multi Agent Reinforcement Learning) with DDPG (Deep Deterministic Policy Gradient). 

I made the DDPG with python and Pytorch. I used Unity Machine Learning Agents for the environment. 

This model can be used for robots that need to learn collaboration with continuous action spaces.

Two agents need to learn to interact with each other to play Tennis. They have to pass the ball over the Net and work collaboratively.


I made one DDPG with two Noises.

I solved the environment. This is the learning by episode Score Table:




If you want to look at the code:



Wednesday, July 10, 2024

DQN Deep Q Network for discrete Action Spaces

I trained a DQN (Deep Q Network) to collect yellow bananas and to avoid collecting blue bananas.

I made the DQN in python with pytorch. I used Unity Machine Learning Agents for the environment.



In Reinforcement Learning the Agent needs to interact with the environment to learn, in this case the Agent receives a Reward of +1 for collecting a Yellow Banana, and a reward of -1 for collecting a blue banana.

I solved the environment:



If you want to look at the code: