Tag Archives: ai

Python – Extract Text from PDF file using PDFMiner

In this post, you will get a quick code sample on how to use PDFMiner, a Python library, to extract text from PDF files and perform text analysis. I will be posting several other posts in relation to how to use other Python libraries for extracting text from PDF files.  In this post, the following topic will get covered: How to set up PDFMiner Python code for extracting text from PDF file using PDFMiner Setting up PDFMiner Here is how you would set up PDFMiner.six. You could execute the following command to get set up with PDFMiner while working in Jupyter notebook: Python Code for Extracting Text from PDF file …

Continue reading

Posted in AI, NLP, Python. Tagged with , , .

NLTK Hello World Python Example

In this post, you will learn about getting started with natural language processing (NLP) with NLTK (Natural Language Toolkit), a platform to work with human languages using Python language. The post is titled hello world because it helps you get started with NLTK while also learning some important aspects of processing language. In this post, the following will be covered: Install / Set up NLTK Common NLTK commands for language processing operations Install / Set up NLTK This is what you need to do set up NLTK. Make sure you have Python latest version set up as NLTK requires Python version 3.5, 3.6, 3.7, or 3.8 to be set up. In Jupyter notebook, you could execute …

Continue reading

Posted in AI, NLP. Tagged with , , .

Contract Management Use Cases for Machine Learning

contract management use cases machine learning

This post briefly represent the contract management use cases which could be solved using machine learning / data science. These use cases can also be termed as predictive analytics use cases. This can be useful for procurement business functions in any manufacturing companies which require to procure raw materials from different suppliers across different geographic locations. The following are some of the examples of industry where these use cases and related machine learning techniques can be useful. Pharmaceutical Airlines Food Transport Key Analytics Questions One must understand the business value which could be created using predictive analytics use cases listed later in this post. One must remember that one must start with questions …

Continue reading

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

Difference – Artificial Intelligence & Machine Learning

Artificial intelligence vs 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 …

Continue reading

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

Infographics for Model & Algorithm Selection & Evaluation

model evaluation model selection algorithm comparison

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 …

Continue reading

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

Logistic Regression: Sigmoid Function Python Code

Logistic Regression - Sigmoid Function Plot

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 …

Continue reading

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

Beta Distribution Example for Cricket Score Analysis

virat kohli score probability using beta distribution

This post represents a real-world example of Binomial and Beta probability distribution from the sports field. In this post, you will learn about how the run scored by a Cricket player could be modeled using Binomial and Beta distribution. Ever wanted to predict the probability of Virat Kohli scoring a half-century in a particular match. This post will present a perspective on the same by using beta distribution to model the probability of runs that can be scored in a match. If you are a data scientist trying to understand beta and binomial distribution with a real-world example, this post will turn out to be helpful. First and foremost, let’s identify the random variable that we would like …

Continue reading

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

Pandas – How to Extract Month & Year from Datetime

how to extract month and year from datetime

This is a quick post representing code sample related to how to extract month & year from datetime column of DataFrame in Pandas. The code sample is shown using the sample data, BrentOilPrices downloaded from this Kaggle data page. Here is the code to load the data frame. Check the data type of the data using the following code: The output looks like the following: Date object Price float64 dtype: object Use the following command to change the date data type from object to datetime and extract the month and year. Printing data using head command would print the following:

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

Pandas – How to Concatenate Dataframe Columns

data frame concatenation by columns

Quick code sample on how to concatenate the data frames columns. We will work with example of Boston dataset found with sklearn.datasets. One should note that data frames could be concatenated by rows and columns. In this post, you will learn about how to concatenate data frames by columns. Here is the code for working with Boston datasets. First and foremost, the Boston dataset will be loaded. Once loaded, let’s create different different data frames comprising of data and target variable. This above creates two data frames comprising of data (features) and the values of target variable. Here are the snapshots. Use the following command to concatenate the data frames. …

Continue reading

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

Difference between Machine Learning & Traditional Software

difference traditional software machine learning

In this post, we will understand what are some of the key differences between machine learning models and traditional/conventional software. S.No Traditional Software Machine Learning 1 In traditional software, the primary objective is to meet functional and non-functional requirements. In machine learning models, the primary goal is to optimize the metric (accuracy, precision/recall, RMSE, etc) of the models. Every 0.1 % improvement in the model metrics could result in significant business value creation. 2 The quality of the software primary depends on the quality of the code. The quality of the model depends upon various parameters which are mainly related to the input data and hyperparameters tuning. 3 Traditional software …

Continue reading

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

Neural Network Architecture for Text-to-Speech Synthesis

Neural Network Architecture for TTS

In this post, you would learn about a neural network reference solution architecture which could be used to convert the text to speech. The neural network solution architecture given in this post is based on deep learning (autoencoder network (encoder-decoder) with attention). Neural Network Reference Architecture for Text-to-Speech Synthesis In the solution architecture diagram (figure 1) depicted below, the following is described: Sentences are first converted into character embeddings. Character embeddings are numeric representations of words. Numeric representations of each of the words could be used to create numeric representations of higher-level representations like sentences/paragraphs/documents/etc. Character embeddings are next fed into recurrent sequence-to-sequence feature prediction network with attention. The sequence-to-sequence …

Continue reading

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

Reverse Image Search using Deep Learning (CNN)

reverse image search using deep learning - CNN

In this post, you will learn about a solution approach for searching similar images out of numerous images matching an input image (query) using machine learning / deep learning technology. This is also called a reverse image search. The image search is generally searching for images based on keywords. Here are the key components of the solution for reverse image search: A database of storing images with associated numerical vector also called embeddings. A deep learning model based on convolutional neural network (CNN) for creating numerical feature vectors (aka embeddings) for images A module which searches embeddings of an input image (query) from the image database based on the nearest neighbor …

Continue reading

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

Why Data Scientists Must Learn Statistics?

Statistics - Key to data science

In order to understand the need for data scientists to be very good at the statistical concepts, one needs to clearly understand some of the following: Who are data scientists? What is the need for statistics in data scientists’ day-to-day work? Who are Data Scientists? Data Scientists are the primarily Scientists who do experiments to find some of the following: Whether there exists a relationship between data Whether the function approximated (machine learning or statistical learning model) from a given sample of data could be generalized for the entire population In case there are multiple function approximations for predicting outcomes given a set of input, which one of the function approximation …

Continue reading

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

When not to use F-Statistics for Multi-linear Regression

In this post, you will learn about the scenario in which you may NOT want to use F-Statistics for doing the hypothesis testing on whether there is a relationship between response and predictor variables in the multilinear regression model. Multilinear regression is a machine learning / statistical learning method which is used to predict the quantitative response variable and also understand/infer the relationship between the response and multiple predictor variables. We will look into the following topics: Background When not to use F-Statistics for Multilinear Regression Model Background F-statistics is used in hypothesis testing for determining whether there is a relationship between response and predictor variables in multilinear regression models. Let’s consider …

Continue reading

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

What, When & Why of Regularization in Machine Learning?

Regularization for regression models

In this post, we will try and understand some of the following in relation to regularizing the regression machine learning models to achieve higher accuracy and stable models: Background What is regularization? Why & when does one need to adopt/apply the regularization technique? Background At times, when one is building a multi-linear regression model, one uses the least squares method for estimating the coefficients of determination or parameters for features. As a result, some of the following happens: Often, the regression model fails to generalize on unseen data. This could happen when the model tries to accommodate for all kind of changes in the data including those belonging to both …

Continue reading

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

Unit Tests & Data Coverage for Machine Learning Models

Unit testing for Machine Learning Models

This post represents thoughts on what would it look like planning unit tests for machine learning models. The idea is to perform automated testing of ML models as part of regular builds to check for regression related errors in terms of whether the predictions made by certain set of input data vectors does not match with expected outcomes. This brings up some of the following topics for discussion: Why unit testing for machine learning models? What would unit tests for machine learning models mean? Data coverage or code coverage? Why unit testing for Machine Learning models? Once a model is built, the challenge is to monitor the performance metrics of the models …

Continue reading

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