Labs

Lab#ANN001: Building ANN recognizes numbers

Lab#GPT001: Python extractor

AI reads books: Page-by-Page PDF Knowledge Extractor & Summarizer

The read_books.py script performs an intelligent page-by-page analysis of PDF books, methodically extracting knowledge points and generating progressive summaries at specified intervals. It processes each page individually, allowing for detailed content understanding while maintaining the contextual flow of the book.

Lab#ANN002: Tensor for back propagation

A small auto-grad engine (inspired from Karpathy's micrograd and PyTorch) using Apple's MLX and Numpy. That’s why the name: smolgrad

It will help y’all understand the core concepts behind automatic differentiation and backpropagation. I mean, AI is literally powered by these things.

what is autograd?

Auto-grad, short for automatic differentiation, is a technique used in machine learning to efficiently compute gradients of complex functions. In the context of neural networks, autograd enables the computation of gradients with respect to the model’s parameters, which is crucial for training the network using optimization algorithms like gradient descent.

It works by constructing a computational graph that represents the flow of data through the network. Each node in the graph represents a mathematical operation, and the edges represent the flow of data between these operations. By tracking the operations and their dependencies, autograd can automatically compute the gradients using the chain rule of calculus.

An algorithm used in conjuction with autograd is Backpropagation to train neural networks. It is the process of propagating the gradients backward through the computational graph, from the output layer to the input layer, in order to update the model’s parameters. This is the stuff which makes ML/DL models “learn”.

Lab#RAG001: Hedge fund trading team

This lab outlines the creation of a hedge fund trading team using AI agents. The process involves setting up multiple specialized agents to handle different aspects of trading:

  1. A Market Data Agent to gather and process financial data
  2. A Quant Agent for developing trading strategies
  3. A Risk Management Agent to assess and mitigate risks
  4. A Portfolio Management Agent for overall fund management

These agents are then integrated into an Agent Graph, allowing them to collaborate and share information efficiently.

The lab also covers obtaining stock price data and generating trading signals, which are crucial for making informed investment decisions.

A key component of the lab is the creation of a Backtester. This tool allows the team to simulate and evaluate their trading strategies using historical data, providing valuable insights into potential performance without risking real capital.

The final step involves running the backtest to assess the effectiveness of the developed strategies and the overall performance of the AI-driven hedge fund team. This approach combines advanced AI techniques with traditional financial analysis, potentially offering a powerful new paradigm for hedge fund management.

Syllabus

  1. Setup
  2. Create Market Data Agent
  3. Create Quant Agent
  4. Create Risk Management Agent
  5. Create Portfolio Management Agent
  6. Create Agent Graph
  7. Get Stock Price and Trading Signals
  8. Create Backtester
  9. Run the Backtest

Citations

Lab#MAL001: How to structure your ML code

ML apps, like any other piece of software, can only generate business value once they are deployed and used in a production environment.

And the thing is, deploying all-in-one messy Jupyter notebooks from your local machine to a production environment is neither easy, nor recommended from an MLOps perspective.

Often a DevOps or MLOps senior colleague needs to re-write your all-in-on messy notebook, which adds excessive friction and frustration for you and the guy helping you.

So the question is:

Is there a better way to develop and package your ML code, so you ship faster and better?

Yes, there is

Lab#MAL002: How to structure your ML code

This is the first article in the series where we will build AI Agents from scratch without using any LLM orchestration frameworks. In this one you will learn:

  • What are agents?
  • How the Tool usage actually works.
  • How to build a decorator wrapper that extracts relevant details from a Python function to be passed to the LLM via system prompt.
  • How to think about constructing effective system prompts that can be used for Agents.
  • How to build an Agent class that is able to plan and execute actions using provided Tools.

You can find the code examples for this and following projects in this repo

Back to top