Applied Machine Learning and Data Science is made easy at SETScholars. SETScholars aims to guide you to become a Predictive Analytics & Data Science specialist by exploring machine learning & deep learning tools in Python, R & SQL. In this end-to-end learn by coding article, you will learn how to do an end-to-end predictive analytics project on Afghanistan Population Growth Rate Prediction using ARIMA model in Python.

Hits: 40 Shi-Tomasi Corner Detector Preliminaries import cv2 import numpy as np from matplotlib import pyplot as plt Load image image_bgr = cv2.imread(‘images/plane_256x256.jpg’) image_gray = cv2.cvtColor(image_bgr, cv2.COLOR_BGR2GRAY) Define Corner Parameters corners_to_detect = 10 minimum_quality_score = 0.05 minimum_distance = 25 Detect Corners corners = cv2.goodFeaturesToTrack(image_gray, corners_to_detect, minimum_quality_score, minimum_distance) corners = np.float32(corners) Mark Corners for corner in …

Hits: 31 Save Images Preliminaries import cv2 import numpy as np from matplotlib import pyplot as plt Load Image As Greyscale image = cv2.imread(‘images/plane.jpg’, cv2.IMREAD_GRAYSCALE) plt.imshow(image, cmap=’gray’), plt.axis(“off”) plt.show() Python Example for Beginners Special 95% discount 2000+ Applied Machine Learning & Data Science Recipes Portfolio Projects for Aspiring Data Scientists: Tabular Text & Image …

Hits: 15 Load Images Preliminaries import cv2 import numpy as np from matplotlib import pyplot as plt Load Image As Greyscale image = cv2.imread(‘images/plane.jpg’, cv2.IMREAD_GRAYSCALE) plt.imshow(image, cmap=’gray’), plt.axis(“off”) plt.show() Python Example for Beginners Special 95% discount 2000+ Applied Machine Learning & Data Science Recipes Portfolio Projects for Aspiring Data Scientists: Tabular Text & Image …

Hits: 5 Binarize Images Preliminaries import cv2 import numpy as np from matplotlib import pyplot as plt Load Image As Greyscale image_grey = cv2.imread(‘images/plane_256x256.jpg’, cv2.IMREAD_GRAYSCALE) Apply Adaptive Thresholding max_output_value = 255 neighorhood_size = 99 subtract_from_mean = 10 image_binarized = cv2.adaptiveThreshold(image_grey, max_output_value, cv2.ADAPTIVE_THRESH_GAUSSIAN_C, cv2.THRESH_BINARY, neighorhood_size, subtract_from_mean) View Image plt.imshow(image_binarized, cmap=’gray’), plt.axis(“off”) plt.show() Python Example for Beginners …

Hits: 16 Rescale A Feature Preliminaries from sklearn import preprocessing import numpy as np Create Feature x = np.array([[-500.5], [-100.1], [0], [100.1], [900.9]]) Rescale Feature Using Min-Max minmax_scale = preprocessing.MinMaxScaler(feature_range=(0, 1)) x_scale = minmax_scale.fit_transform(x) x_scale array([[ 0. ], [ 0.28571429], [ 0.35714286], [ 0.42857143], [ 1. ]]) Python Example for Beginners Special 95% discount …

Hits: 6 Getting The Diagonal Of A Matrix Preliminaries import numpy as np Create Matrix matrix = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) Get The Diagonal matrix.diagonal() array([1, 5, 9]) Calculate The Trace matrix.diagonal().sum() 15 Python Example for Beginners Special 95% discount 2000+ Applied Machine Learning & Data Science Recipes Portfolio …

Hits: 10 Reshape An Array Preliminaries import numpy as np Create Array matrix = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12]]) Reshape Array matrix.reshape(2, 6) array([[ 1, 2, 3, 4, 5, 6], [ 7, 8, 9, 10, 11, 12]]) Python Example for Beginners Special 95% discount 2000+ Applied Machine …

Hits: 2 Selecting Elements In An Array Preliminaries # Load library import numpy as np Create Vector # Create row vector vector = np.array([1, 2, 3, 4, 5, 6]) Select Element # Select second element vector[1] 2 Create Matrix # Create matrix matrix = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) Select Element …

Hits: 5 Saving Machine Learning Models In scikit there are two main ways to save a model for future use: a pickle string and a pickled model as a file. Preliminaries from sklearn.linear_model import LogisticRegression from sklearn import datasets import pickle from sklearn.externals import joblib Load Data # Load the iris data iris = datasets.load_iris() …

Hits: 59 Make Simulated Data For Clustering Preliminaries from sklearn.datasets import make_blobs import matplotlib.pyplot as plt Make Data /* Make the features (X) and output (y) with 200 samples, */ X, y = make_blobs(n_samples = 200, n_features = 2, centers = 3, cluster_std = 0.5, shuffle = True) View Data /* Create a scatterplot of …

Hits: 110 Loading scikit-learn’s Iris Dataset Preliminaries # Load libraries from sklearn import datasets import matplotlib.pyplot as plt Load Iris Dataset The Iris flower dataset is one of the most famous databases for classification. It contains three classes (i.e. three species of flowers) with 50 observations per class. # Load digits dataset iris = datasets.load_iris() # Create …

Hits: 22 Loading scikit-learn’s Digits Dataset Preliminaries # Load libraries from sklearn import datasets import matplotlib.pyplot as plt Load Digits Dataset Digits is a dataset of handwritten digits. Each feature is the intensity of one pixel of an 8 x 8 image. # Load digits dataset digits = datasets.load_digits() # Create feature matrix X = …

Hits: 31 Loading scikit-learn’s Boston Housing Dataset Preliminaries # Load libraries from sklearn import datasets import matplotlib.pyplot as plt Load Boston Housing Dataset The Boston housing dataset is a famous dataset from the 1970s. It contains 506 observations on housing prices around Boston. It is often used in regression examples and contains 15 features. # Load digits …

Hits: 7 Loading Features From Dictionaries from sklearn import datasets import numpy as np iris = datasets.load_iris() X = iris.data[:, [2, 3]] X array([[1.4, 0.2], [1.4, 0.2], [1.3, 0.2], [1.5, 0.2], [1.4, 0.2], [1.7, 0.4], [1.4, 0.3], [1.5, 0.2], [1.4, 0.2], [1.5, 0.1], [1.5, 0.2], [1.6, 0.2], [1.4, 0.1], [1.1, 0.1], [1.2, 0.2], [1.5, 0.4], …