Category Archives: AI

Difference – Artificial Intelligence & Machine Learning

In this post, you learn the difference between artificial intelligence & machine learning. Artificial intelligence represents a set of computer programs that imitate human intelligence. The diagram below represents the key difference between AI and Machine Learning. Basically, machine learning is a part of AI landscape. One can do AI without doing machine learning or deep learning. Thus, an organization can claim that they have AI-based systems without having machine learning or deep learning based systems.  All machine learning or deep learning based systems can be termed as AI systems. But, all AI systems may not be termed as machine learning systems. The following are key building blocks of an …

Posted in AI, Data Science, Machine Learning. Tagged with , .

Machine Learning Models Evaluation Infographics

In this post, you will get an access to a self-explanatory infographics / diagram representing different aspects / techniques which need to be considered while doing machine learning model evaluation. Here is the infographics:   In the above diagram, you will notice that the following needs to be considered once the model is trained. This is required to be done to select one model out of many models which get trained. Basic parameters: The following need to be considered for evaluating the model: Bias & variance Overfitting & underfitting Holdout method Confidence intervals Resampling methods: The following techniques need to be adopted for evaluating models: Repeated holdout Empirical confidence intervals Cross-validation: Cross …

Posted in AI, Data Science, Machine Learning. Tagged with , .

Infographics for Model & Algorithm Selection & Evaluation

This is a short post created for quick reference on techniques which could be used for model evaluation & selection and model and algorithm comparision. This would be very helpful for those aspiring data scientists beginning to learn machine learning or those with advanced data science skills as well. The image has been taken from this blog, Comparing the performance of machine learning models and algorithms using statistical tests and nested cross-validation authored by Dr. Sebastian Raschka The above diagram provides prescription for what needs to be done in each of the following areas with small and large dataset. Very helpful, indeed. Model evaluation Model selection Model and algorithm comparison …

Posted in AI, Data Science, Machine Learning. Tagged with , , .

Feature Scaling & Stratification for Model Performance (Python)

In this post, you will learn about how to improve machine learning models performance using techniques such as feature scaling and stratification. The following topics are covered in this post. The concepts have been explained using Python code samples. What is feature scaling and why one needs to do it? What is stratification? Training Perceptron model without feature scaling and stratification Training Perceptron model with feature scaling Training Perceptron model with feature scaling and stratification What is Feature Scaling and Why is it needed? Feature scaling is a technique of standardizing the features present in the data in a fixed range. This is done when data consists of features of varying …

Posted in AI, Data Science, Machine Learning. Tagged with , , .

Python – Improve Model Performance using Feature Scaling

In this post you will learn about a simple technique namely feature scaling using which you could improve machine learning models. The models will be trained using Perceptron (single-layer neural network) classifier. First and foremost, lets quickly understand what is feature scaling and why one needs it? What is Feature Scaling and Why does one need it? Feature Scaling is a technique to standardize the independent features present in the data in a fixed range. This is performed when the dataset contains features that are highly varying in magnitudes, units, and ranges. The following are a different kind of scaling: Min-max scaling: The input value is scaled to the range of …

Posted in AI, Data Science, Machine Learning. Tagged with , , .

Python – Scatter Plot Different Classes

In this post, you will learn about the how to create scatter plots using Python which represents two or more classes while you are trying to solve machine learning classification problem. As you work on the classification problem, you want to understand whether classes are linearly separable or they are non-linear. In other words, whether the classification problem is linear or non-linear. This, in turn, helps you decide on what kind of machine learning classification algorithms you might want to use. In this post, you will learn how to use scatter plot to identify whether two or more classes are linearly separable or not. You may want to check what, when and how of scatter plot matrix which can also be used to determine whether the data …

Posted in AI, Data Science, Machine Learning. Tagged with , , .

Python DataFrame – Assign New Labels to Columns

In this post, you will get a code sample related to how to assign new labels to columns in python programming while training machine learning models.  This is going to be very helpful when working with classification machine learning problem. Many a time the labels for response or dependent variable are in text format and all one wants is to assign a number such as 0, 1, 2 etc instead of text labels. Beginner-level data scientists will find this code very handy. We will look at the code for the dataset as represented in the diagram below: In the above code, you will see that class labels are named as very_low, Low, High, Middle …

Posted in AI, Data Science, Machine Learning, News. Tagged with , , .

Difference between Adaline and Logistic Regression

In this post, you will understand the key differences between Adaline (Adaptive Linear Neuron) and Logistic Regression.  Activation function Cost function Difference in Activation Function The primary difference is the activation function. In Adaline, the activation function is called as linear activation function while in logistic regression, the activation function is called as sigmoid activation function. The diagram below represents the activation functions for Adaline. The  activation function for Adaline, also called as linear activation function, is the identity function which can be represented as the following: $$\phi(W^TX) = W^TX$$ The diagram below represents the activation functions for Logistic Regression. The  activation function for Logistic Regression, also called as sigmoid activation function, is …

Posted in AI, Data Science, Machine Learning. Tagged with , .

Logistic Regression: Sigmoid Function Python Code

In this post, you will learn about the following: How to represent the probability that an event will take place with the asssociated features (attributes / independent features) Sigmoid function python code Probability as Sigmoid Function The below is the Logit Function code representing association between the probability that an event will occur and independent features. $$Logit Function = \log(\frac{P}{(1-P)}) = {w_0} + {w_1}{x_1} + {w_2}{x_2} + …. + {w_n}{x_n}$$ $$Logit Function = \log(\frac{P}{(1-P)}) = W^TX$$ $$P = \frac{1}{1 + e^-W^TX}$$ The above equation can be called as sigmoid function. Python Code for Sigmoid Function Executing the above code would result in the following plot: Pay attention to some of the …

Posted in AI, Data Science, Machine Learning. Tagged with , , .

Three Key Challenges of Machine Learning Models

In this post, you will learn about the three most important challenges or guiding principles that could be used while you are building machine learning models. The three key challenges which could be adopted while training machine learning models are following: The conflict between simplicity and accuracy Dimensionality – Curse or Blessing? The multiplicity of good models The Conflict between Simplicity and Accuracy Before starting on working for training one or more machine learning models, one would need to decide whether one would like to go for simple model or one would want to focus on model accuracy. The simplicity of models could be achieved by using algorithms which help …

Posted in AI, Data Science, Machine Learning. Tagged with , .

Difference between True Error & Sample Error

In this post, you will learn about some of the following in relation to evaluating a discrete-valued hypothesis when learning hypothesis (building models) using different machine learning algorithms. The discrete-valued hypothesis could also be understood as classification models built using machine learning algorithms and used to classify an instance drawn at random. What is a true error or true risk? What is a sample error or empirical risk? Difference between true error and sample error How to estimate the true error? In case you are a data scientist, you will want to understand the concept behind the true error and sample error. These concepts are key to understand for evaluating …

Posted in AI, Data Science, Machine Learning. Tagged with , , .

Python – How to Create Dataframe using Numpy Array

In this post, you will get a code sample for creating a Pandas Dataframe using a Numpy array with Python programming. Step 1: Load the Python Packages Step 2: Create a Numpy array This is how the array would look like: Step 3: Create a Transpose of Numpy Array This is how the transpose would look like: Step 4: Create a Pandas Dataframe Print the data using head command such as df.head(). This is how the data frame would look like: In case, you would like to quickly plot the data and look for relationship, here are the command using seaborn package: The above would print the following plot:

Posted in AI, Data Science, Machine Learning. Tagged with , .

Hypergeometric Distribution Explained with 10+ Examples

In this post, we will learn Hypergeometric distribution with 10+ examples. The following topics will be covered in this post: What is Hypergeometric Distribution? 10+ Examples of Hypergeometric Distribution If you are an aspiring data scientist looking forward to learning/understand the binomial distribution in a better manner, this post might be very helpful. The Binomial distribution can be considered as a very good approximation of the hypergeometric distribution as long as the sample consists of 5% or less of the population. One would need a good understanding of binomial distribution in order to understand the hypergeometric distribution in a great manner. I would recommend you take a look at some of my related posts on …

Posted in AI, Data Science, Machine Learning, statistics. Tagged with , .

Binomial Distribution with Python Code Examples

In this code, you will learn code examples, written with Python Numpy package, related to the binomial distribution. You may want to check out the post, Binomial Distribution explained with 10+ examples to get an understanding of Binomial distribution with the help of several examples. All of the examples could be tried with code samples given in this post. Here are the instructions: Load the Numpy package: First and foremost, load the Numpy and Seaborn library Code Syntax – np.random.binomial(n, p, size=1): The code np.random.binomial(n, p, size=1) will be used to print the number of successes that will happen in one (size=1) experiment comprising of n number of trials with probability/proportion of success being p. Tossing a …

Posted in AI, Data Science, Machine Learning, statistics. Tagged with , .

Binomial Distribution Explained with 10+ Examples

In this post, we will learn binomial distribution with 10+ examples. The following topics will be covered in this post: What is Binomial Distribution? Binomial distribution python example 10+ Examples of Binomial Distribution If you are an aspiring data scientist looking forward to learning/understand the binomial distribution in a better manner, this post might be very helpful. What is a Binomial Distribution? The binomial distribution is a discrete probability distribution that represents the probabilities of binomial random variables in a binomial experiment. What is an Experiment? An experiment is nothing but a set of one or more repeated trials resulting in a particular outcome out of many outcomes. Thus, an experiment could consist of 1 …