bayesian

PyMC3 passing stochastic covariance matrix to pm.MvNormal()

落爺英雄遲暮 提交于 2021-02-10 16:47:45
问题 I've tried to fit a simple 2D gaussian model to observed data by using PyMC3. import numpy as np import pymc3 as pm n = 10000; np.random.seed(0) X = np.random.multivariate_normal([0,0], [[1,0],[0,1]], n); with pm.Model() as model: # PRIORS mu = [pm.Uniform('mux', lower=-1, upper=1), pm.Uniform('muy', lower=-1, upper=1)] cov = np.array([[pm.Uniform('a11', lower=0.1, upper=2), 0], [0, pm.Uniform('a22', lower=0.1, upper=2)]]) # LIKELIHOOD likelihood = pm.MvNormal('likelihood', mu=mu, cov=cov,

How to write model file for JAGS binomial using logit function

泪湿孤枕 提交于 2021-02-10 10:14:17
问题 I am working on an assignment using JAGS to model a binomial distribution who's p parameter is a function of another variable d . This is what I am trying to do: generate 10000 samples from the posterior for the two parameters alpha/beta produce samples to from the posterior predicted number of success when dist = 25 for 100 attempts calculate 95 credible interval for success rate at 25 feet distance I have written the model but it is giving an error. Below is the code I have already tried #R

How to write model file for JAGS binomial using logit function

情到浓时终转凉″ 提交于 2021-02-10 10:12:33
问题 I am working on an assignment using JAGS to model a binomial distribution who's p parameter is a function of another variable d . This is what I am trying to do: generate 10000 samples from the posterior for the two parameters alpha/beta produce samples to from the posterior predicted number of success when dist = 25 for 100 attempts calculate 95 credible interval for success rate at 25 feet distance I have written the model but it is giving an error. Below is the code I have already tried #R

How to write model file for JAGS binomial using logit function

不打扰是莪最后的温柔 提交于 2021-02-10 10:12:27
问题 I am working on an assignment using JAGS to model a binomial distribution who's p parameter is a function of another variable d . This is what I am trying to do: generate 10000 samples from the posterior for the two parameters alpha/beta produce samples to from the posterior predicted number of success when dist = 25 for 100 attempts calculate 95 credible interval for success rate at 25 feet distance I have written the model but it is giving an error. Below is the code I have already tried #R

深度学习调参技巧

一世执手 提交于 2021-02-09 09:52:40
1. 前言 我们在学习人工智能的时候,不管是机器学习还是深度学习都需要经历一个调参的过程,参数的好坏直接影响这模型效果的好坏。今天我们介绍下在深度学习中,调参的技巧主要分为哪些。 2. 深度学习中的主要参数 学习率(learning rate):学习率的取值一般是1、0.1、0.01、0.001等,我的建议是学习率从大到小,因为大的学习率运算的快,验证错误的速度快。并且我们的学习的过程一般通过Adam进行动态调整,基本问题不大。 网络层数:先从1层开始。 每层结点数:16,32,128,超过1000的情况比较少见。 batch size: 128左右开始 。batch取太大会陷入局部最小值,batch取太小会抖动厉害,因此要选择一个合适的batch size。 梯度裁剪: 限制最大梯度,如果梯度超过了阈值就进行截断。 dropout:在训练的时候可以设置一定的dropout,提升网络的健壮性,也能提升网络的计算速度。 词向量embedding大小:embedding的大小一般是128和256。 正负样本比例: 这个是非常忽视,但是在很多分类问题上,又非常重要的参数。很多人往往习惯使用训练数据中默认的正负类别比例,当训练数据非常不平衡的时候,模型很有可能会偏向数目较大的类别,从而影响最终训练结果。除了尝试训练数据默认的正负类别比例之外,建议对数目较小的样本做过采样,例如进行复制

Can we obtain hybrid algorithm for spam filtering from Naive Bayes & SVM?

自闭症网瘾萝莉.ら 提交于 2021-02-08 10:22:06
问题 I am developing a spam filtering application. I need suggestions regarding the hybrid algorithm from Naive Bayes & SVM.(e.g. based on feature vector, probabilities). Any help is appreciated. Can we develop hybrid algorithm from Naive bayes & SVM? 回答1: Not sure why would you want to merge these two specific methods, but you could use ensemble learning methods for that. EDIT: based on your comments, it seems you already have two independently trained classifiers, and would like to use them

Dirichlet Multinomial model in JAGS with categorical X

南楼画角 提交于 2021-02-08 10:01:13
问题 Can someone help with JAGS code for a Bayesian multinomial logistic model with one categorical X variable (Dirichlet prior)? My representative sample is the matrix "z" in the code below that represents the 3 outcomes and "site", in the bottom line of code, is the categorical x variable. I can get the code that estimates each of the 3 outcomes but I'm stumped on how to add a categorical X (hospital site). I would like to use the first outcome, z[, 1], as the reference and 'a' as the reference

Dirichlet Multinomial model in JAGS with categorical X

时光总嘲笑我的痴心妄想 提交于 2021-02-08 10:00:22
问题 Can someone help with JAGS code for a Bayesian multinomial logistic model with one categorical X variable (Dirichlet prior)? My representative sample is the matrix "z" in the code below that represents the 3 outcomes and "site", in the bottom line of code, is the categorical x variable. I can get the code that estimates each of the 3 outcomes but I'm stumped on how to add a categorical X (hospital site). I would like to use the first outcome, z[, 1], as the reference and 'a' as the reference

How to implement 1D Kalman filter with other distribution?

对着背影说爱祢 提交于 2021-01-29 05:42:37
问题 I have been through the concept of 1D Kalman filter, but, they mostly concentrate on the equations formed from Gaussian distributions where they used the equations in the picture Gaussian Distribution equations (they can be found in the following links: Pyata 1D Kalman Filter, 1D Kalman Filter, Sensor Fusion). I have several questions: Question 1: How can I form predict and update states with other distributions? (for example, Bradford distribution) I looked into Bradford distribution and

推荐 :一文带你熟悉贝叶斯统计

萝らか妹 提交于 2021-01-29 04:47:10
作者:Matthew Ward 翻译:陈之炎 校对:陈丹 本文 约5000字 ,建议阅读 10+ 分钟 本文为你带来贝叶斯统计的基础示例及全面解释。 图:Unsplash,Chris Liverani 贝叶斯统计这个术语最近被广泛使用。它常用于社交场合、游戏和日常生活中,如棒球、扑克、天气预报、总统选举投票等。 在许多科学领域,可以用贝叶斯统计来确定粒子物理和药物有效性实验的结果,它还可用于机器学习和人工智能,以预测你想看什么新闻故事或观看什么Netflix节目。 不管是否对它有充分的理解,贝叶斯统计已融入了我们的日常生活当中,为此,笔者想通过本文对贝叶斯统计做全面的解读,通过一个详尽的例子来展示这个术语的含义。一旦你理解了这个例子,那么便基本上理解了贝叶斯统计。 首先,在读本文之前,假设读者事先对Bayes定理有所熟悉,愿意把公式当成一个黑匣子的读者,也不成问题。如果需要复习一下贝叶斯定理的话,可以到 Medium resources(https://towardsdatascience.com/bayes-theorem-the-holy-grail-of-data-science-55d93315defb)中查找相关资源。 示例和原始观察 这是教科书中经常用到的一个经典例子,我是十多年前在John Kruschke的《DoingBayesian Data Analysis: