0% found this document useful (0 votes)
4 views8 pages

Bayesian Inference Concept

Bayesian Inference is a method for updating probabilities using new evidence, based on prior beliefs and observed data, and is widely utilized in data science. It involves Bayes' Theorem, which calculates the posterior probability using prior and likelihood. The document also discusses data collection methods, standard input/output in Python, and basic file handling techniques.

Uploaded by

sanketh0731
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views8 pages

Bayesian Inference Concept

Bayesian Inference is a method for updating probabilities using new evidence, based on prior beliefs and observed data, and is widely utilized in data science. It involves Bayes' Theorem, which calculates the posterior probability using prior and likelihood. The document also discusses data collection methods, standard input/output in Python, and basic file handling techniques.

Uploaded by

sanketh0731
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Bayesian Inference –

Concept
Bayesian Inference is a method of updating probabilities based on
new evidence
Based on conditional probability
Uses prior belief and observed data
Helps refine predictions as more data becomes available
Widely used in data science for uncertainty handling
Bayes' Theorem
Formula
P(A|B) = [P(B|A) × P(A)] / P(B)

Prior: initial belief before observing


data
Likelihood: probability of data given
hypothesis
Posterior: updated probability after
evidence
Example: updating probability of an
event after new observation
Getting Data – Sources
Multiple Sources Common Sources Data Structure
Data can be collected from Common sources include files, Data may be structured or
multiple sources databases, and web unstructured

Data Quality First Step


Quality of data affects analysis Data collection is the first step in
results data science
Methods of Data Collection

01 02 03

Reading data from local files Accessing data through web Web scraping for extracting
APIs online data

04 05

Converting raw data into usable format Preparing data for analysis
Standard Input and Output

Used for reading input and displaying output


Enables communication between programs
Useful in data pipelines and scripting

stdin stdout
Standard input stream Standard output stream
Usage in Python
[Link] [Link] Line-by-Line Command-Line
Used to read input Used to print output Processing Programs
Allows processing data Common in command-
line by line line programs

import sys
for line in [Link]:
print([Link]())
File Handling Basics
Files are used to store data permanently

Python provides functions to read files

Files must be opened before reading

Common file types include text and CSV

Proper handling ensures efficient data usage


Reading Files in Python

File Functions
open() is used to access files
read() reads entire file
readline() reads one line
readlines() reads all lines into list

Example Code

with open("[Link]") as f:
lines = [Link]()

You might also like