Machine Learning And AI
1.65K subscribers
198 photos
1 video
19 files
351 links
Hi All and Welcome Join our channel for Jobs,latest Programming Blogs, machine learning blogs.
In case any doubt regarding ML/Data Science please reach out to me @ved1104 subscribe my channel
https://youtube.com/@geekycodesin?si=JzJo3WS5E_VFmD1k
Download Telegram
GridSearchCV vs RandomizedSearchCV in Machine Learning: Differences, Advantages & Disadvantages of Each, and Use Cases

1. GridSearchCV
- Definition: GridSearchCV is an exhaustive search over specified parameter values for an estimator. It uses cross-validation to evaluate the performance of each combination of parameter values.

How it Works:
- Parameter Grid: Define a grid of parameters to search over.
- Exhaustive Search: Evaluate all possible combinations of parameters in the grid.
- Cross-Validation: For each combination, perform cross-validation to assess the model's performance.
- Best Parameters: Select the combination that results in the best performance based on a predefined metric (e.g., accuracy, F1-score).

2. RandomizedSearchCV
- Definition: RandomizedSearchCV performs a random search over specified parameter values for an estimator. It samples a fixed number of parameter settings from the specified distributions.

How it Works:
- Parameter Distributions: Define distributions from which to sample parameter values.
- Random Sampling: Randomly sample a fixed number of parameter combinations.
- Cross-Validation: For each sampled combination, perform cross-validation to assess the model's performance.
- Best Parameters: Select the combination that results in the best performance based on a predefined metric.

Advantages and Disadvantages
- GridSearchCV:
-- Advantages:
1. Exhaustive Search: Guarantees finding the optimal combination within the specified grid.
2. Deterministic: Always produces the same results for the same parameter grid and data.
-- Disadvantages:
1. Computationally Expensive: Evaluates all combinations, which can be very slow for large grids.
2. Scalability Issues: Not feasible for high-dimensional parameter spaces.

- RandomizedSearchCV:
-- Advantages:
1. Efficiency: Can be faster than GridSearchCV by evaluating a fixed number of parameter combinations.
2. Scalability: More feasible for high-dimensional parameter spaces.
3. Exploration: Can potentially find good parameter combinations that GridSearchCV might miss due to its limited grid.
-- Disadvantages:
1. Non-Exhaustive: May not find the optimal combination if the number of iterations is too low.
2. Randomness: Results can vary between runs unless a random seed is set.

Use Cases
- GridSearchCV:
1. Small Parameter Spaces: Suitable when the parameter grid is small and computational resources are sufficient.
2. High Precision: When the goal is to find the exact optimal parameters within the defined grid.
3. Limited Time Constraint: When there is enough time to perform an exhaustive search.
- RandomizedSearchCV:
1. Large Parameter Spaces: Suitable for larger and high-dimensional parameter spaces where an exhaustive search is impractical.
2. Time Efficiency: When there is a need to balance between time and performance, providing a good solution quickly.
3. Exploratory Analysis: Useful in the early stages of model tuning to quickly identify promising parameter regions.
Yesterday's Llama 3.1 release marked a big milestone for LLM researchers and practitioners. Llama 3.1 405B is the biggest and most capable LLM with openly available LLMs. And particularly exciting is that the new Llama release comes with a 93-page research paper this time. Below, I want to share a few interesting facts from the paper, and I will likely write a longer analysis this weekend.

Model sizes

Llama 3.1 now comes in 3 sizes: 8B, 70B, and 405B parameters. The 8B and 70B variants are sight upgrades from the previous Llama 3 models that have been released in April 2024. (See the figure below for a brief performance comparison). The 405B model was used to improve the 8B and 70B via synthetic data during the finetuning stages.

Pretraining Data

The 93-page report by Meta (a link to the report is in the comments below) offers amazing detail. Particularly, the section on preparing the 15.6 trillion tokens for pretraining offers so much detail that it would make it possible to reproduce the dataset preparation. However, Meta doesn't share the dataset sources. All we know is that it's trained primarily on "web data." This is probably because of the usual copyright concerns and to prevent lawsuits.

Still, it's a great writeup if you plan to prepare your own pretraining datasets as it shares recipes on deduplication, formatting (removal of markdown markers), quality filters, removal of unsafe content, and more.

Long-context Support

The models support a context size of up to 128k tokens. The researchers achieved this via a multiple-stage process. First, they pretrained it on 8k context windows (due to resource constraints), followed by continued pretraining on longer 128k token windows. In the continued pretraining, they increased the context length in 6 stages. Moreover, they also observed that finetuning requires 0.1% of long-context instruction samples; otherwise, the long-context capabilities will decline.

Alignment

In contrast to earlier rumors, Llama 3 was not finetuned using both RLHF with proximal policy optimization (PPO) and direct preference optimization (DPO). Following a supervised instruction finetuning stage (SFT), the models were only trained with DPO, not PPO. (Unlike in the Llama 2 paper, unfortunately, the researchers didn't include a chart analyzing the improvements made via this process.). Although they didn't use PPO, they used a reward model for rejection sampling during the instruction finetuning stage.

Inference

The 405B model required 16k H100 GPUs for training. During inference, the bfloat16-bit version of the model still requires 16 H100 GPUs. However, Meta also has an FP8 version that runs on a single server node (that is, 8xH100s).

Performance
You are probably curious about how it compares to other models. The short answer is "very favorable", on par with GPT4.
Here are 5 beginner-friendly data science project ideas

Loan Approval Prediction
Predict whether a loan will be approved based on customer demographic and financial data. This requires data preprocessing, feature engineering, and binary classification techniques.

Credit Card Fraud Detection
Detect fraudulent credit card transactions with a dataset that contains transactions made by credit cards. This is a good project for learning about imbalanced datasets and anomaly detection methods.

Netflix Movies and TV Shows Analysis
Analyze Netflix's movies and TV shows to discover trends in ratings, popularity, and genre distributions. Visualization tools and exploratory data analysis are key components here.

Sentiment Analysis of Tweets
Analyze the sentiment of tweets to determine whether they are positive, negative, or neutral. This project involves natural language processing and working with text data.

Weather Data Analysis
Analyze historical weather data from the National Oceanic and Atmospheric Administration (NOAA) to look for seasonal trends, weather anomalies, or climate change indicators. This project involves time series analysis and data visualization.
👍1
https://youtu.be/ZOJvKbbc6cw


Hi guys a lot of you have not subscribed my channel yet. If you're reading this message then don't forget to subscribe my channel and comment your views.  At least half of you go and subscribe my channel.
Thank you in advance
Check out my new blog.
📚 Understanding Linear Regression Through a Student’s Journey

Let’s take a trip back to your student days to understand linear regression, one of the most fundamental concepts in machine learning.

Alex, a dedicated student, is trying to predict their final exam score based on the number of hours they study each week. They gather data over the semester and notice a pattern—more hours studied generally leads to higher scores. To quantify this relationship, Alex uses linear regression.

What is Linear Regression?
Linear regression is like drawing a straight line through a scatterplot of data points that best predicts the dependent variable (exam scores) from the independent variable (study hours). The equation of the line looks like this:

Score= Intercept + Slope * Study Hours

Here, the intercept is the score Alex might expect with zero study hours (hopefully not too low!), and the slope shows how much the score increases with each additional hour of study.

Linear regression works under several assumptions:

1. Linearity: The relationship between study hours and exam scores should be linear. If Alex studies twice as much, their score should increase proportionally. But what if the benefit of extra hours diminishes over time? That’s where the linearity assumption can break down.

2. Independence: Each data point (study hours vs. exam score) should be independent of others. If Alex’s friends start influencing their study habits, this assumption might be violated.

3. Homoscedasticity: The variance of errors (differences between predicted and actual scores) should be consistent across all levels of study hours. If Alex’s predictions are more accurate for students who study a little but less accurate for those who study a lot, this assumption doesn’t hold.

4. Normality of Errors: The errors should follow a normal distribution. If the errors are skewed, it might suggest that factors beyond study hours are influencing scores.


Despite its simplicity, linear regression isn’t perfect. Here are a few limitations of linear regression.

- Non-Linearity:If the relationship between study hours and exam scores isn’t linear (e.g., diminishing returns after a certain point), linear regression might not capture the true pattern.

- Outliers: A few students who study a lot but still score poorly can heavily influence the regression line, leading to misleading predictions.

- Overfitting: If Alex adds too many variables (like study environment, type of study material, etc.), the model might become too complex, fitting the noise rather than the true signal.

In Alex’s case, while linear regression provides a simple and interpretable model, it’s important to remember these assumptions and limitations. By understanding them, Alex can better assess when to rely on linear regression and when it might be necessary to explore more advanced methods.
🚨 Major Announcement: Mukesh Ambani to transform Rel'AI'ince into a deeptech company

He is focused on driving AI adoption across Reliance Industries Limited's operations through several initiatives:

➡️ Developing cost-effective generative AI models and partnering with tech companies to optimize AI inferencing

➡️ Introducing Jio Brain, a comprehensive suite of AI tools designed to enhance decision-making, predictions, and customer insights across Reliance’s ecosystem

➡️ Building a large-scale, AI-ready data center in Jamnagar, Gujarat, equipped with advanced AI inference facilities

➡️ Launching JioAI Cloud with a special Diwali offer of up to 100 GB of free cloud storage

➡️ Collaborating with Jio Institute to create AI programs for upskilling

➡️ Introducing "Hello Jio," a generative AI voice assistant integrated with JioTV OS to help users find content on Jio set-top boxes

➡️ Launching "JioPhoneCall AI," a feature that uses generative AI to transcribe, summarize, and translate phone calls.
Making all my interview experiences public so that I am forced to learn new things :)

Machine Learning
1. Explain 'irreducible error' with the help of a real life example
2. What two models are compared while calculating R2 in a regression setup?
3. How do you evaluate clustering algorithms?
4. What is Gini and Cross-entropy? What are the minimum and maximum value for both?
5. What does MA component mean in ARIMA models?
6. You are a senior data scientist and one of your team members suggests you to use KNN with 70:30 train test split , what must you immediately correct in his approach?

AWS & DevOps
1. Run time limit for Lambda functions.
2. What do you mean by a serverless architecture?
3. Tell me any four Docker commands.
4. What is Git Checkout?
5. How does ECS help container orchestration and how could you make it serverless?
6. Can you run a docker image locally?

Generative AI
1. Most important reason why one may just still use RAG when you have LLMs offering context window in million tokens
2. How do you handle a situation when tokens in your retrieved context exceed tokens that your LLM supports?
3. What is context precision and context recall in the context of RAG?
4. What is hybrid search and what are the advantages / limitations?
5. What inputs are shared when you do recursive chunking?
👍1
𝗠𝗮𝘀𝘁𝗲𝗿 𝗦𝗤𝗟 𝗪𝗶𝗻𝗱𝗼𝘄 𝗙𝘂𝗻𝗰𝘁𝗶𝗼𝗻𝘀 🌟

SQL window functions are key to cracking technical interviews and optimizing your SQL queries. They’re often a focal point in data-focused roles, where showing your knowledge of these functions can set you apart. By mastering these functions, you can solve complex problems efficiently and design more effective databases, making you a valuable asset in any data-driven organization.

To make it easier to understand, I have divided SQL window functions into three main categories: Aggregate, Ranking, and Value functions.

1. 𝗔𝗴𝗴𝗿𝗲𝗴𝗮𝘁𝗲 𝗙𝘂𝗻𝗰𝘁𝗶𝗼𝗻𝘀

Aggregate functions like AVG(), SUM(), COUNT(), MIN(), and MAX() compute values over a specified window, such as running totals or averages. These functions help optimize queries that require complex calculations while retaining row-level details.

2. 𝗥𝗮𝗻𝗸𝗶𝗻𝗴 𝗙𝘂𝗻𝗰𝘁𝗶𝗼𝗻𝘀

Ranking functions such as ROW_NUMBER(), RANK(), and DENSE_RANK() assign ranks, dense ranks, or row numbers based on a specified order within a partition. These are crucial for solving common interview problems and creating optimized queries for ordered datasets.

3. 𝗩𝗮𝗹𝘂𝗲 𝗙𝘂𝗻𝗰𝘁𝗶𝗼𝗻𝘀

Value functions like LAG(), LEAD(), FIRST_VALUE(), and LAST_VALUE() allow you to access specific rows within your window. These functions are essential for trend analysis, comparisons, and detecting changes over time.

I’ve broken down each category with examples, sample code, expected output, interview questions, and even ChatGPT prompts to help you dive deeper into SQL window functions. Whether you're preparing for an interview or looking to optimize your SQL queries, understanding these functions is a game-changer.
ARIMA is easier than you think.

Explained in 3 minutes.

ARIMA stands for AutoRegressive Integrated Moving Average. It’s a popular method used for forecasting time series data.

In simple terms, ARIMA helps us predict future values based on past data. It combines three main components: autoregression, differencing, and moving averages.

Let's breakdown those three parts:

1️⃣ Autoregression means we use past values to predict future ones.

2️⃣ Differencing helps to make the data stationary, which means it has a consistent mean over time.

3️⃣ Moving averages smooth out short-term fluctuations.

Using ARIMA can help you make better decisions, manage inventory, and boost profits. It’s a powerful tool for anyone looking to understand trends in their data!
https://youtu.be/ZOJvKbbc6cw


Hi guys a lot of you have not subscribed my channel yet. If you're reading this message then don't forget to subscribe my channel and comment your views.  At least half of you go and subscribe my channel.
Thank you in advance
Forwarded from AI Jobs (Artificial Intelligence)
Recently, I completed two rounds of technical interviews for an ML Engineer role focused on LLMs, which pushed me to dive deep into concepts like attention mechanisms, tokenization, RAG, and GPU parallelism. I ended up creating a 30-page document of notes to organize my learnings.

To further solidify these concepts, I built three projects:
1️⃣ Two follow-along RAG-based "ChatPDF" projects with slight variations—one using Google Gen AI + FAISS, and another using HuggingFace + Pinecone.
2️⃣ A custom web scraper project that creates a vector store from website data and leverages advanced RAG techniques (like top-k retrieval and reranking) to provide LLM-driven answers for queries about the website.

Although the company ultimately chose another candidate who better matched their specific requirements, I received positive feedback on both rounds, and I’m excited to continue building on what I’ve learned. Onward and upward!

Notes: https://lnkd.in/dAvJjawc
Google Gen AI + FAISS+ Streamlit: https://lnkd.in/d7hPEz8c
Huggingface + Pinecone:https://lnkd.in/dgbJTSpq
Web scraper + Advanced RAG: https://lnkd.in/ddJfbBcF

P.S. you would need your own API keys for Google Gen AI, Pinecone and Cohere. All these are free to use for the purposes of small projects and for learning.
1🔥1