emms的最大似然估计与模型选择

exp-mixture-model的Python项目详细描述


exp_mixed_模型

指数混合模型的最大似然估计和模型选择(即指数分布混合)

使用此代码时,请引用以下文件:

冈田真本,山下健二,直田。 事件间时间的长尾分布是指数分布的混合。 arxiv:19xx.xxxxx

安装

exp_mixture_model托管在pypi上。因此,可以通过运行

pipinstallexp_mixture_model

如果要从源代码安装,请运行

gitclonehttps://github.com/naokimas/exp_mixture_model.git

然后,导航到克隆目录的顶层并运行

pythonsetup.pyinstall

您可以通过运行

pythonsetup.pytest

如果您使用anaconda,则可以通过运行

condainstall--filerequirements.txt

快速使用

运行

pythonemmfit.py-fsample.dat-k10
  • “10”是组件的初始数目。
  • “sample.dat”作为此包的一部分提供。我们通过运行
fromemmimportgenerate_emmx=generate_emm(1000,10)

若要在具有不同数量组件的EMM中选择最佳模型,请不要指定“k”,而是使用“-c”指定模型选择条件,如下所示。

pythonemmfit.py-fsample.dat-cDNML
  • 可以指定“边际对数似然”、“联合对数似然”、“AIC”、“BIC”、“AIC-LVC”、“BIC-LVC”、“NML-LVC”或“DNML”作为“-c”的参数
  • 默认值为“dnml”。

通过运行查看用法的详细信息

pythonemmfit.py--help

用法

通过运行使EMM适合数据

fromexp_mixture_modelimportEMMx=[1.5,2.3,...]# data can be either a list or numpy array## Alternatively, one can load data from a file using numpy as follows.## import numpy as np# x = np.loadtxt("sample.dat")#model=EMM()pi,mu=model.fit(x)# estimate the parametersmodel.print_result()# print 'k_final' (i.e., the estimated effective number of components) and the estimated parametersmodel.plot_survival_probability()# plot the survival probability (= cumulative complementary distribution function) for the estimated EMM and the given data 'x'.

根据模型选择标准,通过运行

fromexp_mixture_modelimportEMMsx=[1.5,2.3,...]emms=EMMs()emms.fit(x)# fit EMMs with different values of 'k', i.e., the number of components. The default uses 13 values of 'k'. This process is computationally heavy.best_model=emms.select('DNML')# select the best number of components under the 'DNML' criterion. One can specify either 'marginal_log_likelihood', 'joint_log_likelihood', 'AIC', 'BIC', 'AIC_LVC', 'BIC_LVC', 'NML_LVC', or 'DNML' as the argument of 'emms.select'.emms.print_result_table()# print the values of 'k_final', likelihoods, and 'DNML' for each 'k' valuebest_model.print_result()# print 'k_final' and the estimated parameter values of the selected EMM

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java如何从旧的ArrayList<ArrayList<Integer>>创建新的ArrayList而不更改旧的?   java JBoss 7 |从随机线程写入jndi   java如何在数据库中有空值的JPA实体中迭代联接列   java Android应用程序在setContentView上崩溃   java如何在表单中预先填充文本字段,其中包含数据库中的信息。jsp?   来自R.raw的java Android文件阅读器。文件   如何将多个WAR(或Java Web应用程序,特别是使用Spring MVC)嵌入到一个承载另一个WAR的网页中?   java动态更新Jlist   gwt分页大结果集Java的最佳方式是什么   JavaCDI:为什么我的瞬态字段被序列化?   使用JAXB更新java XML模板文件   java getGraphics()返回空值   扩展javax的java类。ws。rs.core。无法将应用程序强制转换为Servlet   java方法可能无法在异常时关闭流   公共类的表达式的java非法开始   java年轻一代GC在EXT根扫描上花费了太多时间   使用CXF和具有未发布元数据的WSDL的java