AI LAB 01
AI LAB 01
1. Write the details of functions performed by the following python’s libraries. (CLO-2, PLO-3) (10)
a. NumPy
The array object in NumPy is called ndarray, it provides a lot of supporting
functions that make working with ndarray very easy.
Install NumPy
Example:01
import numpy
print(arr)
Example:02
import numpy as np
print(arr.dtype)
example:03
import numpy as np
dfa1=np.array([
[1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],
[-1,2,-1,-1,-1,-1,-1,-1,-1,-1,-1],
[-1,-1,-1,-1,-1,-1,3,-1,-1,-1,-1],
[4,4,4,4,4,4,4,4,4,4,-1],
[4,4,4,4,4,4,4,4,4,4,-1]
])
dfa2=np.array([
[1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],
[-1,2,-1,-1,-1,-1,-1,-1,-1,-1,-1],
[-1,-1,-1,-1,-1,-1,3,-1,-1,-1,-1],
[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5],
[6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],
[-1,7,-1,-1,-1,-1,-1,-1,-1,-1,-1],
[-1,-1,-1,-1,-1,-1,8,-1,-1,-1,-1],
[8,8,8,8,8,8,8,8,8,8,-1],
[8,8,8,8,8,8,8,8,8,8,-1]
]
)
trnstion=['0','1','2','3','4','5','6','7','8','9','.']
first_state=0
second_state=0
finalst1={4}
finalst2={8}
@author: yasaa
"""
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
import numpy as np
# read csv using absolute path
import pandas as pd
iris = pd.read_csv(r"C:\Users\yasaa\Downloads\iris.csv")
print (iris)
(150, 5)
c. SciPy
SciPy is a scientific computation library that uses NumPy underneath. SciPy stands for Scientific
Python. It provides more utility functions for optimization, stats and signal processing
d. Scikit-learn
its an open source data analysis library