Akshay ๐Ÿš€ Profile picture
Jul 1, 2023 โ€ข 11 tweets โ€ข 4 min read โ€ข Read on X
Object oriented programming is essential for writing clean & modular code!

Let's clearly understand OOPs with Python! ๐Ÿš€

A Thread ๐Ÿงต๐Ÿ‘‡
We break it down to 6 important concepts:

- Object ๐Ÿš˜
- Class ๐Ÿ—๏ธ
- Inheritance ๐Ÿงฌ
- Encapsulation ๐Ÿ”
- Abstraction ๐ŸŽญ
- Polymorphism ๐ŸŒ€

Let's take them one-by-one... ๐Ÿš€
1๏ธโƒฃ Object ๐Ÿš˜

Just look around, everything you see can be treated as an object.

For instance a Car, Dog, your Laptop are all objects.

An Object can be defined using 2 things:

- Properties: that describe an object
- Behaviour: the functions that an object can perform

...๐Ÿ‘‡
For example, a Car is an object that has properties such as color & model, and behaviours such as accelerating, braking & turning.

But, how do we create these objectsโ“๐Ÿค”

This is where we need to understand Classes!

...๐Ÿ‘‡
2๏ธโƒฃ Class ๐Ÿ—๏ธ

A class is like a blueprint for creating objects.

It defines a set of properties & functions (methods) that will be common to all objects created from the class.

So, we start with a simple example & follow along!

Let's define a class Car & create it's Object๐Ÿ‘‡
3๏ธโƒฃ Inheritance ๐Ÿงฌ

Let's say we want to create an Electric car & don't want to define all the properties and methods of the basic Car class.

Inheritance helps us to inherit all the properties/methods of parent class & add new ones or override existing.

Check this out๐Ÿ‘‡
4๏ธโƒฃ Encapsulation ๐Ÿ”

Encapsulation helps to bundle data and methods inside a class, restricting direct access to certain attributes and methods.

We use private attributes/methods (with a `_` or `__` prefix) to achieve this.

Here's an example ๐Ÿ‘‡
5๏ธโƒฃ Abstraction ๐ŸŽญ

This concept focuses on exposing only essential information to the outside world while hiding implementation details.

We use abstract classes and methods to define a common interface.

Here's an example ๐Ÿ‘‡
At this point if Abstraction and Encapsulation confuse you! ๐Ÿ‘‡

Abstraction conceals the implementation details, but doesn't hide the data itself.

On the other hand, Encapsulation hides the data and restricts unwanted use from external sources.

Cheers! ๐Ÿฅ‚
6๏ธโƒฃ Polymorphism ๐ŸŒ€

This allows us to use a single interface for different data types or classes.

We can achieve this through method overriding, where a subclass provides a different implementation for a method defined in its parent class.

Let's understand with an example ๐Ÿ‘‡
That's a wrap!

If you interested in:

- Python ๐Ÿ
- Data Science ๐Ÿ“ˆ
- Machine Learning ๐Ÿค–
- Maths for ML ๐Ÿงฎ
- MLOps ๐Ÿ› 
- CV/NLP ๐Ÿ—ฃ
- LLMs ๐Ÿง 

I'm sharing daily content over here, follow me โ†’ @akshay_pachaar if you haven't already!

Newletter:

Cheers! ๐Ÿฅ‚mlspring.beehiiv.com

โ€ข โ€ข โ€ข

Missing some Tweet in this thread? You can try to force a refresh
ใ€€

Keep Current with Akshay ๐Ÿš€

Akshay ๐Ÿš€ Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @akshay_pachaar

Feb 1
Let's compare OpenAI o3-mini and DeepSeek-R1 using RAG:
OpenAI just dropped o3-mini in response to DeepSeek-R1!

Today, we build a Streamlit app to compare and evaluate them using RAG.

Tech stack:

- @Llama_Index for orchestration
- @Cometml Opik for evaluation
- @Streamlit for the UI

Let's go! ๐Ÿš€
The architecture presented below illustrates some of the key components & how they interact with each other!

For those who are new, I've provided detailed descriptions & code for each component. Image
Read 11 tweets
Jan 30
Let's build a text-to-image generation and understanding app, using DeepSeek-Janus (100% local):
Before we start, here's a quick demo of what this app does!

It's a 2-in-1:

Tech stack:
- @Deepseek_AI's Janus-pro as LLM
- @Streamlit for UI

1๏ธโƒฃ Text-to-image generation demo:
2๏ธโƒฃ Multimodal chat and image understanding demo

User uploads an image and ask questions about it:
Read 14 tweets
Jan 27
Let's build a browser-use agent, similar to OpenAI operator, but utilizing open-source tools:
Simply put, browser use is making agents use websites just like us.

Before we start, here's a quick demo of what we're building!

Tech stack:

- @Gradio for the UI
- @browser_use to create the agent
- @Google's latest gemini-2.0-flash-exp as LLM

Let's go! ๐Ÿš€
0๏ธโƒฃ Installation and Setup

Install dependencies and setup the required env vars. Image
Read 9 tweets
Jan 26
Let's compare DeepSeek-R1 and OpenAI-o1 using RAG:
DeepSeek-R1 delivers OpenAI-o1 level intelligence at 90% less cost.

Today, we build a Streamlit app to compare and evaluate them using RAG.

Tech stack:

- @Llama_Index for orchestration
- @Cometml Opik for evaluation
- @Streamlit for the UI

Let's go! ๐Ÿš€
The architecture presented below illustrates some of the key components & how they interact with each other!

For those who are new, I've provided detailed descriptions & code for each component. Image
Read 12 tweets
Jan 23
Let's build a multi-agent YouTube video analyst, powered by DeepSeek-R1 (100% local):
This app can scrape videos from the multiple YouTube channels and report trends & insights.

Tech stack:

- @crewAIInc for multi-agent orchestration.
- Bright Data for reliable web-scraping at scale.
- @Streamlit for the UI.

Here's a quick demo of what we're building:
Before we start coding, I have provided a simplified architecture diagram that highlights all the key components and their interactions.

This will be followed by detailed descriptions and code for each component:
Read 14 tweets
Jan 22
Let's build an Agentic RAG app using DeepSeek-R1 (100% local):
DeepSeek-R1 delivers OpenAI-o1 level intelligence at 90% less cost.

This agentic app searches your docs and falls back on web search if needed.

In the video, I test it for both types of queries.

Tech stack:

- @CrewAIInc for agent orchestration
- @firecrawl_dev for web search
The architecture diagram presented below illustrates some of the key components & how they interact with each other!

It will be followed by detailed descriptions & code for each component: Image
Read 11 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Don't want to be a Premium member but still want to support us?

Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us!

:(