Posts

Showing posts from November, 2021

How to write a ReLU function and its derivative in python?

Image
Hiii  musketeers Then  I  want  to  bandy  about activation  functions  in Neural  network   generally  we've  so   numerous   papers  on activation  functions . Then  I  want   bandy  every  thing  about activation functions about their  derivations , python  law  and when we will  use . This  composition  will  cover  …. Function Equations and its Derivatives Types of Activation function: Sigmoid Tanh or Hyperbolic ReLu Activation Function (Rectified Linear Unit) Now we will look each of this 1)Sigmoid: It is also called as logistic activation function. f(x)=1/(1+exp(-x) the function range between (0,1) Derivative of sigmoid: just simple u/v rule i.e (vdu-udv)/v² df(x)=[(1+exp(-x)(d(1))-d(1+exp(-x)*1]/(1+exp(-x))² d(1)=0, d(1+exp(-x))=d(1)+d(exp(-x))=-exp(-x) so df(x)=exp(-x)/(1+exp(-x))² df(x)=[1/(1+exp(-x))]*[1-(1/(1+exp(-x))] df(x)=f(x)*(1-f(x)) Python Code: import matplotlib.pyplot as plt import numpy as np def sigmoid(x): s=1/(1+np.exp(-x)) ds=s*(1-s) ret

Tuple Functions in Python

Image
Python tuple () The tuple () builtin can  be   used  to  produce  tuples in Python. In Python, a tuple is an  inflexible   sequence   type . One of the  ways  of creating tuple is by  using  the tuple () construct. The syntax of tuple () is tuple (iterable) tuple () Parameters iterable (  voluntary )-an iterable (list,  range ,etc.) or an iterator  object Still , the  function  returns an  empty  tuple, If the iterable isn't  passed  to tuple (). Illustration   Produce  tuples  using  tuple () t1 = tuple () print  ('t1 = ', t1) .# creating a tuple from a list t2 = tuple ( (1, 4, 6)) .  print  ('t2 = ', t2) .# creating a tuple from a  string t1 = tuple ('Python') print  ('t1 = ', t1) .# creating a tuple from a  wordbook t1 = tuple ( 1'one', 2'two') .  print  ('t1 = ', t1) .  Affair t1 = () t2 = (1, 4, 6) . t1 = ('P','y','t','h','o','n') .t1 = (1, 2) A tuple is a sequence of immut

Keywords and Identifiers in Python

Image
  Python Keywords Well  simply , Python keywords are the  words  that are  reserved . That means you ca n’t  use  them as  name  of any  realities  like variables,  classes  and  functions . So  you might  be   allowing  what are these keywords for. They're for  defining  the syntax and  structures  of Identifiers in Python   language . You should  know  there are 33 keywords in Python programming  language  as of  writing  this tutorial. Although the  number  can  vary   by   course  of  time .  Also  keywords in Python is case  sensitive .  So  they're to  be   written  as it is.  Then 's a list of all keywords in python programming. List of All Python Keywords and Logical operator as Alias assert For debugging break Break out of  Python loops class Used for defining  Classes in Python continue Keyword used to continue with the Python loop by skipping the existing def Keyword used for defining a function del Used for deleting  objects in Python elif Part of the if-elif-el