The Hundred-Page Language Models Book
Read it:
https://github.com/aburkov/theLMbook
Read it:
https://github.com/aburkov/theLMbook
#LLM #NLP #ML #AI #PYTHON #PYTORCH
https://xn--r1a.website/DataScienceM
đ8
Media is too big
VIEW IN TELEGRAM
The program covers topics of #NLP, #CV, #LLM and the use of technology in medicine, offering a full cycle of training - from theory to practical classes using current versions of libraries.
The course is designed even for beginners: if you know how to take derivatives and multiply matrices, everything else will be explained in the process.
The lectures are released for free on YouTube and the #MIT platform on Mondays, with the first one already available
.
All slides, #code and additional materials can be found at the link provided.
đ Fresh lecture : https://youtu.be/alfdI7S6wCY?si=6682DD2LlFwmghew
#DataAnalytics #Python #SQL #RProgramming #DataScience #MachineLearning #DeepLearning #Statistics #DataVisualization #PowerBI #Tableau #LinearRegression #Probability #DataWrangling #Excel #AI #ArtificialIntelligence #BigData #DataAnalysis #NeuralNetworks #GAN #LearnDataScience #LLM #RAG #Mathematics #PythonProgramming #Keras
https://xn--r1a.website/CodeProgrammerâ
Please open Telegram to view this post
VIEW IN TELEGRAM
đ12đ3đĨ2đ¯2đ2
Foundations of Large Language Models
Download it: https://readwise-assets.s3.amazonaws.com/media/wisereads/articles/foundations-of-large-language-/2501.09223v1.pdf
#LLM #AIresearch #DeepLearning #NLP #FoundationModels #MachineLearning #LanguageModels #ArtificialIntelligence #NeuralNetworks #AIPaper
Download it: https://readwise-assets.s3.amazonaws.com/media/wisereads/articles/foundations-of-large-language-/2501.09223v1.pdf
#LLM #AIresearch #DeepLearning #NLP #FoundationModels #MachineLearning #LanguageModels #ArtificialIntelligence #NeuralNetworks #AIPaper
đ9đĨ3đ¯1
Dive deep into the world of Transformers with this comprehensive PyTorch implementation guide. Whether you're a seasoned ML engineer or just starting out, this resource breaks down the complexities of the Transformer model, inspired by the groundbreaking paper "Attention Is All You Need".
https://www.k-a.in/pyt-transformer.html
This guide offers:
By following along, you'll gain a solid understanding of how Transformers work and how to implement them from scratch.
#MachineLearning #DeepLearning #PyTorch #Transformer #AI #NLP #AttentionIsAllYouNeed #Coding #DataScience #NeuralNetworksīģŋ
Please open Telegram to view this post
VIEW IN TELEGRAM
đ4
Four best-advanced university courses on NLP & LLM to advance your skills:
1. Advanced NLP -- Carnegie Mellon University
Link: https://lnkd.in/ddEtMghr
2. Recent Advances on Foundation Models -- University of Waterloo
Link: https://lnkd.in/dbdpUV9v
3. Large Language Model Agents -- University of California, Berkeley
Link: https://lnkd.in/d-MdSM8Y
4. Advanced LLM Agent -- University Berkeley
Link: https://lnkd.in/dvCD4HR4
#LLM #python #AI #Agents #RAG #NLP
đ¯ BEST DATA SCIENCE CHANNELS ON TELEGRAM đ
1. Advanced NLP -- Carnegie Mellon University
Link: https://lnkd.in/ddEtMghr
2. Recent Advances on Foundation Models -- University of Waterloo
Link: https://lnkd.in/dbdpUV9v
3. Large Language Model Agents -- University of California, Berkeley
Link: https://lnkd.in/d-MdSM8Y
4. Advanced LLM Agent -- University Berkeley
Link: https://lnkd.in/dvCD4HR4
#LLM #python #AI #Agents #RAG #NLP
Please open Telegram to view this post
VIEW IN TELEGRAM
đ11â¤3
Full PyTorch Implementation of Transformer-XL
If you're looking to understand and experiment with Transformer-XL using PyTorch, this resource provides a clean and complete implementation. Transformer-XL is a powerful model that extends the Transformer architecture with recurrence, enabling learning dependencies beyond fixed-length segments.
The implementation is ideal for researchers, students, and developers aiming to dive deeper into advanced language modeling techniques.
Explore the code and start building:
https://www.k-a.in/pyt-transformerXL.html
#TransformerXL #PyTorch #DeepLearning #NLP #LanguageModeling #AI #MachineLearning #OpenSource #ResearchTools
https://xn--r1a.website/CodeProgrammer
If you're looking to understand and experiment with Transformer-XL using PyTorch, this resource provides a clean and complete implementation. Transformer-XL is a powerful model that extends the Transformer architecture with recurrence, enabling learning dependencies beyond fixed-length segments.
The implementation is ideal for researchers, students, and developers aiming to dive deeper into advanced language modeling techniques.
Explore the code and start building:
https://www.k-a.in/pyt-transformerXL.html
#TransformerXL #PyTorch #DeepLearning #NLP #LanguageModeling #AI #MachineLearning #OpenSource #ResearchTools
https://xn--r1a.website/CodeProgrammer
đ7â¤1
This media is not supported in your browser
VIEW IN TELEGRAM
A new interactive sentiment visualization project has been developed, featuring a dynamic smiley face that reflects sentiment analysis results in real time. Using a natural language processing model, the system evaluates input text and adjusts the smiley face expression accordingly:
đ Positive sentiment
âšī¸ Negative sentiment
The visualization offers an intuitive and engaging way to observe sentiment dynamics as they happen.
đ GitHub: https://lnkd.in/e_gk3hfe
đ° Article: https://lnkd.in/e_baNJd2
#AI #SentimentAnalysis #DataVisualization #InteractiveDesign #NLP #MachineLearning #Python #GitHubProjects #TowardsDataScience
đ Our Telegram channels: https://xn--r1a.website/addlist/0f6vfFbEMdAwODBk
đą Our WhatsApp channel: https://whatsapp.com/channel/0029VaC7Weq29753hpcggW2A
The visualization offers an intuitive and engaging way to observe sentiment dynamics as they happen.
#AI #SentimentAnalysis #DataVisualization #InteractiveDesign #NLP #MachineLearning #Python #GitHubProjects #TowardsDataScience
Please open Telegram to view this post
VIEW IN TELEGRAM
đ7đ3
Python Cheat Sheet
âĄī¸ Our Telegram channels: https://xn--r1a.website/addlist/0f6vfFbEMdAwODBk
đą Our WhatsApp channel: https://whatsapp.com/channel/0029VaC7Weq29753hpcggW2A
#AI #SentimentAnalysis #DataVisualization #pandas #Numpy #InteractiveDesign #NLP #MachineLearning #Python #GitHubProjects #TowardsDataScience
Please open Telegram to view this post
VIEW IN TELEGRAM
đ4â¤3
Anyone trying to deeply understand Large Language Models.
Checkout
by Tong Xiao & Jingbo Zhu. Itâs one of the clearest, most comprehensive resource.
âī¸ Paper Link: arxiv.org/pdf/2501.09223
īģŋ
Checkout
Foundations of Large Language Models
by Tong Xiao & Jingbo Zhu. Itâs one of the clearest, most comprehensive resource.
#LLMs #LargeLanguageModels #AIResearch #DeepLearning #MachineLearning #AIResources #NLP #AITheory #FoundationModels #AIUnderstanding
īģŋ
âī¸ Our Telegram channels: https://xn--r1a.website/addlist/0f6vfFbEMdAwODBkđą Our WhatsApp channel: https://whatsapp.com/channel/0029VaC7Weq29753hpcggW2A
Please open Telegram to view this post
VIEW IN TELEGRAM
â¤14
Self-attention in LLMs, clearly explained
#SelfAttention #LLMs #Transformers #NLP #DeepLearning #MachineLearning #AIExplained #AttentionMechanism #AIConcepts #AIEducation
âī¸ Our Telegram channels: https://xn--r1a.website/addlist/0f6vfFbEMdAwODBkđą Our WhatsApp channel: https://whatsapp.com/channel/0029VaC7Weq29753hpcggW2A
Please open Telegram to view this post
VIEW IN TELEGRAM
â¤8đ¯3đ¨âđģ1
rnn.pdf
5.6 MB
đ Understanding Recurrent Neural Networks (RNNs) Cheat Sheet!
Recurrent Neural Networks are a powerful type of neural network designed to handle sequential data. They are widely used in applications like natural language processing, speech recognition, and time-series prediction. Here's a quick cheat sheet to get you started:
đ Key Concepts:
Sequential Data: RNNs are designed to process sequences of data, making them ideal for tasks where order matters.
Hidden State: Maintains information from previous inputs, enabling memory across time steps.
Backpropagation Through Time (BPTT): The method used to train RNNs by unrolling the network through time.
đ§ Common Variants:
Long Short-Term Memory (LSTM): Addresses vanishing gradient problems with gates to manage information flow.
Gated Recurrent Unit (GRU): Similar to LSTMs but with a simpler architecture.
đ Applications:
Language Modeling: Predicting the next word in a sentence.
Sentiment Analysis: Understanding sentiments in text.
Time-Series Forecasting: Predicting future data points in a series.
đ Resources:
Dive deeper with tutorials on platforms like Coursera, edX, or YouTube.
Explore open-source libraries like TensorFlow or PyTorch for implementation.
Let's harness the power of RNNs to innovate and solve complex problems!đĄ
Recurrent Neural Networks are a powerful type of neural network designed to handle sequential data. They are widely used in applications like natural language processing, speech recognition, and time-series prediction. Here's a quick cheat sheet to get you started:
đ Key Concepts:
Sequential Data: RNNs are designed to process sequences of data, making them ideal for tasks where order matters.
Hidden State: Maintains information from previous inputs, enabling memory across time steps.
Backpropagation Through Time (BPTT): The method used to train RNNs by unrolling the network through time.
đ§ Common Variants:
Long Short-Term Memory (LSTM): Addresses vanishing gradient problems with gates to manage information flow.
Gated Recurrent Unit (GRU): Similar to LSTMs but with a simpler architecture.
đ Applications:
Language Modeling: Predicting the next word in a sentence.
Sentiment Analysis: Understanding sentiments in text.
Time-Series Forecasting: Predicting future data points in a series.
đ Resources:
Dive deeper with tutorials on platforms like Coursera, edX, or YouTube.
Explore open-source libraries like TensorFlow or PyTorch for implementation.
Let's harness the power of RNNs to innovate and solve complex problems!
#RNN #RecurrentNeuralNetworks #DeepLearning #NLP #LSTM #GRU #TimeSeriesForecasting #MachineLearning #NeuralNetworks #AIApplications #SequenceModeling #MLCheatSheet #PyTorch #TensorFlow #DataScience
âī¸ Our Telegram channels: https://xn--r1a.website/addlist/0f6vfFbEMdAwODBkđą Our WhatsApp channel: https://whatsapp.com/channel/0029VaC7Weq29753hpcggW2A
Please open Telegram to view this post
VIEW IN TELEGRAM
â¤13đ3
A curated collection of Kaggle notebooks showcasing how to build end-to-end AI applications using Hugging Face pretrained models, covering text, speech, image, and vision-language tasks â full tutorials and code available on GitHub:
1ī¸âŖ Text-Based Applications
1.1. Building a Chatbot Using HuggingFace Open Source Models
https://lnkd.in/dku3bigK
1.2. Building a Text Translation System using Meta NLLB Open-Source Model
https://lnkd.in/dgdjaFds
2ī¸âŖ Speech-Based Applications
2.1. Zero-Shot Audio Classification Using HuggingFace CLAP Open-Source Model
https://lnkd.in/dbgQgDyn
2.2. Building & Deploying a Speech Recognition System Using the Whisper Model & Gradio
https://lnkd.in/dcbp-8fN
2.3. Building Text-to-Speech Systems Using VITS & ArTST Models
https://lnkd.in/dwFcQ_X5
3ī¸âŖ Image-Based Applications
3.1. Step-by-Step Guide to Zero-Shot Image Classification using CLIP Model
https://lnkd.in/dnk6epGB
3.2. Building an Object Detection Assistant Application: A Step-by-Step Guide
https://lnkd.in/d573SvYV
3.3. Zero-Shot Image Segmentation using Segment Anything Model (SAM)
https://lnkd.in/dFavEdHS
3.4. Building Zero-Shot Depth Estimation Application Using DPT Model & Gradio
https://lnkd.in/d9jjJu_g
4ī¸âŖ Vision Language Applications
4.1. Building a Visual Question Answering System Using Hugging Face Open-Source Models
https://lnkd.in/dHNFaHFV
4.2. Building an Image Captioning System using Salesforce Blip Model
https://lnkd.in/dh36iDn9
4.3. Building an Image-to-Text Matching System Using Hugging Face Open-Source Models
https://lnkd.in/d7fsJEAF
âĄī¸ You can find the articles and the codes for each article in this GitHub repo:
https://lnkd.in/dG5jfBwE
1ī¸âŖ Text-Based Applications
1.1. Building a Chatbot Using HuggingFace Open Source Models
https://lnkd.in/dku3bigK
1.2. Building a Text Translation System using Meta NLLB Open-Source Model
https://lnkd.in/dgdjaFds
2ī¸âŖ Speech-Based Applications
2.1. Zero-Shot Audio Classification Using HuggingFace CLAP Open-Source Model
https://lnkd.in/dbgQgDyn
2.2. Building & Deploying a Speech Recognition System Using the Whisper Model & Gradio
https://lnkd.in/dcbp-8fN
2.3. Building Text-to-Speech Systems Using VITS & ArTST Models
https://lnkd.in/dwFcQ_X5
3ī¸âŖ Image-Based Applications
3.1. Step-by-Step Guide to Zero-Shot Image Classification using CLIP Model
https://lnkd.in/dnk6epGB
3.2. Building an Object Detection Assistant Application: A Step-by-Step Guide
https://lnkd.in/d573SvYV
3.3. Zero-Shot Image Segmentation using Segment Anything Model (SAM)
https://lnkd.in/dFavEdHS
3.4. Building Zero-Shot Depth Estimation Application Using DPT Model & Gradio
https://lnkd.in/d9jjJu_g
4ī¸âŖ Vision Language Applications
4.1. Building a Visual Question Answering System Using Hugging Face Open-Source Models
https://lnkd.in/dHNFaHFV
4.2. Building an Image Captioning System using Salesforce Blip Model
https://lnkd.in/dh36iDn9
4.3. Building an Image-to-Text Matching System Using Hugging Face Open-Source Models
https://lnkd.in/d7fsJEAF
âĄī¸ You can find the articles and the codes for each article in this GitHub repo:
https://lnkd.in/dG5jfBwE
#HuggingFace #Kaggle #AIapplications #DeepLearning #MachineLearning #ComputerVision #NLP #SpeechRecognition #TextToSpeech #ImageProcessing #OpenSourceAI #ZeroShotLearning #Gradio
âī¸ Our Telegram channels: https://xn--r1a.website/addlist/0f6vfFbEMdAwODBkđą Our WhatsApp channel: https://whatsapp.com/channel/0029VaC7Weq29753hpcggW2A
Please open Telegram to view this post
VIEW IN TELEGRAM
â¤17đ¯1
LLM Interview Questions.pdf
71.2 KB
Top 50 LLM Interview Questions!
#LLM #AIInterviews #MachineLearning #DeepLearning #NLP #LLMInterviewPrep #ModelArchitectures #AITheory #TechInterviews #MLBasics #InterviewQuestions #LargeLanguageModels
âī¸ Our Telegram channels: https://xn--r1a.website/addlist/0f6vfFbEMdAwODBkđą Our WhatsApp channel: https://whatsapp.com/channel/0029VaC7Weq29753hpcggW2A
Please open Telegram to view this post
VIEW IN TELEGRAM
â¤7đĨ4đ2
Introduction to Deep Learning.pdf
10.5 MB
Introduction to Deep Learning
As we continue to push the boundaries of what's possible with artificial intelligence, I wanted to take a moment to share some insights on one of the most exciting fields in AI: Deep Learning.
Deep Learning is a subset of machine learning that uses neural networks to analyze and interpret data. These neural networks are designed to mimic the human brain, with layers of interconnected nodes (neurons) that process and transmit information.
What makes Deep Learning so powerful?
Ability to learn from large datasets: Deep Learning algorithms can learn from vast amounts of data, including images, speech, and text.
Improved accuracy: Deep Learning models can achieve state-of-the-art performance in tasks such as image recognition, natural language processing, and speech recognition.
Ability to generalize: Deep Learning models can generalize well to new, unseen data, making them highly effective in real-world applications.
Real-world applications of Deep Learning
Computer Vision: Self-driving cars, facial recognition, object detection
Natural Language Processing: Language translation, text summarization, sentiment analysis
Speech Recognition: Virtual assistants, voice-controlled devices.
#DeepLearning #AI #MachineLearning #NeuralNetworks #ArtificialIntelligence #DataScience #ComputerVision #NLP #SpeechRecognition #TechInnovation
As we continue to push the boundaries of what's possible with artificial intelligence, I wanted to take a moment to share some insights on one of the most exciting fields in AI: Deep Learning.
Deep Learning is a subset of machine learning that uses neural networks to analyze and interpret data. These neural networks are designed to mimic the human brain, with layers of interconnected nodes (neurons) that process and transmit information.
What makes Deep Learning so powerful?
Ability to learn from large datasets: Deep Learning algorithms can learn from vast amounts of data, including images, speech, and text.
Improved accuracy: Deep Learning models can achieve state-of-the-art performance in tasks such as image recognition, natural language processing, and speech recognition.
Ability to generalize: Deep Learning models can generalize well to new, unseen data, making them highly effective in real-world applications.
Real-world applications of Deep Learning
Computer Vision: Self-driving cars, facial recognition, object detection
Natural Language Processing: Language translation, text summarization, sentiment analysis
Speech Recognition: Virtual assistants, voice-controlled devices.
#DeepLearning #AI #MachineLearning #NeuralNetworks #ArtificialIntelligence #DataScience #ComputerVision #NLP #SpeechRecognition #TechInnovation
âī¸ Our Telegram channels: https://xn--r1a.website/addlist/0f6vfFbEMdAwODBkđą Our WhatsApp channel: https://whatsapp.com/channel/0029VaC7Weq29753hpcggW2A
Please open Telegram to view this post
VIEW IN TELEGRAM
â¤11
Forwarded from Github Top Repositories
đĨ Trending Repository: awesome-transformer-nlp
đ Description: A curated list of NLP resources focused on Transformer networks, attention mechanism, GPT, BERT, ChatGPT, LLMs, and transfer learning.
đ Repository URL: https://github.com/cedrickchee/awesome-transformer-nlp
đ Readme: https://github.com/cedrickchee/awesome-transformer-nlp#readme
đ Statistics:
đ Stars: 1.1K stars
đ Watchers: 41
đ´ Forks: 131 forks
đģ Programming Languages: Not available
đˇī¸ Related Topics:
==================================
đ§ By: https://xn--r1a.website/DataScienceM
đ Description: A curated list of NLP resources focused on Transformer networks, attention mechanism, GPT, BERT, ChatGPT, LLMs, and transfer learning.
đ Repository URL: https://github.com/cedrickchee/awesome-transformer-nlp
đ Readme: https://github.com/cedrickchee/awesome-transformer-nlp#readme
đ Statistics:
đ Stars: 1.1K stars
đ Watchers: 41
đ´ Forks: 131 forks
đģ Programming Languages: Not available
đˇī¸ Related Topics:
#nlp #natural_language_processing #awesome #transformer #neural_networks #awesome_list #llama #transfer_learning #language_model #attention_mechanism #bert #gpt_2 #xlnet #pre_trained_language_models #gpt_3 #gpt_4 #chatgpt
==================================
đ§ By: https://xn--r1a.website/DataScienceM
â¤4đĨ1đ¯1
Forwarded from Github Top Repositories
đĨ Trending Repository: awesome-deeplearning-resources
đ Description: Deep Learning and deep reinforcement learning research papers and some codes
đ Repository URL: https://github.com/endymecy/awesome-deeplearning-resources
đ Readme: https://github.com/endymecy/awesome-deeplearning-resources#readme
đ Statistics:
đ Stars: 2.9K stars
đ Watchers: 221
đ´ Forks: 666 forks
đģ Programming Languages: Not available
đˇī¸ Related Topics:
==================================
đ§ By: https://xn--r1a.website/DataScienceN
đ Description: Deep Learning and deep reinforcement learning research papers and some codes
đ Repository URL: https://github.com/endymecy/awesome-deeplearning-resources
đ Readme: https://github.com/endymecy/awesome-deeplearning-resources#readme
đ Statistics:
đ Stars: 2.9K stars
đ Watchers: 221
đ´ Forks: 666 forks
đģ Programming Languages: Not available
đˇī¸ Related Topics:
#nlp #video #reinforcement_learning #deep_learning #neural_network #code #paper #corpus #modelzoo
==================================
đ§ By: https://xn--r1a.website/DataScienceN
â¤2
Forwarded from Github Top Repositories
đĨ Trending Repository: best-of-ml-python
đ Description: đ A ranked list of awesome machine learning Python libraries. Updated weekly.
đ Repository URL: https://github.com/lukasmasuch/best-of-ml-python
đ Website: https://ml-python.best-of.org
đ Readme: https://github.com/lukasmasuch/best-of-ml-python#readme
đ Statistics:
đ Stars: 22.3K stars
đ Watchers: 444
đ´ Forks: 3K forks
đģ Programming Languages: Not available
đˇī¸ Related Topics:
==================================
đ§ By: https://xn--r1a.website/DataScienceM
đ Description: đ A ranked list of awesome machine learning Python libraries. Updated weekly.
đ Repository URL: https://github.com/lukasmasuch/best-of-ml-python
đ Website: https://ml-python.best-of.org
đ Readme: https://github.com/lukasmasuch/best-of-ml-python#readme
đ Statistics:
đ Stars: 22.3K stars
đ Watchers: 444
đ´ Forks: 3K forks
đģ Programming Languages: Not available
đˇī¸ Related Topics:
#python #nlp #data_science #machine_learning #deep_learning #tensorflow #scikit_learn #keras #ml #data_visualization #pytorch #transformer #data_analysis #gpt #automl #jax #data_visualizations #gpt_3 #chatgpt
==================================
đ§ By: https://xn--r1a.website/DataScienceM
â¤8
#NLP #Lesson #SentimentAnalysis #MachineLearning
Building an NLP Model from Scratch: Sentiment Analysis
This lesson will guide you through creating a complete Natural Language Processing (NLP) project. We will build a sentiment analysis classifier that can determine if a piece of text is positive or negative.
---
Step 1: Setup and Data Preparation
First, we need to import the necessary libraries and prepare our dataset. For simplicity, we'll use a small, hard-coded list of sentences. In a real-world project, you would load this data from a file (e.g., a CSV).
#Python #DataPreparation
---
Step 2: Text Preprocessing
Computers don't understand words, so we must clean and process our text data first. This involves making text lowercase, removing punctuation, and filtering out common "stop words" (like 'the', 'a', 'is') that don't add much meaning.
#TextPreprocessing #DataCleaning
---
Step 3: Splitting the Data
We must split our data into a training set (to teach the model) and a testing set (to evaluate its performance on unseen data).
#MachineLearning #TrainTestSplit
---
Step 4: Feature Extraction (Vectorization)
We need to convert our cleaned text into a numerical format. We'll use TF-IDF (Term Frequency-Inverse Document Frequency). This technique converts text into vectors of numbers, giving more weight to words that are important to a document but not common across all documents.
#FeatureEngineering #TFIDF #Vectorization
Building an NLP Model from Scratch: Sentiment Analysis
This lesson will guide you through creating a complete Natural Language Processing (NLP) project. We will build a sentiment analysis classifier that can determine if a piece of text is positive or negative.
---
Step 1: Setup and Data Preparation
First, we need to import the necessary libraries and prepare our dataset. For simplicity, we'll use a small, hard-coded list of sentences. In a real-world project, you would load this data from a file (e.g., a CSV).
#Python #DataPreparation
# Imports and Data
import re
from sklearn.model_selection import train_test_split
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.naive_bayes import MultinomialNB
from sklearn.metrics import accuracy_score, classification_report
import nltk
from nltk.corpus import stopwords
# You may need to download stopwords for the first time
# nltk.download('stopwords')
# Sample Data (In a real project, load this from a file)
texts = [
"I love this movie, it's fantastic!",
"This was a terrible film.",
"The acting was superb and the plot was great.",
"I would not recommend this to anyone.",
"It was an okay movie, not the best but enjoyable.",
"Absolutely brilliant, a must-see!",
"A complete waste of time and money.",
"The story was compelling and engaging."
]
# Labels: 1 for Positive, 0 for Negative
labels = [1, 0, 1, 0, 1, 1, 0, 1]
---
Step 2: Text Preprocessing
Computers don't understand words, so we must clean and process our text data first. This involves making text lowercase, removing punctuation, and filtering out common "stop words" (like 'the', 'a', 'is') that don't add much meaning.
#TextPreprocessing #DataCleaning
# Text Preprocessing Function
stop_words = set(stopwords.words('english'))
def preprocess_text(text):
# Make text lowercase
text = text.lower()
# Remove punctuation
text = re.sub(r'[^\w\s]', '', text)
# Tokenize and remove stopwords
tokens = text.split()
filtered_tokens = [word for word in tokens if word not in stop_words]
return " ".join(filtered_tokens)
# Apply preprocessing to our dataset
processed_texts = [preprocess_text(text) for text in texts]
print("--- Original vs. Processed ---")
for i in range(3):
print(f"Original: {texts[i]}")
print(f"Processed: {processed_texts[i]}\n")
---
Step 3: Splitting the Data
We must split our data into a training set (to teach the model) and a testing set (to evaluate its performance on unseen data).
#MachineLearning #TrainTestSplit
# Splitting data into training and testing sets
X_train, X_test, y_train, y_test = train_test_split(
processed_texts,
labels,
test_size=0.25, # Use 25% of data for testing
random_state=42 # for reproducibility
)
print(f"Training samples: {len(X_train)}")
print(f"Testing samples: {len(X_test)}")
---
Step 4: Feature Extraction (Vectorization)
We need to convert our cleaned text into a numerical format. We'll use TF-IDF (Term Frequency-Inverse Document Frequency). This technique converts text into vectors of numbers, giving more weight to words that are important to a document but not common across all documents.
#FeatureEngineering #TFIDF #Vectorization
â¤6