Hello Students:
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn import svm, linear_model
to classify cars as having automatic or manual transmissions.
# ... your code here ...
The decision boundary is -8.24 * weight + -0.309 * mileage + 32.0 = 0. The training accuracy is 1.0. We predict that a car weighing 20 thousand pounds that gets 20 mpg has transmission type 0 (where 0=automatic, 1=manual).
Use the matrix formula $w = (X^T X)^{-1} X^T y$ we developed in class to fit these three points: (0, 5), (2, 1), (4, 3). (Use linear_model.linearRegression(), if you wish, to check your work.)
... your answer here (just give the model, $y = w x + b$) ...
intercept=4.0, slope=-0.5
Estimate the average daily trading volume of a Dow Jones Industrial Average stock from its market capitalization. That is, use $y = $ AvgVol vs. $x =$ MarketCap.
# ... your code here ...
The model is Volume = 2.68e-05 * (Market Capitalization) + 3.41e+06. R^2 is 0.705. We predict a Volume of 1.01e+07 for a company with Market Capitalization 2.5e+11 (see red dot).
Estimate the same volume from both market capitalization and price. That is, use $y =$ AvgVol vs. $x_1 =$ MarketCap and $x_2 =$ Price.
# ... your code here ...
The model is Volume = 2.89e-05 * (Market Capitalization) + -6.69e+04 * Price + 1.44e+07. R^2 is 0.823.