![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_224,w_224)
DL and Statistical Model
Deep learning and Statistical Model
Cmmm丶
分享python科研小技巧~
展开
-
RuntimeError: Cannot clone object <tensorflow.python.keras.wrappers.scikit_learn.KerasClassifier obj
点赞发Nature关注中Science用sklearn.GridSearchCV时,def create_model( i=0, # ith country neurons_First=30, # neurons in the first layer neurons_Second=30, # neurons in the second layer layer=1, # number of layers dropout_rate=0.2, # dropo原创 2021-03-15 15:11:39 · 4027 阅读 · 12 评论 -
python Deep learning: 用tensorflow keras快速生成时间序列数据
点赞发Nature关注中Science做时间序列预测的时候,一般需要先对数据进行时间序列处理,形成以一定数据结构之后才能输入深度学习模型进行预测。tensorflow.keras提供了十分方便的预处理包TimeseriesGenerator:from keras.preprocessing.sequence import TimeseriesGenerator# 对于任一的时间序列数据 dataframedata_processed = TimeseriesGenerator(原创 2021-03-10 18:36:11 · 394 阅读 · 0 评论 -
python Deep Learning: keras.backend.clear_session()清除keras模型占用内存
点赞发Nature关注中Science在用tensorflow运行keras模型时,我发现运行完model.predict()之后,模型并不会自动关闭,还是回留存在RAM中,如果使用 for loop循环使用model.predict时,就会发生内存崩溃的情况。用keras.backend.clear_session()方法可以有效解决模型的内存占用问题。from tensorflow.keras.backend import clear_sessionfrom tensorflow.keras.原创 2020-10-22 11:56:36 · 4179 阅读 · 1 评论 -
Discussion: 神经网络neural network与计量经济学模型econometric model比较
点赞发Nature关注中Science近年来,机器学习方法越来越广泛的应用到了经济、金融领域的研究。其中以基于深度学习的神经网络算法最火。最近读了一些相关的文献,本文简单总结一下神经网络方法,并将该方法与计量经济学方法进行比较。首先要说明,为什么要将神经网络方法和计量经济学方法进行比较。我们知道,计量经济学模型,通过给解释变量与被解释变量之间设置一定的初始函数关系(一般为线性关系),基于经验数据,拟合函数关系中的关键参数,最后得到基于经验的解释变量与被解释变量之间的关系。进而,预测未来被解释变量的走势原创 2020-10-02 10:51:53 · 1155 阅读 · 0 评论 -
Python Statistical model: 用Scipy做线性回归分析 (一步实现p value、标准差计算)
点赞发Nature关注中Sciencep-value表示线性回归中的斜率、截距的显著性,p-value越小,表示得到的结果越显著。之前我用curve fit的方法实现了线性函数的拟合,但是这有些大材小用了,而且过程较为繁琐,不方便p值等的计算。curve fit方法实现线性拟合用scipy.stats linregress方法可以一步实现包括斜率、截距、标准差、p值的计算:from scipy import stats import numpy as npx = np.random.ran原创 2020-08-31 21:29:08 · 4522 阅读 · 0 评论 -
Python Statistical model: 用Scipy curve_fit方法做曲线拟合
点赞发Nature关注中Science最近在学习一些计量相关的东西,我看别人一般都是 用State或者Eviews做计量分析,我试了试用python做,下面是用python做的简单的线性回归分析。from scipy.optimize import curve_fitdef cost_func(x_data, c1): return c1 * x #目标函数形式def cost_curve_fit(x_data, y_data, region): c, cov = cur原创 2020-08-28 12:27:14 · 509 阅读 · 0 评论