Package: autodiff26
AUTODIFF26CI TESTSHOW TO USE PACKAGEThe easiest way to install autodiff_26 library is using pip install. We encourage using a virtual environment# start virtual environmentpython3-mvenv<DIR># activate virtual enviromentsource<DIR>/bin/activateInstall Package from pippipinstallautodiff26Currently we support forward and reverse modes of automatic differentiation. We provide autodiff function for the forward mode differentiation and
reversediff function for reverse mode differentiation. Please find detailed description of implementation in ourAutodiff26 DocumentationTo use forward mode, import the libraryfromautodiff26importautodiff,adIf you would prefer to use reverse mode, import it as followsfromautodiff26importreversediff,rev_adForward modeForward mode supports both univariate and multivariate functions. The ad object imported gives access to elementary operations such as trigonometric functions,logarithmic , logistic, exponential among others. autodiff function returns an object with value and derivative of function at the point. Note that for a multivariate function if variable to differentiate with respect to is not specified we default to the first variable.1. Single Variable functions>>>fromautodiff26importautodiff,ad>>>x_val=10>>>f=lambdax:ad.sin(x)+ad.cos(x)+ad.tan(x)>>>res=autodiff(f,x_1=x_val)# to access function value>>>print(res.val)-0.7347318125067355# to access the derivative>>>print(res.der)1.12532134439634882. Multivariable functions>>>fromautodiff26importautodiff,ad>>>x=1>>>y=3>>>f=lambdax,y:ad.sin(x*y)*ad.sin(0.5)>>>res=autodiff(f,x_1=x_val,x_2=y_val)# to access function value>>>print(res.val)0.06765654# to access the derivative>>>print(res.der)-1.89851074Input can be np array, single numeral or list.np array input example"""2 variable input, np array inputs"""x=np.array([0.5,1,2])y=np.array([0.5,3,4])# ad object provides sin, cos, tan, exp , log methods to usef=lambdax_1,x_2:ad.sin(x_1*x_2)*ad.sin(0.5)fn=autodiff(f,x_1=x,x_2=y)# returned object has value(val) and derivative(der) depending on inputs providedprint(fn.val)[0.118611780.067656540.47432361]print(fn.der)[0.46452136-1.89851074-0.41853859]single point input examplex=5.0y=7# define functionf=lambdax,y:x*yfn=autodiff(f,x=x,y=y)# value and derivative at input pointsprint(fn.val)35.0print(fn.der)12.0Reverse modeReverse mode also supports both univariate and multivariate functions. The rev_ad object imported gives access to elementary operations such as trigonometric functions,logarithmic , logistic, exponential among others. reversediff function returns derivative of function at the point(s) specified. As with the forward mode,for a multivariate function if variable to differentiate with respect to is not specified we default to the first variable.1. Single Variable functions>>>fromautodiff26importreversediff,rev_ad>>>x_val=10>>>f=lambdax:rev_ad.sin(x)+rev_ad.cos(x)+rev_ad.tan(x)>>>res=reversediff(f,x_1=x_val)# to access the derivative>>>print(res)1.12532134439634882. Multivariable functions>>>fromautodiff26importreversediff,rev_ad>>>x=1>>>y=3>>>f=lambdax,y:rev_ad.sin(x*y)*rev_ad.sin(0.5)>>>res=reversediff(f,x_1=x_val,x_2=y_val)# to access the derivative>>>print(res)-1.89851074As with forward mode, Input can be np array, single numeral or list.Broader Impactautodiff26 was developed to promote the progress of computational science, machine learning, and their uses. The team developing autodiff26 comes from
different scientific and educational backgrounds, which helped us promote cross-disciplinary thinking regarding its application in different fields. The program was
also developed with the goal to be as user-friendly and accesible as possible, with the assumption that the user has had experience in Python. Our program can be utilized in virtually any scientific field, from optimizing drug development, projecting a country's financial growth, to modelling rising
temperatures due to climate change. In addition, the developers of this program come from diverse cultural background, most of which are from minority groups. We hope that we can set an example that computational science and software development
are possible for anyone, regardless of their background.While the benefits of our project are plenty, it is not without its potentially negative consequences. As with any other scientific tools, our program bear the burden of
misuse, both intentional and unintentional, that may be caused; however, our program warrants additional scrutiny due to the essential nature of Automatic Differentiation
in machine learning. For example, racial bias in machine learning algorithms utilized in the medical field can result in misdiagnosis of minority groups due to differences in physiology.
Our algorithm can be intentionally used for subjectively detrimental purposes, such as development of automated military weapons. It is the developers' hope that this program be used solely for academic and scientific uses that
helps progress technology in a positive lightSOFTWARE INCLUSIVITYWe have designed our software package so that it would be accessible to all users. We have implemented an extensive detailed note in our README.md file in which users could find details about our implementation and the purpose of our work in this software. Our team welcomes feedback from any users regardless of age, background, gender and culture. If any user wishes to make changes or believes that our software lacks important elements, our team is more than welcome to listen to those requests and make immediate arrangements. As our package is uploaded on the github page, it would allow for anyone to make a branch and make changes, which is a great feature that would allow for users to demonstrate how we can be able to better our software. Our package is for the people and we will not hold back from making it as best a usable and understandable interface as we can. Our team is made up of a diverse mix of engineers from different parts of the world, we deeply value the opinions and contributions of the international community that wishes to use our software. For the larger international community that wishes to make use of our package, our team is willing to make as many accommodations as possible if users report any problems and feedback.