第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

如何獲取 scipy.special 函數(shù)以將 pymc3 RV 作為輸入

如何獲取 scipy.special 函數(shù)以將 pymc3 RV 作為輸入

慕哥9229398 2022-10-11 21:12:32
我正在嘗試使用 pymc3 來(lái)擬合涉及 voigt 函數(shù)的模型(來(lái)自 scipy.special)。voigt 函數(shù)的輸入應(yīng)該是數(shù)組,而 a,b 是 pymc3 類。如何獲得 scipy.special 函數(shù)以將 pymc3 RV 作為輸入?運(yùn)行下面附加的代碼會(huì)產(chǎn)生錯(cuò)誤:import pymc3 as pmfrom scipy.special import voigt_profileimport numpy as npwith pm.Model() as linear_model:    a = pm.Lognormal('a',mu=0, sigma=2.)    b = pm.Lognormal('b',mu=0, sigma=2.)    x = np.linspace(-1,1)    c = voigt_profile(x,a,b)TypeError: ufunc 'voigt_profile' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''
查看完整描述

1 回答

?
嗶嗶one

TA貢獻(xiàn)1854條經(jīng)驗(yàn) 獲得超8個(gè)贊

無(wú)論好壞,您都需要(重新)使用 theano 實(shí)現(xiàn)該功能。這是一個(gè)可行的簡(jiǎn)單版本:注意你不能使用erfc,因?yàn)?theano 出錯(cuò)了。


import theano.tensor as tt


def faddeeva(z):

    m = tt.exp(-tt.square(z))

    return (m - m * tt.erf(1.j * z))


def voigt_profile(x, sigma, gamma):

    z = (x + 1.j * gamma) / (tt.sqrt(2.) * sigma)

    return faddeeva(z).real / (sigma * tt.sqrt(2 * np.pi))


查看完整回答
反對(duì) 回復(fù) 2022-10-11
  • 1 回答
  • 0 關(guān)注
  • 137 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)