ML - Lab - 1 J2

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 11

ML-LAB -

1. The probability that it is Friday and that a student is absent is 3%. Since there are 5 school days
in a week, the probability that it is Friday is 20%. What is the probability that a student is absent
given that today is Friday? Apply Baye’s rule in python to get the result.
Program:

# The probability that it is Friday and that a student is absent is 3%


pAF=0.03
print ("The probability that it is Friday and that a student is absent :",pFA)

# The probability that it is Friday is 20%


pF=0.2
print ("The probability that it is Friday : ",pF)

# The probability that a student is absent given that today is Friday


pResult=(pAF/pF)

# Display the Result


print("The probability that a student is absent given that today is Friday : ",pResult * 100,"%")

Output:

Theory:

22
2. Extract data from database using python.
Program:
Connecting with mysql :

Creating Database

Display Databases

Output:
Creating Tables:
Inserting data :

Inserting more data:

Extracting data from database:


Using Kaggle dataset(train):
Theory:
1. Install MSQL
MySQL is an open-source relational database management system. Its name is a combination of "My", the
name of co-founder Michael Widenius's daughter My, and "SQL", the acronym for Structured Query
Language.

MySQL is a widely used relational database management system (RDBMS).


MySQL is free and open-source.
MySQL is ideal for both small and large applications.
What Is SQLite?

SQLite is a C-language library that implements a small, fast, self-contained, high-reliability, full-featured, SQL
database engine. SQLite is the most used database engine in the world. SQLite is built into all mobile phones and
most computers and comes bundled inside countless other applications that people use every day

What is SQLite used for?


SQLite is used to develop embedded software for devices like televisions, cell phones, cameras, etc. It can
manage low to medium-traffic HTTP requests. SQLite can change files into smaller size archives with lesser
metadata. SQLite is used as a temporary dataset to get processed with some data within an application.

What is difference between SQL and SQLite?


SQL is Structured Query Language which is used with databases like MySQL, Oracle, Microsoft SQL
Server, IBM DB2, etc. SQLite is portable database resource. It could get an extension in whatever
programming language used to access that database.

We can use sqlite and pandas together.

Kaggle is the world's largest data science community with powerful tools and resources to help you achieve your
data science goals.
Pandas?
Pandas is a Python library used for working with data sets.

It has functions for analyzing, cleaning, exploring, and manipulating data.

You might also like