Gini Impurity or Entropy? How to decide the root node in decision tree?

By default, the Gini impurity measure is used, but you can select the entropy impurity measure instead by setting the criterion hyperparameter to “entropy”. The concept of entropy originated in thermodynamics as a measure of molecular disorder: entropy approaches zero when molecules are still and well ordered. It later spread to a wide variety of … Read more

Linear Regression from Scratch: A Step-by-Step Guide

Introduction: Linear regression is one of the fundamental techniques in machine learning and statistics used for modeling the relationship between a dependent variable and one or more independent variables. In this tutorial, we’ll delve into the implementation of simple linear regression from scratch using Python. By understanding the mathematical intuition behind linear regression and its … Read more

Decision Trees | Machine Learning from Scratch

Like SVMs, Decision Trees are versatile Machine Learning algorithms that can perform both classification and regression tasks, and even multioutput tasks. They are very powerful algorithms, capable of fitting complex datasets. For example, you trained a DecisionTreeRegressor model on the California housing dataset, fitting it perfectly (actually overfitting it).Decision Trees are also the fundamental components … Read more

SVM Regression | Machine Learning from Scratch

Support Vector Machines

Introduction As we mentioned earlier, the SVM algorithm is quite versatile: not only does it support linear and nonlinear classification, but it also supports linear and nonlinear regression. The trick is to reverse the objective: instead of trying to fit the largest possible street between two classes while limiting margin violations, SVM Regression tries to … Read more

Gaussian RBF Kernel | Machine Learning from Scratch

Support Vector Machine Cover Pic

Introduction In Previous blog we talked about Polynomial Kernel. In this blog we will talk about Gaussian RBF Kernel. Just like the polynomial features method, the similarity features method can be useful with any Machine Learning algorithm, but it may be computationally expensive to compute all the additional features, especially on large training sets. However, … Read more

Polynomial Kernel | Machine Learning from Scratch

Support Vector Machine Cover Pic

In Previous blog we talked about Non Linear SVM Classifications. In this blog we will talk about Polynomial Kernel. Introduction Adding polynomial features is simple to implement and can work great with all sorts of Machine Learning algorithms (not just SVMs), but at a low polynomial degree it cannot deal with very complex datasets, and … Read more

How can A linear model learn non-linear/discrete patterns?

Introduction During model development, one of the techniques that many don’t experiment with is feature discretization. The core idea is to transform a continuous feature into discrete features, mostly one-hot encoded. 𝐖𝐡𝐲 𝐰𝐨𝐮𝐥𝐝 𝐰𝐞 𝐝𝐨 𝐭𝐡𝐚𝐭? My rationale for using feature discretization has almost always been simple: “It just makes sense to discretize a feature.” … Read more

Tips For Writing Efficient And Faster SQL Queries

SQL Banner

INTRODUCTION Query optimization is an important skill for SQL developers and database administrators (DBAs). In order to improve the performance of SQL queries, developers and DBAs need to understand the query optimizer and the techniques it uses to select an access path and prepare a query execution plan. Query tuning involves knowledge of techniques such … Read more

Questions asked in Data Scientist Interviews Part 7

Interview

In this series we bring new Data Scientist Interview Questions. You can read other tutorials related to same topic on our website. What is Cross Validation? Cross-Validation in Machine Learning is a statistical resampling technique that uses different parts of the dataset to train and test a machine learning algorithm on different iterations. The aim … Read more

Nonlinear SVM Classification | Machine Learning from Scratch

Support Vector Machine Cover Pic

In previous blog, We read about Soft margin Classification. In this blog we will talk about Non Linear SVM Classification. Introduction Although linear SVM classifiers are efficient and work surprisingly well in many cases, many datasets are not even close to being linearly separable. One approach to handling nonlinear datasets is to add more features, … Read more

Soft Margin Classification | Machine Learning from Scratch

In previous blog, We read about Linear SVM. In this blog we will talk about soft margin classification. If we strictly impose that all instances be off the street and on the right side, this is called hard margin classification. There are two main issues with hard margin classification. First, it only works if the … Read more

ROC and AUC in Evaluating Classification Models

In the dynamic world of business, where data-driven decisions reign supreme, the accuracy and reliability of classification models play a pivotal role. Whether you’re involved in lead scoring or any other binary classification system, understanding the intricacies of evaluation metrics is key. Among these, the ROC (Receiver Operating Characteristic) curve and its integral companion, AUC … Read more

Support Vector Machines (SVM) Algorithms

A Support Vector Machine (SVM) is a very powerful and versatile Machine Learning model, capable of performing linear or nonlinear classification, regression, and even outlier detection. It is one of the most popular models in Machine Learning, and anyone interested in Machine Learning should have it in their toolbox. SVMs are particularly well suited for … Read more

What is early stopping? | Machine Learning from Scratch

Machine learning models, particularly those trained iteratively using algorithms like Gradient Descent, face the risk of overfitting the training data. One powerful and elegant solution to this challenge is known as “Early Stopping.” In this blog post, we’ll delve into the concept of Early Stopping, explore its effectiveness, and showcase a practical implementation using a … Read more

Information Gain in Machine Learning

Information Gain

Information Gain (IG) is critical in machine learning and decision tree algorithms, particularly in data classification and 𝐟𝐞𝐚𝐭𝐮𝐫𝐞 𝐬𝐞𝐥𝐞𝐜𝐭𝐢𝐨𝐧. Information Gain Information Gain is a concept used in the field of machine learning and decision trees to measure the effectiveness of an attribute in classifying a dataset. It is commonly employed in the construction of … Read more

Pyspark Tutorial for beginners

S3 Bucket

PySpark, it is a Python library for Apache Spark, an open-source distributed computing system. PySpark allows you to write Spark applications using Python programming language, providing a Python API for Spark’s capabilities. Below are some properties of pyspark. 1. Create a simple Spark Dataframe 2. Read data from a table using spark.sql To read data … Read more

Extracting Financial Year from Date in Pandas and PySpark DataFrames

Python

Introduction Working with date data often involves extracting relevant information, such as the financial year. In this blog post, we’ll explore how to extract the financial year from a date column in both Pandas and PySpark DataFrames. Extracting Financial Year in Pandas DataFrame Sample Data Let’s start by creating a sample Pandas DataFrame with a … Read more

What is Lasso Regression? | Machine Learning from Scratch

Least Absolute Shrinkage and Selection Operator Regression (simply called Lasso Regression) is another regularized version of Linear Regression: just like Ridge Regression, it adds a regularization term to the cost function, but it uses the ℓ1 norm of the weight vector instead of half the square of the ℓ2 norm. Figure below shows the same … Read more

Regularized Linear Models(Ridge Regression) | Machine Learning from Scratch

As we saw in previous posts, a good way to reduce overfitting is to regularize the model (i.e., to constrain it): the fewer degrees of freedom it has, the harder it will be for it to overfit the data. For example, a simple way to regularize a polynomial model is to reduce the number of … Read more

Hackerrank | Longest Subarray with Absolute Difference Constraint

Hackerrank

Problem Overview Given an array of integers, our task is to find the longest subarray such that the absolute difference between any two elements is less than or equal to 1. Example a=[1,1,2,2,4,4,5,5,5] There are two subarrays meeting the criterion: [1,1,2,2] and [4,4,5,5,5]. The maximum length subarray has 5 elements. Function Description Complete the pickingNumbers function in the editor below. pickingNumbers has … Read more