/aifh

Artificial Intelligence for Humans

Primary LanguageJavaApache License 2.0Apache-2.0

Artificial Intelligence for Humans - Code Examples

These examples are part of a series of books that is currently under development. Check the above website to see which volumes have been completed and are available. The planned list is shown here. The following volumes are planned for this series:

  • Volume 0: Introduction to the Math of AI
  • Volume 1: Fundamental Algorithms
  • Volume 2: Nature Inspired Algorithms
  • Volume 3: Neural Networks
  • Volume 4: Support Vector Machines
  • Volume 5: Probabilistic Learning

##Staying Up to Date

This appendix describes how to obtain the “Artificial Intelligence for Humans” (AIFH) book series examples. This is probably the most dynamic area of the book. Computer languages are always changing and adding new versions. I will update the examples as this becomes necessary. There are also bugs and corrections. You are encouraged to always make sure you are using the latest version of the book examples.
Because this area is so dynamic, this file may have become out of date. You can always find the latest version of this file at the following location.

https://github.com/jeffheaton/aifh

##Obtaining the Examples

This book’s examples are provided in a number of computer programming languages. Core example packs are provided for Java, C#, C/C++, Python and R for most volumes. The community may have added other languages as well. All examples can be found at the GitHub repository.

https://github.com/jeffheaton/aifh

You have your choice of two different ways to download the examples.

###Download ZIP File

Github provides an icon that allows you to simply download a ZIP file that contains all of the example code for the series. A single ZIP file is used to contain all of the examples for the series. Because of this, the contents of this ZIP are frequently updated. If you are starting a new volume, it is very important that you make sure you have the latest copy. The download can be performed from the following URL.

https://github.com/jeffheaton/aifh

You can see the download link in Figure A.1.

Figure A.1: GitHub Image

###Clone the Git Repository

All examples can be obtained using the source control program git, if it is installed on your system. The following command clones the examples to your computer. Cloning simply refers to the process of copying the example files.

git clone https://github.com/jeffheaton/aifh.git

You can also pull the latest updates using the following command.

git pull

If you would like an introduction to git refer to the following URL.

http://git-scm.com/docs/gittutorial

##Example Contents

The entire “Artificial Intelligence for Humans” series is contained in one download. This download is a zip file. Once you open the examples file you will see the contents see in Figure A.2.

Figure A.2: Examples Download Image

The license file describes the license used for the book examples. All of the examples for this series are released under the Apache 2 License license. This is a Free and open-source software (FOSS) license. This means that I do retain a copyright to the files. However, you can freely reuse these files in both commercial and non-commercial projects without further permission. While the book source code is provided free, the book text is not provided free. These books are commercial products that I sell through a variety of means. You may not redistribute the actual books. This includes the PDF, MOBI, EPUB and any other format the book might be converted to. I do, however, provide all books in DRM-free form. Your support of this policy is greatly appreciated and does contribute to the future growth of these books. There are also two README files included in the download. The README.md is a “markdown” file that contains images and formatting. The README.txt file is plane text. Both files contain the same information. For more information on MD files, refer to the following URL.

https://help.github.com/articles/github-flavored-markdown

You will find README files at several levels of the examples download. The README file contained in the examples root (seen above) contains information about the book series.
You will also notice the individual volume folders contained in the download. These are named vol1, vol2, etc. You may not see all of the volumes in the download. Not all of the volumes have been written yet! All of the volumes have the same format. For example, if you were to open Volume 1, you would see the contents listed in Figure A.3.

Figure A.3: Inside Volume 1 Image

Again, you see the two README files. These files contain information unique to this particular volume. The most important information contained in the volume level README files is the current status of the examples. The community often contributes example packs. This means that some of the example packs may not be complete. The README for the volume will let you know this important information. The volume README.also contains the errata and FAQ for a volume. You should also see a file named “chart.R”. This file contains the source code that I used to create many of the charts in the book. I use the R programming language to produce nearly all graphs and charts seen in the book. This allows you to see the equations behind the pictures. I do not translate this file to other programming languages. R is simply what I use in the production of the book. If I used another language, like Python, to produce some of the charts, you would see a “chart.py” along with the R code. You can see that the above volume contains examples for C, C#, Java, Python and R. These are the core languages that I try to always ensure complete examples for. However, you may see other languages added. Again, always check the README file for the latest information on language translations. Figure A.4 shows the contents of a typical language pack.

Figure A.4: The Java Language Pack Image

Notice the README files again? The README files inside of a language folder are VERY important. Inside the above two README files you will find information about using the examples with Java. If you are having trouble using the book’s examples with a particular language, the README file should be your first stop. The other files seen above are all unique to Java. The README file above describes these in much greater detail. Contributing to the Project Do you want to translate the examples to a new language? Have you found something broken, misspelled, or otherwise botched? You probably have. Fork the project and push a commit revision to GitHub. You will be credited among the growing number of contributors.
The process begins with a fork. You create an account on GitHub and fork the AIFH project. This creates a new project, with a copy of the AIFH files. You will then clone your new for, in a similar way as was described for cloning the main AIFH repositiory. Once you make your changes you submit a “pull request”. Once I get this request I will evaluate your changes/additions and merge it with the main project. A much more detailed article on contributing through GitHub can be found here.

https://help.github.com/articles/fork-a-repo