This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib.pyplot as plt | |
from sklearn.linear_model import LinearRegression | |
from sklearn.metrics import mean_squared_error, mean_absolute_error, r2_score | |
from sklearn.model_selection import train_test_split | |
import scipy.stats as stats #导入stats库 | |
# 1. 准备数据 | |
AD_spend = np.array([10,15,20,25,30,35,40,45]).reshape(-1, 1) | |
Sales = np.array([120,150,180,210,240,270,300,330]) |