{"text_format":"2","workbook":"xlsx","n_sheets":7,"sheets":["Numpy","pandas","Matplotlib|pandas Drawing","Scikit-learn","Text Processing","Graphic Processing","Series and Speech Data"],"not_rendered":{"charts":0,"images":0,"macros":0,"external_links":0,"defined_names":0,"comments":0,"pivot_tables":0},"unopened":[],"bounds":{"document_bytes":16777216,"sheet_cells":100000,"run_cost":"one","rows_first":2000,"rows_last":500,"rows_between":2000,"halvings":0,"cell_chars":16384,"cell_head_chars":4096},"cells_cut":0,"cells_raw":0,"read":"whole","date_system":"1900"}

{"sheet":"Numpy","index":0,"n_rows":57,"n_cols":5,"rows_kept":57,"cut":false,"hidden":false,"merged":[]}
[null,"引用模块","函数/属性名","实例","说明"]
[null,"import numpy as np"]
[null,"1）基本属性"]
[null,null,"array.ndim",null,"数组维度"]
[null,null,"array.size",null,"数组元素个数"]
[null,null,"array.dtype",null,"数组数据类型"]
[]
[null,"2) 基本函数"]
[null,null,"np.set_printoptions()","np.set_printoptions(precision=4, suppress=True)","设置输出精度，是否使用科学计算"]
[null,null,"np.array()","np.array([[1,2,3,4],[0,1,2,3]] )","创建 ndarray对象"]
[null,null,"np.arange()","np.arange(15)\nnp.arrange(-3,3,0.2)  #0.2为步长","创建一个等差数组"]
[null,null,"np.zeros()","np.zeros(10)\nnp.zeros( (3,6) )","生成一个给定大小的全0数组"]
[null,null,"np.ones()","np.ones( (2,3,2) ）","生成一个给定大小的全1数组"]
[null,null,"np.reshape()","np.arange(15).reshape(3, 5)","将一维数组转换为指定的多维数组"]
[null,null,"np.diag()",null,"指定主对角线值"]
[null,null,"np.eye()","np.eye(3)","生成一个对角线为1的3阶单位矩阵"]
[null,"3) 通用数学函数"]
[null,null,"np.abs()、np.fabs()","np.abs(x)，np.fabs(x)","计算整数、浮点数或复数的绝对值"]
[null,null,"np.sqrt()","np.sqrt(arr)","计算各元素的平方根"]
[null,null,"np.square()","np.square(x)","计算各元素的平方"]
[null,null,"np.exp()","np.exp(arr)","计算各元素的指数"]
[null,null,"np.sin()、np.cos()、np.cosh()、np.sin() \nnp.sinh()、np.tan()、np.tanh()\n","np.sin(arr)","普通和双曲型三角函数"]
[null,null,"np.floor()","np.floor(arr/10) #将arr转换成整数形式的十分制分数","计算各元素的floor值，即小于等于该值的最大整数"]
[null,null,"np.ceil()",null,"计算各元素的ceiling值，即大于等于该值的最小整数"]
[null,null,"np.log",null,"计算各元素的自然对数"]
[null,"3) 二元函数"]
[null,null,"np.add()",null,"将数据中对应的元素相加"]
[null,null,"np.subtract()",null,"从第一个数组中减去第二个数组中的元素"]
[null,null,"np.multiply()",null,"数组元素相乘"]
[null,null,"np.divide()",null,"除法或向下取整除法"]
[null,null,"np.power()",null,"对第一个数组中的元素A，根据第二个数组中的相应元素B，计算AB"]
[null,null,"np.mod()",null,"元素级的求模运算"]
[null,null,"np.copysign()",null,"将第二个数组中的值的符号复制给第一个数组中的值"]
[null,null,"np.equal(),np.not_equal()",null,"执行元素级的比较运算，产生布尔型数组"]
[]
[null,"4) 聚集函数"]
[null,null,"array.sum()","arr.sum() #全部求和\narr.sum(1) #按给定轴求和，产生低一维的数组","求和函数"]
[null,null,"array.mean()","arr.mean()","算术平均值"]
[null,null,"array.min()、array.max()","arr.max()、arr.min()","最大值和最小值"]
[null,null,"array.argmin()、array.argmax()","arr.argmax()、arr.argmin()","最大值和最小值的索引(逐行逐列访问序号）"]
[null,null,"array.cumsum()","arr.cumsum(axis = 1)  #逐列求累加和","从0开始向前累加各元素"]
[null,null,"array.cumprod()","arr.cumprod()","从1开始向前累乘各元素"]
[null,null,"array.median()","arr.median()"]
[null,null,"np.var,np.std",null,"求方差，标准差"]
[null,"5) 随机生成函数"]
[null,null,"np.random.random()",null,"随机产生[0,1)之间的浮点值"]
[null,null,"np.random.randint()","np.random.randint(0, 2, size = (2,10)) #生成0-1之间的整数随机数，维度是2*10","随机生成给定范围内的一组整数"]
[null,null,"np.random.uniform()",null,"随机生成给定范围内服从均匀分布的一组浮点数"]
[null,null,"np.random.choice()",null,"在给定的序列内随机选择元素"]
[null,null,"np.random.normal()","np.random.normal( 1, 2.1, size=(4,4) ) #生成4*4的矩阵，均值为1，方差为2.1","随机生成一组服从给定均值和方差的正态分布随机数"]
[]
[null,"6) 条件逻辑的数组运算"]
[null,null,"np.where()","result = np.where(cond, xarr, yarr)\nnp.where( arr>0, 2, -2)   #将arr数组中>0的替换为2，其余替换为-2\nnp.where( arr>0, 2, arr)   #将arr数组中>0的替换为2，其余不变","三元表达式：x if condition else y的矢量化版本"]
[null,"7)排序函数"]
[null,null,"np.sort()","np.sort(array,axis=0/1(列/行),order=)","排序返回新对象"]
[null,null,"sort()","同上","改变原对象"]
[null,null,"np.argsort()","同上","返回排序后索引值（array对象）"]

{"sheet":"pandas","index":1,"n_rows":60,"n_cols":5,"rows_kept":60,"cut":false,"hidden":false,"merged":[]}
[null,"引用模块","函数/属性名","实例","说明"]
[null,"import pandas as pd"]
[null,"1) pandas数据结构"]
[null,null,"Series()","obj1=Series([4,7,5,3],index=['d','b','a','c'])   #创建带索引的Series\nstates=['California','Ohio','Oregon']    #使用字典创建Series\nobj3=Series(sdata,index=states)   ","创建Series"]
[null,null,"sr.drop(labels=)","sr.drop([1,2],inplace=True)","删除索引的对象成员"]
[null,null,"DataFrame()","frame2=DataFrame([[1,2,3],[4,5,6]],columns=['a','b','c'],index=['x','y'])","创建DataFrame"]
[null,"基于索引名选取","obj[ col ]",null,"选取某列"]
[null,null,"obj[ colList ]","students[['height','weight']] ","选取某几列"]
[null,null,"obj.loc[ index, col ]",null,"选取某行某列"]
[null,null,"obj.loc[ indexList, colList ]",null,"选取多行多列"]
[null,"基于位置序号选取","obj.iloc[ iloc, cloc]",null,"选取某行某列"]
[null,null,"obj.iloc[ ilocList, clocList ]",null,"选取多行多列"]
[null,null,"obj.iloc[ a:b, c:d ]","students.iloc[1:, 0:2]","选取a~(b-1)行, c~(d-1)列"]
[null,"条件筛选","obj.loc[ condition, colList ]","students.loc[ students['height']>=168, ['height','weight'] ] ","使用索引构造条件表达式，选取满足条件的行"]
[null,null,"obj.iloc[ condition, clocList ]",null,"使用位置序号构造条件表达式，选取满足条件的行"]
[null,null,"obj[colname] = list","students['expense'] = [1500,1600,1200]","添加新列"]
[null,null,"obj.drop(collist, axis, inplace,...)","students.drop(1, axis=0)\nstudents.drop('expense', axis=1)","删除某几列"]
[null,"时间函数","pd.date_range(start=,end=,periods=,freq=)","dates=pd.date_range('20190708',periods=6,freq='D')","创建日期序列，返回DatetimeIndex对象"]
[null,"2) 数据文件读写"]
[null,null,"pd.read_csv()","pd.read_csv('1111.csv', index_col = 0, skiprows = [1,3,5], header = None, names = None)","读取CSV文件数据（带分隔符的数据,默认为逗号）"]
[null,null,"object.to_csv()","ts = Series(np.arange(7), index=dates) \nts.to_csv('ch06/tseries.csv')","将DataFrame或Series中的数据写到一个以逗号分隔的文件中"]
[null,null,"pd.read_excel()","pd.read_excal('a.xlsx')","从excel文件中读取数据"]
[null,null,"skiprows参数","pd.read_csv('ch06/ex4.csv', skiprows=[0, 2, 3]) #跳过文件的第一行、第三行和第四行","跳过文件中的某些行"]
[null,null,"na_values参数","pd.read_csv('ch06/ex5.csv' ,na_values=['NULL'])","可以接受一组用于表示缺失值的字符串"]
[null,null,"nrows参数","pd.read_csv('ch06/ex6.csv' , nrows=5)  #nrows=5表示读取前5行","逐行读取文本文件"]
[null,null,"delimiter参数","reader = csv.reader(f, delimiter= '|')","用于分隔字段的单字符字符串。默认','"]
[]
[null,"3) 数据清洗"]
[null,null,"dataframe.dropna()","data1.dropna(thresh=3)  #thresh代表保留几个有效值","滤除缺失数据"]
[null,null,"dataframe.fillna()","df1.fillna(0)\nstu.fillna({'年龄':20, '体重':stu['体重'].mean()} )\nmethod='ffill'    method='bfill'   ","填充缺失数据"]
[null,null,"dataframe.duplicates()",null,"标记重复行，返回布尔类型Series对象"]
[null,null,"dataframe.drop_duplicates()","df1.drop_duplicates()","去除重复数据"]
[null,null,"dataframe.isnull()","stu.isnull()","检测每个元素值是否是NaN"]
[null,null,"dataframe.any()","stu.isnull().any() ","按行或列检测是否有值为Flase"]
[null,null,"dataframe.drop（）","a.drop(2,axis=0)","按行列删除数据，位置取决labels，行列取决axis"]
[null,"4) 数据规整化"]
[null,null,"pd.concat()","pd.concat([s1, s2, s3])  #默认情况下，concat按照行叠加","轴向连接函数，沿着指定轴将多个对象堆叠到一起"]
[null,null,"pd.merge()","pd.merge(newstu,card, how='left', left_on='学号', right_on='ID') ","按照给定列连接两张表中数据"]
[null,null,"dataframe.sort_values()","stu.sort_values(by='成绩', ascending=False) ","按照给定列排序"]
[null,null,"dataframe.rank()","stu['成绩'].rank(method='min', ascending=False) ","按照指定轴给出每个数据排名"]
[]
[null,"5) 统计分析"]
[null,null,"sr.value_counts()",null,"Series各取值出现的频数"]
[null,null,"sr.unique()",null,"Series出现的值"]
[null,null,"sr.describe()","stu[['身高','体重','成绩']].describe() ","返回基本统计量和分位数"]
[null,null,"sr1.corr(sr2)","stu['身高'].corr( stu['体重'] )","sr1与sr2的相关系数"]
[null,null,"df.corr()","stu[['身高','体重','成绩'] ].corr() ","df各列的相关系数"]
[null,null,"df.count()",null,"统计每列数据个数"]
[null,null,"df.max()、df.min()",null,"最大值和最小值"]
[null,null,"df.idxmax()、df.idxmin()",null,"最大值、最小值对应的索引"]
[null,null,"df.sum()",null,"按行或列求和"]
[null,null,"df.mean()、df.median()","stu['成绩'].mean() ","计算均值、中位数"]
[null,null,"df.qantile()","tu['月生活费'].quantile( [.25, .75] ) ","计算给定的四分位数"]
[null,null,"df.var()、df.std()",null,"计算方差、标准差"]
[null,null,"df.mode()",null,"计算众数"]
[null,null,"df.cumsum()",null,"从0开始向前累加各元素"]
[null,null,"df.cov()","stu[['身高','体重','成绩'] ].corr() ","计算协方差矩阵"]
[null,null,"pd.crosstab(df[col1],df[col2])","pd.crosstab( stu['性别'], stu['月生活费']) ","pandas函数，交叉表，计算分组的频率"]
[null,null,"dataframe.groupby()","grouped = stu.groupby(['性别', '年龄']) ","按照指定索引将数据划分为多个组"]
[null,null,"grouped.aggregate()","grouped.aggregate( {'身高':np.mean, '月生活费':np.max } )","按照给定统计方法分组统计"]

{"sheet":"Matplotlib|pandas Drawing","index":2,"n_rows":38,"n_cols":5,"rows_kept":38,"cut":false,"hidden":false,"merged":[]}
[null,"引用模块","函数/属性名","实例","说明"]
[null,"import matplotlib.pyplot as plt"]
[null,"1）pandas绘图"]
[null,null,"dataframe.plot()","data.plot(title='2010~2016 GDP',LineWidth=2, marker='o', linestyle='dashed',color='r', grid=True,alpha=0.9,use_index=True,yticks=[3.5,4.0,4.5,5.0,5.5,6.0,6.5,7.0,7.5])\n#b---blue   c---cyan  g---green    k----black m---magenta r---red  w---white    y----yellow\n#'  ‘‐'     实线   '‐‐'   破折线  '‐.'    点划线   ‘ :’   虚线    ‘*’ 星性\n# 'o'     实心圈标记  'v'  倒三角标记   's' 实心方形标记   'p'实心五角标记","pandas绘制图形"]
[null,null,"dataframe.plot.scatter()","stdata.plot.scatter(x='Height',y='Weight',title='Students Body Shape', marker='*',grid=True, xlim=[150,200], ylim=[40,80], label='(Height,Weight)')","pandas绘制散点图"]
[null,null,"pd.plotting.scatter_matrix()","pd.plotting.scatter_matrix(data,diagonal='kde',color='k') ","绘制散点图矩阵"]
[null,null,"dataframe.boxplot()","df1.boxplot(by='Gender',figsize=(6,6))","绘制箱须图"]
[]
[null,null,"(series/dataframe).plot()","s.plot(kind='bar', ax=axes[0], color='b', alpha=0.7)\ns.plot(kind='barh', ax=axes[1], color='y', alpha=0.7)\ndf.plot(kind='barh', ax=axes[1], stacked=True, alpha=0.5)\ns.plot(kind='pie', figsize=(6,6), title='Party size') \ns.plot(kind=’hist’,bins=6,normed=True)\ns.plot(kind='kde',title='istribution',xlim=[0,1000], style = 'k--')","绘制各类图\n绘制(堆积)柱状图、绘制饼图、直方图、概率密度图"]
[null,null,null,"x","x轴数据，默认值为None"]
[null,null,null,"y","y轴数据，默认值为None"]
[null,null,null,"kind","绘图类型。‘line’：折线图，默认值；‘bar’：垂直柱状图； ‘barh’：水平柱状图； ‘hist’-直方图； ‘box’-箱线图； ‘kde’-Kernel核密度估计图； ‘density’：-与‘kde’相同； ‘pie’：饼图； ‘scatter’：散点图 "]
[null,null,null,"title","图形标题，字符串"]
[null,null,null,"color","画笔颜色。用颜色缩写如’r’、’b’，或RGB值，如’#CECECE’。主要颜色缩写：b-blue c-cyan g-green k-black m-magenta r-red  w-white y-yellow"]
[null,null,null,"grid","图形是否有网格，默认值为None"]
[null,null,null,"fontsize","坐标轴（包括x轴和y轴）刻度的字体大小。整数，默认值为None"]
[null,null,null,"alpha","图表的透明度，0~1之间，图表的透明度，值越大颜色越深"]
[null,null,null,"use_index ","默认为True，用索引做x轴刻度"]
[null,null,null,"linewidth","绘图线宽"]
[null,null,null,"linestyle","绘图线型。'‐'实线 '‐‐'破折线 '‐.'点划线 ‘:’ 虚线"]
[null,null,null,"marker","标记风格。’.’点 ‘,’像素（极小点）’o’实心圈 ‘v’倒三角 ‘^’上三角 ‘>’右三角 ‘<’左三角 ‘1’下花三角 ‘2’上花三角 ‘3’左花三角 ‘4’右花三角 ‘s’实心方形 ‘p’实心五角 ‘*’星形 ‘h’’/’’H’竖/横六边形 ‘|’垂直线 ‘+’十字 ‘x’x ’D’菱形 ‘d’瘦菱形"]
[]
[null,"2）Matplotlib绘图"]
[null,null,"plt.figure()","fig = plt.figure(figsize=(8,4)) #figsize参数指定绘图区域的宽度和高度，英寸","创建一个绘图对象"]
[null,null,"plt.plot()","plt.plot(x, y, 'o-', color='green', linewidth=2.0)\n","绘制线性图"]
[null,null,"plt.xlabel()、plt.ylabel()","plt.xlabel(‘时间(s)’, fontproperties='SimHei', fontsize=15)\nplt.ylabel(‘幅度(mV)’, fontproperties='SimHei', fontsize=15)","设置当前x轴、y轴的标签"]
[null,null,"plt.title()","plt.title('Figure 1')","设置标题"]
[null,null,"plt.xticks()、plt.yticks()","plt.xticks(range(0,7),('2010','2011','2012','2013','2014','2015','2016')) ","设置当前x轴、y轴刻度位置的标签和值"]
[null,null,"plt.legend()","plt.legend(loc=‘best’, fontsize=20)  ","添加图例"]
[null,null,"plt.axis()","plt.axis([0, 6, 0, 1.8])","设置x, y坐标轴最小最大取值范围"]
[null,null,"plt.xlim()、plt.ylim()","plt.xlim([0, 5*np.pi/3])、plt.ylim([0, 5*np.pi/3])","设置当前x轴、y轴取值范围"]
[null,null,"plt.text()","plt.text(1.8,7.5,'GDP keeps booming!',fontsize='larger')","添加注解文字"]
[null,null,"plt.annotate()","plt.annotate('turning point',xy=(1,7.8),xytext=(0.5,7.5), arrowprops=dict(arrowstyle='->'))","添加注释"]
[null,null,"plt.grid()","plt.grid(True)","打开或者关闭坐标网格"]
[null,null,"plt.figure().add_subplot()","ax1=fig.add_subplot(2,1,1)   ","创建子图"]
[null,null,"figure.savefig()","fig.savefig('2010-2012GDP.jpg',dpi=400,bbox_inches='tight')","保存图形"]
[null,null,"plt.scatter()","plt.scatter(x1, x2)","绘制单张散点图"]
[null,null,"plt.show() ","plt.show() ","显示并关闭绘图"]

{"sheet":"Scikit-learn","index":3,"n_rows":28,"n_cols":5,"rows_kept":28,"cut":false,"hidden":false,"merged":[]}
[null,"引用模块","函数/属性名","实例","说明"]
[null,"1) 预处理"]
[null,null,"data.values.astype()","X = data.iloc[ :, 0:5 ].values.astype(float)\ny = data.iloc[ :, 5].values.astype(int)","从DataFrame获取ndarray"]
[null,"from sklearn import model_selection","train_test_split()","X_train, X_test, y_train, y_test = model_selection.train_test_split(X, y, test_size=0.35, random_state=1)","按比例随机划分训练集、测试集"]
[null,"from sklearn import preprocessing","scale()","X_scale = preprocessing.scale(X)","将数值型数据标准化处理"]
[]
[null,"2) 初始化、训练模型，预测"]
[null,"from sklearn import tree","DecisionTreeClassifier()","clf = tree.DecisionTreeClassifier()","初始化决策树模型"]
[null,"from sklearn import svm","SVC()","clf = svm.SVC(kernel='rbf', gamma=0.6, C = 1.0)","初始化支持向量机模型"]
[null,"from sklearn.cluster import KMeans","LinearRegression()","linreg = LinearRegression()","初始化线性回归模型"]
[null,"from sklearn import tree","KMeans()","kmeans = KMeans(n_clusters=3)   ","KMeans模型初始化"]
[null,"from sklearn.neural_network import MLPClassifier","MLPClassifier()","mlp = MLPClassifier(solver='lbfgs',alpha=1e-5,hidden_layer_sizes=(5, 5), random_state=1)","神经网络模型初始化"]
[]
[null,null,"model.fit()","clf.fit(X, y)   \nkmeans.fit(X)   ","有监督学习，输入X，y\n无监督学习，输入X"]
[null,null,"model.predict()","print(\"预期销售：\",load_linreg.predict(new_X) ) ","使用模型预测"]
[null,null,"model.score()","decision_score = linreg.score(X, y) \npredict_score =linregTr.score(X_test,y_test)","计算回归函数的决定系数\n计算分类器的正确率"]
[]
[null,"3) 评估模型性能"]
[null,"from sklearn import metrics"]
[null,null,"mean_squared_error()","test_err = metrics.mean_squared_error(y_test, y_test_pred) ","计算均方误差"]
[null,null,"confusion_matrix()","metrics.confusion_matrix(y, predicted_y)","计算混淆矩阵"]
[null,null,"classification_report()","metrics.classification_report(y, predicted_y)","生成分类性能报告"]
[null,null,"adjusted_rand_score()","metrics.adjusted_rand_score(y, kmeans.labels_)","计算兰德指数"]
[null,null,"silhouette_score()","metrics.silhouette_score( X,kmeans.labels_,metric='euclidean' )","计算轮廓系数"]
[]
[null,"4）保存、加载模型"]
[null,"from sklearn.externals import joblib","dump()","joblib.dump(linreg, 'linreg.pkl')","将模型保存至文件"]
[null,null,"load()","load_linreg = joblib.load('linreg.pkl') ","从文件读取模型"]

{"sheet":"Text Processing","index":4,"n_rows":16,"n_cols":5,"rows_kept":16,"cut":false,"hidden":false,"merged":[]}
[null,"引用模块","函数/属性名","实例","说明"]
[null,"1) 分词、词性标注"]
[null,"import jieba","jieba.cut()","jieba.lcut(\"2018年世界杯小组赛\")\n#sentence：待分词的字符串；cut_all：是否采用全模式；HMM：是否使用 HMM 模型。","分词，返回可迭代的generator。支持精确模式和全模式"]
[null,null,"jieba.cut_for_search()","#sentence：待分词的字符串；HMM：是否使用 HMM 模型。","分词，返回可迭代的 generator。该方法为搜索引擎模式，适合用于建立搜索引擎构建倒排索引，粒度比较细"]
[null,null,"jieba.lcut()"," jieba.lcut(\"2018年世界杯小组赛\", cut_all = True)","与cut函数类似，直接返回词列表"]
[null,null,"jieba.lcut_for_search()"," jieba.lcut_for_search(\"2018年世界杯小组赛\")","与cut_for_search函数类似，直接返回词列表"]
[null,"import jieba.posseg as pseg","pseg.cut","words = pseg.cut(\"2018年世界杯小组赛\")","分词同时标注词性"]
[]
[]
[null,"2）特征提取"]
[null,"from sklearn.feature_extraction.text import CountVectorizer","CountVectorizer()","cv = CountVectorizer()","词袋模型初始化"]
[null,null,"cv.fit_transform()","cv_fit=cv.fit_transform(split_corpus)","生成词袋向量"]
[null,"from sklearn.feature_extraction.text import TfidfTransformer","TfidfTransformer()","tfidf_transformer = TfidfTransformer()","TFIDF转换器初始化"]
[null,null,"tfidf_transformer.fit_transform()","tfidf_fit = tfidf_transformer.fit_transform(cv_fit)","将词袋向量转换为TFIDF向量"]
[null,"from sklearn.feature_extraction.text import TfidfVectorizer","TfidfVectorizer()","tfidf = TfidfVectorizer(token_pattern=r\"(?u)\\b\\w+\\b\")","初始化TFIDF模型"]
[null,null,"tfidf.fit_transform","tfidf_fit=tfidf.fit_transform(split_corpus)","生成TFIDF向量"]

{"sheet":"Graphic Processing","index":5,"n_rows":18,"n_cols":5,"rows_kept":18,"cut":false,"hidden":false,"merged":[]}
[null,"引用模块","函数/属性名","实例","说明"]
[null,"1) 图形处理"]
[null,"from skimage import io ","io.imread() ","robot = io.imread(\"data/Robot.jpg\") ","从文件中读取图像数据"]
[null,null,"img.shape","robot.shape","图像像素和颜色字节数"]
[null,null,"io.imshow()","io.imshow(robot)","显示图像"]
[null,null,"io.show()",null,"显示"]
[null,null,"io.imsave()","io.imsave('data/RobotHead.jpg', head)","将图像数据保存到文件"]
[]
[null,"2) 深度神经网络库keras"]
[null,"from keras.models import Sequential","Sequential()","model = Sequential()","序贯模型初始化"]
[null,"from keras.layers import Dense","Dense()","model.add(Dense(units=16, input_dim=4))","创建Dense层"]
[null,"from keras.layers import Activation","Activation()","model.add(Activation('relu'))","创建Activation层"]
[null,"from keras.layers import Dropout","Dropout()","model.add(Dropout(0.25))  #随机断开25%的连接","创建Dropout层"]
[null,"from keras.layers import Conv2D","Conv2D()","model.add(Conv2D(32, (3, 3), padding='same', \n input_shape=x_train.shape[1:]))\n","创建Conv2D层"]
[null,"from keras.layers import MaxPooling2D","MaxPooling2D()","model.add(MaxPooling2D(pool_size=(2, 2)))","创建MaxPooling2D层"]
[null,"from keras.layers import Flattern","Flattern()","model.add(Flatten())","创建Flattern层"]
[null,null,"model.compile()","model.compile(loss='categorical_crossentropy', optimizer='adam', metrics=[\"accuracy\"])","模型编译"]
[null,null,null,"scores = model.evaluate(x_test, y_test, verbose=1)","评估模型性能"]

{"sheet":"Series and Speech Data","index":6,"n_rows":15,"n_cols":5,"rows_kept":15,"cut":false,"hidden":false,"merged":[]}
[]
[null,"引用模块","函数/属性名","实例","说明"]
[null,"1) ARIMA算法"]
[null,"from statsmodels.graphics.tsaplots import plot_acf","plot_acf() ","plot_acf(data) ","绘制自相关图"]
[null,null,"plot_pacf()","plot_pacf(D_data)","绘制偏自相关图"]
[null,"from statsmodels.stats.diagnostic import acorr_ljungbox","acorr_ljungbox()","acorr_ljungbox(data['股价'], lags=1)","白噪声-检验，纯随机性检验"]
[null,"from statsmodels.tsa.stattools import adfuller as ADF"," ADF()"," ADF(data['股价'])","ADF检验，自相关性检验"]
[null,"from statsmodels.tsa.arima_model import ARIMA","ARIMA().fit()","model = ARIMA(data, (p,1,q)).fit()","输入数据，建立ARIMA模型"]
[null,null,"model.aic","model.aic","计算模型AIC信息准则"]
[null,null,"model.summary2()","model.summary2()","给出模型的分析报告"]
[null,null,"model.forecast(5)","model.forecast(5)","使用模型预测"]
[]
[null,"2）语音识别"]
[null,"from aip import AipSpeech","AipSpeech()","client = AipSpeech(APP_ID, API_KEY, SECRET_KEY) ","语音识别模型初始化"]
[null,null,"client.asr()","result = aipSpeech.asr(get_file_content(file_name), 'wav', 16000, {'dev_ip': '1536'})","识别语音文件"]