每个给定芯片上的晶体管数量绘制在 y 轴上的对数刻度上,线性刻度上的引入日期在 x 轴上。
蓝色的点表示晶体管记数表;红色的线是最小二乘预测;橙色的线是摩尔定律
将要做的事
背景知识:1965年,工程师Gordon Moore预测在未来十年内,芯片上的晶体管数量将每两年翻一番。
本篇将在摩尔预测之后的53年将其预测与实际晶体管数量进行比较。
与摩尔定律相比,将确定最适合的常数来描述半导体上晶体管的指数增长。
本篇涉及到的知识
- 从*.csv文件中加载数据
- 使用最小二乘法来执行线性回归并预测指数增长
- 比较模型之间的指数增长常数
- 将分析结果存储为*.npz和*.csv文件中
- 评估半导体制造商在过去五年中取得的进步
接下来会使用到的函数功能说明
- np.loadtxt:this function loads text into a Numpy array
- np.log:this function takes the natural log(自然对数) of all elements in a Numpy array
- no.exp:this function takes the exponential of all elements in a Numpy array(计算以e为底的指数)
- lamba:this is a minimal function definition for creating a function model(创建模型的最小函数定义)
- plt.semilogy:this function will plot x-y data onto a figure with a linear x-axis and log10 y-axis(此函数会将 x-y 数据绘制到具有线性 x 轴和 log10 y 轴的图形上)
- plt.plot:this function will plot x-y data on linear axes;
- sm.OLS :find fitting parameters and standard errors using the statsmodels ordinary least squares model(使用 statsmodels 普通最小二乘模型查找拟合参数和标准误差)
- slicing arrays:view parts of the data loaded into the workspace,slice the arrays.e.g.x[:10] for the first 10 values in the array,x
- boolean array indexing:to view parts of the data that match a given condition use boolean operations to index an array
- np.block:to combine arrays into 2D arrays
- np.newaxis:to change a 1D vector to a row or column vector
- np.savaz an np.savatxt:these two functions will save your arrays in zipped array format and txt,respectively
moore law
1.您的经验模型假设每个半导体的晶体管数量呈指数增长,ln(transistor_count) = f(year) = A * year + B, A,B是fitting constant;式子变形得 transisor_count = e(Am*year+Bm)(Am,Bm,是每两年晶体管数量翻一番的常数,从 1971 年的 2250 个晶体管开始)
算出Am = 0.3466,Bm = -675.4
A_M = np.log(2) / 2 #np.log(2) 默认以e为底,np.log10(2) 以10为底
B_M = np.log(2250) - A_m * 1971
Moores_law = lambda year: np.exp(B_M) * np.exp(A_M * year)
# 根据摩尔定律,每个半导体上的晶体管数量每两年翻一番
ML_1971 = Moores_law(1971)
ML_1973 = Moores_law(1973)
print("In 1973,G. moore {:.0f} transistors on Intels chip".format(ML_1971))
print("This is x{:.2f} more transistors than 1971".format(ML_1973 / ML_1971))
# 输出
> In 1973, G. Moore expects 4500 transistors on Intels chips This is
> x2.00 more transistors than 1971
将历史工厂的数据加载到工作区间
NOW,make a prediction based