Numpy Module
Numpy Module
pandas module
visualization using matplotlib and seaborn
hello world of ml (Dev a perceptron)
kaggle,github, machine hack site for compettiv ml prog
scikit learn algo are available
regression -data set is nt fixed
classification-predicting on fixed set of data,discrete set f data for prediction
- logistic Regression
- Decision Tree
- Naive Bayes
- knn(k nearest neighbour)
- metrics (regression and classification)
cluster
project work
day 1
REPL(repeat execute print loop)
-compiled prog run faster,pyton is interpreted
-interpreted -interactive -object oriented prog
type(x)-gives the data type of the variable
we take log aor expo or scaling for managing the data set
1/(1+math.exp(x)) sigmoid fuction gives value between 0-1,may b used for
calculating probability
soft math,
for library with big names we can simply write
import math as m
now we can use m everytime now
if any function in the library is too big we can define it as
from math import sqrt as s
now we can use s as sqrt
day 2
list==[] replace array ,list doesnt have fixed size
set=={}
tuple==()
dictionary=={}==like hashmap in java
numpy have array
pandas have series and datagram
marks=[[1,2],[7,3]] 2 d array
access elements of 2d list
list 1= elements...
list2=......
str="score of {} is {}"
fial=str.format(list1[0],list2[0]) complets the template string
ex
for i in range(len(names)):
print(str.format(names[i],score[i]))
or
print("score of {} is {}.format(list1[0],list2[0])
Tuple
t1=()
t1=(12,213,113)
t1=tuple()
tuple is read only list
t1[0]=40 ==> will not work
l1=list(t1)==> converting a tuple to a list
t2=tuple(l1)=== convert a list to tuple
day3
dictionary 2d array key value pair,values are return with key
if key is repeated then the last entry will be saved
d1={"key1":"value1","key2":"value2"}
get funtion
d1.get(1)
d1[1]
set
s1={}
s1=set()
s1={324,53646,57876,453,2342,23424,3564,46}
s2={123,343,44,34,344,44,4}
s3=s1.union(s2)
s4=s1.intersection(s2)
zip function
roll=[1,2,3,4,5]
name=[a,b,c,d,e]
students=list(zip(roll,names))
zip is generator it doesnt creat a list
for e in zip(roll,names):
print e
def funnctionname(parameter):
'''description
'''
def circle(radius):
def area():
return 3.14*radius**2
def circum():
return 2*3.14*radius
def diameter():
return radius*2
return(area,circum,diameter)
radius=8
ar,pr,di=circle(radius)
print(ar(),pr(),di())
day4
string ,list
s="amit,sumit,prason"
l=s.split(":") #breaks the string in list
print(l)
class and object
no concept of visibility
method must have one parameter,by convention we write self it is similar to this
in c++
class student:
def setdata(self,r,n,m):#we need to pass just 3 parameter self is handeled by
python complier
self.roll=r
self.name=n
self.marks=m
def prd(self):
print("roll",self.roll)
print("name",self.name)
s=student()
s.setdata(32,"delta",99)
s.prd()
2,4,4,6,7,8, ,100000
######################################################
DAY 6
#############################################################
for i in autodf.modelyear.unique():
print("modelyear:",i,autodf[autodf.modelyear==i]["cylinders"].value_counts())
###################################################################################
###########################################
ml
1-Formula
2-tree
3-probability
sgd classifier ,random forest ,neive bayes ,percepton etc
ml
1-supervised-feed many examples on wich machine learns and predict
2-unsupervised
3-reinforcement
4-ensamble -random forest
unsupervised -predict som grouping in the giving data,data doest have any label,
(clustring works on unsupervised)
the learning process
-data gathering process
-data processing
-diensionality Reduction-(topic modeling-Probablititc topic modeling,)
-model learning-(classification,Regression,Clustering,Description)
-model testing
Training data ===>feed to model and testing data===>model=====>predict
loss function
Classfication:
a>logistic Regession
b>Decision Tress
C>naive Bayes
D>KNN --- non parametric learning,lazy learner doesnt create model
e>random Forest
F>SVM
g>Gaussion kernal
H>Perceptron
i>Neural Network
h>SGD classifier
confusion mat
0 1
0 TN FP
1 FN TP
TP
--------- ===>pression
FP+ TP
TP
---------- ======>recall/sensitivity (TPR)
FN +TP
Data set
https://www.kaggle.com/tmdb/tmdb-movie-metadata
https://www.kaggle.com/russellyates88/suicide-rates-overview-1985-to-2016
https://www.kaggle.com/c/porto-seguro-safe-driver-prediction
https://www.kaggle.com/c/amazon-employee-access-challenge
https://www.firstnaukri.com/campusreg/ncccyrx
Thank You
Training and Placement Cell