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

Dec 4
15 cheat sheets you shouldn't miss as a data scientist:
1. Pandas โ†” Polars โ†” SQL โ†” PySpark Translations.

Master data wrangling by understanding how these frameworks relate to one another. Here's your go-to translation guide for smooth transitions! Image
2. Strategies for Multi-GPU Training.

Training at scale? Learn these essential strategies to maximize efficiency and minimize training time.
Read 18 tweets
Dec 3
Let's build a real-time AI voice assistant, step-by-step:
Before we start, here's a quick demo of what we're building!

Tech stack:

- @AssemblyAI to convert speech to text in real-time.
- @OpenAI's GPT-4o to generate intelligent responses.
- @elevenlabsio to convert text responses back to speech.

Let's go! ๐Ÿš€
Logical flow of the app:

- The bot introduces itself.
- User speaks โ†’ transcribed by AssemblyAI.
- OpenAI generates a response.
- ElevenLabs verbalizes the response.
- Repeat!

We'll break down each component and provide code snippets for clarity. Image
Read 11 tweets
Nov 21
Let's build a multi-agent financial analyst using Microsoft's Autogen and Llama3-70B:
Before we start, here's a demo and walkthrough of what we're building today.

Tech stack:

- Microsoft's Autogen for multi-agent collaboration
- @Qualcomm's Cloud AI 100 ultra for serving Llama 3:70B

Let's go! ๐Ÿš€
Before we dive into coding, I've recorded a quick walkthrough of the playground to help you get everything you need to start!

Get your API keys and free playground access to run Llama 3.1-8B, 70B:
bit.ly/Qualcomm-Cloudโ€ฆ
Read 12 tweets
Nov 20
5 open-source agentic frameworks that will give you superpowers as an AI engineer:
1๏ธโƒฃ Dymamiq

@DynamiqAGI is like a Swiss army knife for AI Engineers, it supports:

- RAG applications.
- Multi agent orchestration
- And managing complex LLM workflows

Everything in one place!โœจ

GitHub repo: github.com/dynamiq-ai/dynโ€ฆ
2๏ธโƒฃ SwarmZero AI

@SwarmZeroAI provides you with an easy way to create and run AI Agents and Swarms of Agents.

- Completely hands off orchestration
- Seamless integration with your apps

GitHub Repo: github.com/swarmzero/swarโ€ฆ
Read 7 tweets
Nov 13
Let's build a PerplexityAI-like personal research assistant using multi-agent orchestration:
Before we dive in, let's see what we're about to create!

We'll use:

- @SwarmZeroAI for multi-agent orchestration
- @Serp_api for real-time search
- @FireCrawl_dev for LLM-ready web scraping

Let's go! ๐Ÿš€
Here's an architecture diagram showcasing the key components (agents/tools) and how they interact.

We'll break down each component and provide code snippets for clarity. Image
Read 12 tweets
Nov 12
How LLMs understand relative positions of input words, clearly explained:
RoPE (Rotary Positional Embeddings) revolutionised the way positional information is encoded in LLMs and it's widely used by models like Llama-3.

Today, I'll clearly explain what they are & how positional embeddings evolved over time.

Let's go! ๐Ÿš€ Image
Why Positional embeddingsโ“

Let's first understand the concept of positional embeddings and why they are essential in the first place.

Without positional embeddings a transformer doesn't understand the relative arrangement of words in a sentence. Image
Read 10 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!

:(