Posts

AI vs Machine Learning vs Deep Learning

  Introduction If you're starting in AI, one common confusion is: What’s the difference between AI, Machine Learning (ML), and Deep Learning (DL)? They are related but not the same.Simple idea: AI = Big concept ML = Subset of AI DL = Subset of ML Visual Relationship Think of it like: Artificial Intelligence (outer layer) Machine Learning (inside AI) Deep Learning (inside ML) What is Artificial Intelligence (AI)? Broad concept of machines performing human-like tasks Includes rule-based systems + learning systems Examples: Chatbots Expert systems Voice assistants AI does not always require learning What is Machine Learning (ML)? Subset of AI that enables systems to learn from data Improves performance over time Examples: Spam detection Recommendation systems Fraud detection ML requires data + training What is Deep Learning (DL)? Subset of ML using neural networks with multiple layers Handles complex tasks automatically Examp...

Machine Learning Basics

  What is Machine Learning? Machine Learning (ML) is a subset of Artificial Intelligence that allows systems to learn from data and improve automatically without being explicitly programmed . Simple definition: Machine Learning = Learning from data + Making predictions Example: Netflix recommends movies based on your watch history Email filters detect spam automatically How Machine Learning Works Machine Learning typically follows these steps: 1. Data Collection Gather data (images, text, numbers) 2. Data Preparation Clean and organize data 3. Model Training Use algorithms to learn patterns 4. Evaluation Check how accurate the model is 5. Prediction Use the model to make decisions  Types of Machine Learning     1. Supervised Learning Model learns from labeled data Input + Correct Output is provided      Example: Email → Spam / Not Spam House price prediction      Common algorithms: Linear...

Artificial Intelligence (AI)

  What is Artificial Intelligence? Artificial Intelligence (AI) refers to the ability of machines to simulate human intelligence — such as learning, reasoning, problem-solving, and decision-making. In simple terms: AI = Machines that can think and learn like humans Examples you already use daily: Voice assistants (Siri, Alexa) Chatbots (like ChatGPT) Recommendation systems (Netflix, YouTube) Google Maps navigation Brief History of AI 1950 – Alan Turing introduced the idea of machines that can think 1956 – The term “Artificial Intelligence” was officially coined 1980s – Rise of expert systems 2000s – Machine Learning gained popularity 2020s – Explosion of AI tools like ChatGPT and generative AI Today, AI is everywhere — from smartphones to self-driving cars. Types of Artificial Intelligence     1.  Narrow AI (Weak AI) Designed for a specific task Cannot perform beyond its programming Examples: Voice assistants Recommendation sy...

SQLAlchemy Questions & Answers

  1. What is SQLAlchemy? Answer: SQLAlchemy is a Python library used for interacting with databases. It provides: ORM (Object Relational Mapping) Core (SQL Expression Language) It allows developers to write Python code instead of raw SQL. 2. What is ORM? Answer: ORM (Object Relational Mapping) maps: Tables → Python classes Rows → Python objects Example: user = User ( name = "John" ) Instead of writing SQL: INSERT INTO users VALUES ( 'John' ); 3. What is an Engine? Answer: Entry point to the database Manages DB connections engine = create_engine ( "sqlite:///test.db" ) 4. What is a Session? Answer: A session is a workspace for DB operations Handles transactions and queries 5. Difference between flush() and commit() ? Answer: Feature                     flush()           commit() Saves to DB              ...

Async SQLAlchemy (Async Engine, Async Sessions, FastAPI Integration)

  Introduction Modern Python backends demand high performance and concurrency .That’s where Async SQLAlchemy comes in. With async: Handle multiple requests simultaneously Improve API performance Non-blocking database operations What is Async SQLAlchemy? Async SQLAlchemy allows you to: Use async/await syntax Run DB queries without blocking the server Integrate seamlessly with FastAPI Important Note Async SQLAlchemy is available from SQLAlchemy 1.4+ Step 1: Install Dependencies pip install sqlalchemy aiosqlite asyncpg For FastAPI: pip install fastapi uvicorn Project Structure app/ ├── main.py ├── database.py ├── models.py ├── schemas.py └── crud.py Step 2: Async Database Setup database.py from sqlalchemy . ext . asyncio import create_async_engine , AsyncSession from sqlalchemy . orm import sessionmaker , declarative_base DATABASE_URL = "sqlite+aiosqlite:///./test.db" engine = create_async_engine ( DATABASE_URL , echo = True ) AsyncSessio...