September 2019
Intermediate to advanced
420 pages
10h 29m
English
Before trying out linear regression on a real-life dataset, let's understand how we can use the cv2.fitLine function to fit a line to a 2D or 3D point set:
:In [1]: import cv2... import numpy as np... import matplotlib.pyplot as plt... from sklearn import linear_model... from sklearn.model_selection import train_test_split... plt.style.use('ggplot')... %matplotlib inlineIn [2]: x = np.linspace(0,10,100)... y_hat = x*5+5... np.random.seed(42)... y = x*5 + 20*(np.random.rand(x.size) - 0.5)+5
Read now
Unlock full access