Probabilistic Deep Learning: With Python, Keras and TensorFlow Probability - mobi by Oliver Dürr & Beate Sick & Elvis Murina

Probabilistic Deep Learning: With Python, Keras and TensorFlow Probability - mobi by Oliver Dürr & Beate Sick & Elvis Murina

Author:Oliver Dürr & Beate Sick & Elvis Murina
Language: eng
Format: mobi
Publisher: Manning Publications Co.
Published: 2020-11-08T23:00:00+00:00


def NLL(y, distr):

return -distr.log_prob(y) ❶

def my_dist(params): ❷

return tfd.Normal(loc=params, scale=1)

# set the sd to the fixed value 1

inputs = Input(shape=(1,))

params = Dense(1)(inputs) ❸

dist = tfp.layers.DistributionLambda(my_dist)(params) ❹

model_sd_1 = Model(inputs=inputs, outputs=dist) ❺

model_sd_1.compile(Adam(), loss=NLL) ❻

❶ Computes the NLL of an observed y under the fitted distribution distr

❷ Uses the output of the last layer (params) as the parameter(s) of a distribution

❸ Sets up the NN with one output node

❹ Calls a distributional layer to take the function my_dist with the argument params

❺ Connects the output of the NN with a distribution

❻ Compiles the model with NLL as a loss function

With the TFP code in listing 5.2, you’ve fitted a linear regression model. But is it a probabilistic model? A probabilistic model needs to provide a whole CPD for the output for each input x. In the case of a Gaussian CPD, this not only requires an estimated mean μ x but also a standard deviation σ. In the standard linear regression case, a constant variance is chosen independently of the x position. In this case, we can estimate σ2 by the variance of the residuals. This means you first need to fit the linear model before you can determine the variance that is used for all CPDs.

Now you’re ready to use the trained model to do some probabilistic predictions on your validation data. For each test point, you’ll predict a Gaussian CPD. To visualize how the model performs on the validation data, you can draw the validation data along with the predicted mean of the CPD, μ x(see the solid line in figure 5.4), and the mean plus/minus two times the standard deviation of the CPD, μxi ± 2 ⋅ σx corresponding to the 0.025 and 0.975 quantiles (see the dashed lines in figure 5.4).



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Popular ebooks
Eco-friendly approach of bio-indigo synthesis and developing purification methods towards isolation of indigo from indirubin and bacterial fragments by Ramalingam Manivannan & Kaliyan Prabakaran & Young-A Son(204181)
Personalized inhaled bacteriophage therapy for treatment of multidrug-resistant Pseudomonas aeruginosa in cystic fibrosis by unknow(172728)
CONSORT 2025 statement: updated guideline for reporting randomized trials by unknow(81185)
Critical evaluation of the ProfiLER-02 study design and outcomes by Vivek Subbiah & Razelle Kurzrock(80754)
Cardiac gene therapy makes a comeback by Oliver J. Müller & Susanne Hille & Anca Kliesow Remes(80509)
Whisky: Malt Whiskies of Scotland (Collins Little Books) by dominic roskrow(74428)
Unveiling the design rules for tunable emission in graphene quantum dots: A high-throughput TDDFT and machine learning perspective by Şener Özönder & Mustafa Coşkun Özdemir & Caner Ünlü(50884)
A yeast-based oral therapeutic delivers immune checkpoint inhibitors to reduce intestinal tumor burden by unknow(40256)
Covalent hitchhikers guide proteins to the nucleus by Alexander F. Russell & Madeline F. Currie & Champak Chatterjee(40213)
Meet the Authors: Christopher R. Mansfield and Emily R. Derbyshire by Christopher R. Mansfield & Emily R. Derbyshire(40091)
Alkaline-earth metals promote propane dehydrogenation with carbon dioxide through geometric effects: Altering the reaction pathway by unknow(32728)
Induced iron vacancies boosting FeOOH loaded on sustainable Fenton-like collagen fiber membrane for efficient removal of emerging contaminants by unknow(32503)
Efficient electric-field-assisted photochemical conversion of methane to n-propanol exclusively over penetrated TiO2Ti hollow fibers by Guanghui Feng(32451)
Bi2SiO5 nanosheets as piezo-photocatalyst for efficient degradation of 2,4-Dichlorophenol by Hangyu Shi & Yifu Li & Lishan Zhang & Guoguan Liu & Qian Zhang & Xuan Ru & Shan Zhong(32382)
A novel NDIPTA organic heterojunction photocatalyst with built-in electric field for efficient hydrogen production by Jiahui Yang & Baojun Ma & Yongfa Zhu(32358)
Enhanced conversion of methane to liquid-phase oxygenates via hollow ferrite nanotube@horseradish peroxidase based photoenzymatic catalysis by Jun Duan & Shiying Fan & Xinyong Li & Shaomin Liu(32330)
Ordered macroporous superstructure of defective carbon adorned with tiny cobalt sulfide for selective electrocatalytic hydrogenation of cinnamaldehyde by Xiao-Shi Yuan & Sheng-Hua Zhou & San-Mei Wang & Wenbo Wei & Xiaofang Li & Xin-Tao Wu & Qi-Long Zhu(32256)
What's Done in Darkness by Kayla Perrin(27139)
Topological analysis of non-conjugated ethylene oxide cored dendrimers decorated with tetraphenylethylene: Insights from degree-based descriptors using the polynomial approach by A Theertha Nair & D Antony Xavier & Annmaria Baby & S Akhila(26517)
Investigation of mechanical and self-healing properties of hydroxyl-terminated polybutadiene functionalized with 2-ureido-4-pyrimidinone by Mohsen Kazazi & Mehran Hayaty & Ali Mousaviazar(26453)