# Beginner’s Guide to Python

## Afghanistan Population Growth Rate Prediction using ARIMA model in Python

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.

## Machine Learning for Beginners in Python: How to Use Shi-Tomasi Corner Detector

Hits: 19 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 …

## Machine Learning for Beginners in Python: How to Save Images

Hits: 23 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 …

## Machine Learning for Beginners in Python: How to Load Images

Hits: 14 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 …

## Machine Learning for Beginners in Python: How to Binarize Images

Hits: 2 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 …

## Machine Learning for Beginners in Python: How to Rescale A Feature

Hits: 5 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 …

## Machine Learning for Beginners in Python: How to Get The Diagonal Of A Matrix

Hits: 4 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 …

## Machine Learning for Beginners in Python: How to Reshape An Array

Hits: 8 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 …

## Machine Learning for Beginners in Python: How to Select Elements in An Array

Hits: 0 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 …

## Machine Learning for Beginners in Python: How to save Machine Learning Models

Hits: 4 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() …

## Machine Learning for Beginners in Python: Make Simulated Data For Clustering

Hits: 56 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 …