Coder Social home page Coder Social logo

mtusman-ai / amazon-sagemaker-rl-action-masking Goto Github PK

View Code? Open in Web Editor NEW

This project forked from aws-samples/amazon-sagemaker-rl-action-masking

0.0 0.0 0.0 86 KB

Portfolio Management Model

License: MIT No Attribution

Shell 0.90% Python 94.29% Jupyter Notebook 4.81%

amazon-sagemaker-rl-action-masking's Introduction

Portfolio Optimization through Multidimensional Action Optimization using Amazon SageMaker RL

Introduction

The objective of a reinforcement learning (RL) problem is to train an agent that, given an observation from its environment, will choose the optimal action that maximizes cumulative reward. Solving a business problem with RL involves specifying the agent’s environment, the space of actions, the structure of observations and the right reward function for the target business outcome. An RL agent learns by exploring the state space and taking random actions. However, there are several scenarios where some of the actions may not be admissible depending on the state. In such cases, sampling the full action space will be inefficient. Action masking is an approach to avoid sampling inadmissible actions. Here we show how to perform action masking and train an RL agent using Amazon SageMaker RL and Ray RLlib. We consider a portfolio optimization problem that involves a three dimensional action vector and four constraints. Masking is implemented using a parametric action model from Ray RLlib and the agent is trained using proximal policy optimization (PPO) algorithm.

Getting Started

  1. Create a SageMaker Notebook Instance

Training an RL agent using this repository requires a SageMaker notebook instance. For details on how to create a notebook instance, see the aws documentation.

  1. Execute Training_Notebook.ipynb

Use this Jupyter notebook to execute the training steps in an interactive manner. The environment and masking model files that this notebook uses are located in the src folder

Verifying Masking

To verify that action masking is working as expected, i.e., blocking actions with mask=0, use Test_Notebook.ipynb file located in src folder.

Security

See CONTRIBUTING for more information.

License

This library is licensed under the MIT-0 License. See the LICENSE file.

amazon-sagemaker-rl-action-masking's People

Contributors

amazon-auto avatar dilshadraihan avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.