Loading lesson path
Python
NumPy, Pandas, SciPy, plotting, and machine learning topics grouped into one practical track.
NumPy Tutorial
Matplotlib Tutorial
Machine Learning
Pandas Tutorial
Installation of Matplotlib If you have Python and PIP already installed on a system, then installation of Matplotlib is very easy. Install it using this command: C:\Users\ Your Name >pip install matp…
Mean, Median, and Mode What can we learn from looking at a group of numbers? In Machine Learning (and in mathematics) there are often three values that interests us: Mean - The average value Median -…
SciPy Tutorial
Pyplot Most of the Matplotlib utilities lies under the pyplot submodule, and are usually imported under the plt alias: import matplotlib.pyplot as plt Now the Pyplot package can be referred to as plt…
Machine Learning - Standard Deviation
Django Tutorial
Plotting x and y points The plot() function is used to draw points (markers) in a diagram. By default, the plot() function draws a line from point to point. The function takes parameters for specifyi…
Machine Learning - Percentiles
Markers You can use the keyword argument marker to emphasize each point with a specified marker: Example Mark each point with a circle: import matplotlib.pyplot as plt import numpy as np ypoints = np…
Machine Learning - Data Distribution
Linestyle You can use the keyword argument linestyle, or shorter ls, to change the style of the plotted line: Example Use a dotted line: import matplotlib.pyplot as plt import numpy as np ypoints = n…
Normal Data Distribution In the previous chapter we learned how to create a completely random array, of a given size, and between two given values. In this chapter we will learn how to create an arra…
Create Labels for a Plot With Pyplot, you can use the xlabel() and ylabel() functions to set a label for the x- and y-axis. Example Add labels to the x- and y-axis: import numpy as np import matplotl…
Scatter Plot A scatter plot is a diagram where each value in the data set is represented by a dot. The Matplotlib module has a method for drawing scatter plots, it needs two arrays of the same length…
Add Grid Lines to a Plot With Pyplot, you can use the grid() function to add grid lines to the plot. Example Add grid lines to the plot: import numpy as np import matplotlib.pyplot as plt x = np.arra…
Regression The term regression is used when you try to find the relationship between variables. In Machine Learning, and in statistical modeling, that relationship is used to predict the outcome of f…
Display Multiple Plots With the subplot() function you can draw multiple plots in one figure: Example Draw 2 plots: import matplotlib.pyplot as plt import numpy as np #plot 1: x = np.array([0, 1, 2,…
Polynomial Regression If your data points clearly will not fit a linear regression (a straight line through all data points), it might be ideal for polynomial regression. Polynomial regression, like…
Creating Scatter Plots With Pyplot, you can use the scatter() function to draw a scatter plot. The scatter() function plots one dot for each observation. It needs two arrays of the same length, one f…
Machine Learning - Multiple Regression
Creating Bars With Pyplot, you can use the bar() function to draw bar graphs: Example Draw 4 bars: import matplotlib.pyplot as plt import numpy as np x = np.array(["A", "B", "C", "D"]) y = np.array([…
Machine Learning - Scale
Histogram A histogram is a graph showing frequency distributions. It is a graph showing the number of observations within each given interval. Example: Say you ask for the height of 250 people, you m…
Evaluate Your Model In Machine Learning we create models to predict the outcome of certain events, like in the previous chapter where we predicted the CO2 emission of a car when we knew the weight an…
Creating Pie Charts With Pyplot, you can use the pie() function to draw pie charts: Example A simple pie chart: import matplotlib.pyplot as plt import numpy as np y = np.array([35, 25, 25, 15]) plt.p…
Machine Learning - Decision Tree
Machine Learning - Confusion Matrix
Hierarchical Clustering Hierarchical clustering is an unsupervised learning method for clustering data points. The algorithm builds clusters by measuring the dissimilarities between data. Unsupervise…
Logistic Regression Logistic regression aims to solve classification problems. It does this by predicting categorical outcomes, unlike linear regression that predicts a continuous outcome. In the sim…
Grid Search The majority of machine learning models contain parameters that can be adjusted to vary how the model learns. For example, the logistic regression model, from sklearn, has a parameter C t…
Categorical Data When your data has categories represented by strings, it will be difficult to use them to train machine learning models which often only accepts numeric data. Instead of ignoring the…
K-means K-means is an unsupervised learning method for clustering data points. The algorithm iteratively divides data points into K clusters by minimizing the variance in each cluster. Here, we will…
Bagging Methods such as Decision Trees, can be prone to overfitting on the training set which can lead to wrong predictions on new data. Bootstrap Aggregation (bagging) is a ensembling method that at…
Cross Validation When adjusting models we are aiming to increase overall model performance on unseen data. Hyperparameter tuning can lead to much better performance on test sets. However, optimizing…
AUC - ROC Curve In classification, there are many different evaluation metrics. The most popular is accuracy, which measures how often the model is correct. This is a great metric because it is easy…
KNN KNN is a simple, supervised machine learning (ML) algorithm that can be used for classification or regression tasks - and is also frequently used in missing value imputation. It is based on the i…