Posts

list of keyword in python

one should not use this word as avariable in python it will throw an erroe ...............................................................................................  import keyword print (keyword.kwlist) output: ['False', 'None', 'True', 'and', 'as', 'assert', 'async', 'await', 'break', 'class', 'continue', 'def', 'del', 'elif', 'else', 'except', 'finally', 'for', 'from', 'global', 'if', 'import', 'in', 'is', 'lambda', 'nonlocal', 'not', 'or', 'pass', 'raise', 'return', 'try', 'while', 'with', 'yield']

nutshel all major supervised algo.

drop down your ans. type down an understand all the basic model stay motivated.for any querry .... coment.   import  numpy  as  np from  sklearn.linear_model  import  LinearRegression x= np.array([[ 1 , 1 ],[ 1 , 2 ],[ 3 , 4 ],[ 5 , 6 ]]) y = np.dot(x,np.array([ 1 , 2 ])) +  3 reg = LinearRegression().fit(x,y) reg.score(x,y)reg.predict(np.array([[ 3 , 5 ]])) .......................................................................................... from  sklearn.datasets  import  load_iris from  sklearn.linear_model  import  LogisticRegression X,y= load_iris( return_X_y = True ) clf = LogisticRegression( random_state = 0 ).fit(X,y) clf.predict(X[: 2 ,:]) clf.score(X,y) ..................................................................................... x=[[ 0 ],[ 1 ],[ 2 ],[ 3 ]] y=[ 0 , 0 , 1 , 1 ] from  sklearn.neighbors  import  KNeighborsClassifier neigh=...

Multiple linear Regression(update is yet to come by evening

Image
  import  pandas  as   pd import  matplotlib.pyplot  as  plt import  numpy  as  np from  sklearn.model_selection  import  train_test_split from  sklearn.linear_model  import  LinearRegression data = pd.read_csv( "taxi.csv" ) #print(df.head()) #[:,0:-1] all rows and all expect last column (independent  variable) also feature column data_x = data.iloc[:, 0 :- 1 ].values #[:,-1]all rows and only last column (dependent variable) also target column data_y = data.iloc[:,- 1 ].values x_train,x_test,y_train,y_test = train_test_split(data_x,data_y, test_size = 0.3 ,  random_state = 0 ) reg = LinearRegression() reg.fit(x_train,y_train) print ( "train_score="  ,reg.score(x_train,y_train)) print ( "train_score="  ,reg.score(x_test,y_test)...

3 step detailed face detection

Image
  step 1: This will be your easist way for face detection codes  any queery drop your comment   .........................................................CODE PYTHON............................................................................. import  numpy as np import cv2 import matplotlib. pyplot as plt annie = cv2.imread ("animesh.jpg",0) plt.imshow(annie,cmap="gray") Output: ................................................................................................................................................................... step 2: Hear we can call trained data set and detect faces in image ..................................................................................................................................................... import numpy as np import cv2 import matplotlib. pyplot as plt annie = cv2.imread ("animesh.jpg",0) plt.imshow(annie, cmap ="gray") #trained data set you can try various data set from github face_t...

face detection machine learning

  #https://www.datacamp.com/community/tutorials/machine-learning-models-api-python trained datasetsfor face detection # https://github.com/opencv/opencv/blob/master/data/haarcascades/haarcascade_frontalface_default.xml import  cv2 trained_face_data=cv2.CascadeClassifier( "face_detection.xml" ) capture = cv2.VideoCapture( 0 ) while (capture.isOpened()):     ret,frame= capture.read()      if  ret ==  True :         cv2.imshow( "video" ,frame)          # Display the resulting frame         faces  = trained_face_data.detectMultiScale(frame)         cv2.imshow( 'car detector machine' ,frame)          for  (x,y,w,h)  in  faces:      ...

seaborn tutorial

Image
 # visualizing statistical relations In [1]: #relplot for ststtistical realation import numpy as np import seaborn as sns import matplotlib.pyplot as plt import pandas as pd In [16]: a = sns . load_dataset ( "flights" ) sns . relplot ( x = "passengers" , y = "month" , data = a ) Out[16]: <seaborn.axisgrid.FacetGrid at 0x1ea533d01f0> In [17]: a = sns . load_dataset ( "flights" ) sns . relplot ( x = "passengers" , hue = "year" , y = "month" , data = a ) Out[17]: <seaborn.axisgrid.FacetGrid at 0x1ea53d35400> In [20]: b = sns . load_dataset ( "tips" ) sns . relplot ( x = "time" , y = "tip" , data = b , kind = "line" ) Out[20]: <seaborn.axisgrid.FacetGrid at 0x1ea53dae940> ploting catorigal data ¶ In [21]: sns . catplot ( x = "day" , y = "total_bill" , data = b ) Out[21]: <seaborn.axisgrid.FacetGrid at 0...