Posts

Showing posts from December, 2024

Evolution of Large Language Models / ChatGPT (From the cell to the superbrain)

  Evolution of Large Language Models Large language models have undergone significant evolution over the years. This document will explore the journey from the early Perceptron to modern Large Language Models (LLMs) like transformers. Each stage has contributed to building the next stage, leading to advanced capabilities in natural language processing (NLP). 1. Perceptron Introduction: The Perceptron is the simplest form of a neural network and was introduced in 1958. Concept: It consists of a single layer of neurons (nodes) with adjustable weights and a bias. It can classify input data into one of two categories. Technical Building Blocks: Input Layer: Receives input features (X1, X2, ..., Xn). Weighted Sum: Each input is multiplied by a corresponding weight and summed up along with a bias term. Activation Function: A function (e.g., step function) that determines the output based on the weighted sum. +------------------...

Loops for Beginners (with python code)

  Understanding Loops in Python Loops are a fundamental concept in programming that allow us to repeat a block of code multiple times. They are useful for tasks that involve repetitive actions. 1. Main Points About Loops For Loop: Used to iterate over a sequence (such as a list, tuple, dictionary, set, or string) and execute a block of code for each item in the sequence. While Loop: Repeats a block of code as long as a specified condition is true. Break Statement: Exits the loop prematurely if a certain condition is met. Continue Statement: Skips the current iteration and moves to the next iteration of the loop. 2. Creating a Math Table Using a Simple For Loop Let's create a simple math table using a for loop in Python. This example will print the multiplication table for the number 5. Python Code # Multiplication table for number 5 num = 5 for i in range(1, 11): print(num * i) Output ...

Recursion for Beginners (with python code)

Understanding Recursion Recursion is a programming technique where a function calls itself in order to solve a problem. Recursive functions typically have a base case and a recursive case. 1. What is Recursion? Recursion is when a function calls itself to solve smaller instances of the same problem. Recursion can be used to break down complex problems into simpler, more manageable parts. +-----------------------------+ | Start | | +---------------------+ | | Recursive Function | | +---------------------+ | | Calls Itself | | +---------------------+ | | Base Case (Stops) | | +---------------------+ | End | +-----------------------------+ 2. When and Where to Use Recursion Use Recursion when: The problem can be divided into smaller, similar problems. You need a cleaner and more intuitive solution for problems like tree traversals, sor...

Joins in SQL for Beginners (with sql query)

 SQL joins are powerful tools that allow you to combine data from multiple tables, providing a more comprehensive view of the data. Let's explore different types of joins using two sample tables and see how each join works. 1. Introduction to Joins Joins in SQL are used to combine rows from two or more tables based on a related column. Joins augment data by providing additional information from another table. 2. Sample Tables Let's consider two tables: Employees and Departments . Employees Table : EmployeeID -EmployeeName -DepartmentID 1 Alice 101 2 Bob 102 3 Charlie 103 4 David NULL Departments Table : DepartmentID DepartmentName 101 HR 102 IT 104 Finance 3. Types of Joins 3.1. Inner Join An Inner Join returns only the rows where there is a match in both tables. Query : sql SELECT Employees.EmployeeID, Employees.EmployeeName, Departments.DepartmentName FROM Employees INNER JOIN Departments ON Employees.DepartmentID = Departments.DepartmentID; Output : EmployeeID -Empl...

Depth First Search (DFS) and Breadth First Search (BFS) for Beginners (with python code)

 Understanding Depth First Search (DFS) and Breadth First Search (BFS) is fundamental in computer science, especially in the context of graph traversal and pathfinding algorithms. Let's dive into these concepts in a structured manner. 1. Introduction Depth First Search (DFS) and Breadth First Search (BFS) are two fundamental algorithms used to traverse or search through graphs and tree data structures. These algorithms can be applied to a wide range of problems, such as pathfinding, cycle detection, and network analysis. 2. Depth First Search (DFS) 2.1. How DFS Works DFS explores as far as possible along each branch before backtracking. It uses a stack data structure to keep track of nodes to be visited. 2.2. Python Code for DFS # Depth First Search in Python def dfs ( graph, start, visited=None ): if visited is None : visited = set () visited.add(start) print (start, end= ' ' ) for neighbor in graph[start]: if neighbor not in vi...