Logo Stefano Giannini
  • Home
  • About
  • Skills
  • Experiences
  • Education
  • Posts
  • Notes
Logo Inverted Logo
  • Posts
  • Finance
    • Monte Carlo
      • Option Pricing
    • Stock Prediction
      • GRU
      • ARIMA
      • SARIMA
      • SARIMAX
  • Machine Learning
    • Deep Learning
      • Computer Vision
        • Florence-2 LVM
      • NLP
        • Gemma-2 + RAG
  • Physics
    • Percolation
    • Quantum Computing
      • Introduction
      • Teleportation
Hero Image
Gemma-2 + RAG + LlamaIndex + VectorDB

Open in: 1. Introduction Retrieval-Augmented Generation (RAG) is an advanced AI technique that enhances large language models (LLMs) with the ability to access and utilize external knowledge. This guide will walk you through a practical implementation of RAG using Python and various libraries, explaining each component in detail. 2. Setup and Import %pip install transformers accelerate bitsandbytes flash-attn faiss-cpu llama-index -Uq %pip install llama-index-embeddings-huggingface -q %pip install llama-index-llms-huggingface -q %pip install llama-index-embeddings-instructor llama-index-vector-stores-faiss -q import contextlib import os import torch device = torch.

  • Deep Learning
  • NLP
  • Machine Learning
Sunday, July 14, 2024 | 14 minutes Read
Hero Image
SARIMAX Model Analysis of Apple Stock with Exogenous Variables

In the previous articles we saw the limitations of the ARIMA and SARIMA. Therefore, in this article we are going to implement a SARIMAX model the can include exogenous variables Introduction to Exogenous Variables in Time Series Models Exogenous variables, also known as external regressors, are independent variables that are not part of the main time series but can influence it. In the context of stock price prediction, exogenous variables might include:

  • Finance
  • Statistics
  • Forecasting
Saturday, July 6, 2024 | 7 minutes Read
Hero Image
Time Series Analysis and SARIMA Model for Stock Price Prediction

Introduction The Seasonal Autoregressive Integrated Moving Average (SARIMA) model is an extension of the ARIMA model (discussed in the previous article) that incorporates seasonality. This makes it particularly useful for analyzing financial time series data, which often exhibits both trend and seasonal patterns. In this article, we’ll apply the SARIMA model to Apple (AAPL) stock data, perform signal decomposition, and provide a detailed mathematical explanation of the model. 1. Data Preparation and Exploration First, let’s obtain the Apple stock data and prepare it for analysis:

  • Finance
  • Statistics
  • Forecasting
Thursday, July 4, 2024 | 6 minutes Read
Hero Image
Quantum Computing - Fundamentals - Teleportation

Introduction Quantum teleportation is a fundamental protocol in quantum information science that enables the transfer of quantum information from one location to another. Despite its name, it doesn’t involve the transportation of matter, but rather the transmission of the quantum state of a particle. The Concept In quantum teleportation, we have three main parties: Alice: The sender who wants to transmit a quantum state. Bob: The receiver who will receive the quantum state.

  • Science
  • Statistics
  • Quantum
  • Physics
Wednesday, July 3, 2024 | 7 minutes Read
Hero Image
Quantum Computing - Fundamentals (Part 1)

Introduction to Quantum Computing Quantum computing represents a transformative leap in computational technology. Unlike classical computers, which use bits as the smallest unit of data, quantum computers employ quantum bits, or qubits. These qubits take advantage of the principles of quantum mechanics, allowing for exponentially greater processing power in certain types of computations. Core Concepts: Superposition: Unlike classical bits that can be either 0 or 1, qubits can exist in a state that is a superposition of both.

  • Science
  • Statistics
  • Quantum
  • Physics
Sunday, June 30, 2024 | 7 minutes Read
Hero Image
Time Series Analysis and ARIMA Models for Stock Price Prediction

1. Introduction Time series analysis is a fundamental technique in quantitative finance, particularly for understanding and predicting stock price movements. Among the various time series models, ARIMA (Autoregressive Integrated Moving Average) models have gained popularity due to their flexibility and effectiveness in capturing complex patterns in financial data. This article will explore the application of time series analysis and ARIMA models to stock price prediction. We’ll cover the theoretical foundations, practical implementation in Python, and critical considerations for using these models in real-world financial scenarios.

  • Finance
  • Statistics
  • Forecasting
Friday, June 28, 2024 | 9 minutes Read
Hero Image
Florence-2 - Vision Foundation Model - Examples

Install dependencies Type the following command to install possible needed dependencies (especially if the inference is performed on the CPU) %pip install einops flash_attn In Kaggle, transformers and torch are already installed. Otherwise you also need to install them on your local PC. Import Libraries from transformers import AutoProcessor, AutoModelForCausalLM from PIL import Image import requests import copy import torch %matplotlib inline Import the model We can choose Florence-2-large or Florence-2-large-ft (fine-tuned).

  • Deep Learning
  • Computer Vision
  • Machine Learning
Tuesday, June 25, 2024 | 5 minutes Read
Hero Image
Monte Carlo Simulation for Option Pricing

1. Introduction In the dynamic world of finance, options play a crucial role in risk management, speculation, and portfolio optimization. An option is a contract that gives the holder the right, but not the obligation, to buy (call option) or sell (put option) an underlying asset at a predetermined price (strike price) within a specific time frame. The challenge lies in accurately pricing these financial instruments, given the uncertainties in market movements.

  • Finance
  • Options
  • Statistics
Sunday, June 23, 2024 | 6 minutes Read
Hero Image
MSFT Stock Prediction using LSTM or GRU

Introduction In this article, we will explore time series data extracted from the stock market, focusing on prominent technology companies such as Apple, Amazon, Google, and Microsoft. Our objective is to equip data analysts and scientists with the essential skills to effectively manipulate and interpret stock market data. To achieve this, we will utilize the yfinance library to fetch stock information and leverage visualization tools such as Seaborn and Matplotlib to illustrate various facets of the data.

  • Finance
  • Deep Learning
  • Forecasting
Sunday, June 16, 2024 | 6 minutes Read
Hero Image
Percolation

Introduction Percolation theory is a fundamental concept in statistical physics and mathematics that describes the behavior of connected clusters in a random graph. It is a model for understanding how a network behaves when nodes or links are added, leading to a phase transition from a state of disconnected clusters to a state where a large, connected cluster spans the system. This transition occurs at a critical threshold, known as the percolation threshold.

  • Science
  • Physics
  • Statistics
Saturday, June 8, 2024 | 5 minutes Read
Hero Image

https://aayala4.github.io/Lunar-Lander-Python/ https://github.com/arda-guler/miniLanding3D/tree/master https://medium.com/@elliottwobler/lunar-simulation-in-unreal-engine-5-c24f6ee59d07

    Monday, January 1, 1 | 1 minute Read

    Liability Notice: This website is done experimentally by me, taking inspiration from the open-source Toha-Hugo theme.


    Toha Theme Logo Toha
    © 2024 Copyright.
    Powered by Hugo Logo