Ai Programming with Java

Ai Programming with Java

Molei Hong AI PROGRAMMING WITH JAVA Final Thesis CENTRIA UNIVERSITY OF APPLIED SCIENCES Information Technology December 2020 Centria University Date Author of Applied Sciences 1/9/2021 Molei Hong Degree programme Information Technology Name of thesis AI PROGRAMMING WITH JAVA Instructor Pages Kauko Kolehmainen 42 Supervisor Kauko Kolehmainen The thesis was about artificial intelligence project in Java. It started with the theoretical part of basic presentation of Java programming language, introduced its history, importance and features. The sig- nificant description of Java platform component Java Virtual Machine was involved. The definition of AI, the types of AI and the different AI level which included machine learning and deep learning were also presented. In the practical part, Weka, a software of machine learning algorithm in Java was intro- duced and there were two data mining and classification experiments by using Weka demonstrated. After that, a Java project with Weka’s Naïve Bayesian algorithm illustrated the principle of email clas- sification. In the project, necessary elements such as Weka packages, the datasets and important meth- ods were presented in detail. Key words Java programming, Java Virtual Machine, Artificial Intelligence, Weka, Naïve Bayesian, spam filter, data classification. ABSTRACT CONCEPT DEFINITIONS CONTENTS 1 INTRODUCTION ........................................................................................................................... 1 2 JAVA PROGRAMMING LANGUAGE ........................................................................................ 2 2.1 Java platform Standard Edition .................................................. Error! Bookmark not defined. 2.2 Java Virtual Machine .................................................................... Error! Bookmark not defined. 3 ARTIFICIAL INTELLIGENCE .................................................................................................... 7 3.1 The definitions of AI .................................................................................................................. 9 3.2 The categories of AI ................................................................................................................. 11 3.2.1 Machine Learning ......................................................................................................... 12 3.2.2 Deep Learning ............................................................................................................... 14 3.3 Machine Learning tools and libraries in Java ........................................................................ 15 4 WEKA ........................................................................................................................................... 16 4.1 The explorer experiment ......................................................................................................... 18 4.2 The class structure Weka ........................................................................................................ 23 4.2.1 The Weka.core package ................................................................................................. 24 4.2.2 The Weka.classifiers package ........................................................................................ 25 5 PROJECT EXPLANATION ........................................................................................................ 26 5.1 Naive Bayesian algorithmic reasoning .................................................................................... 26 5.2 Selection of datasets ................................................................................................................. 28 5.3 Importing Weka Packages ...................................................................................................... 30 5.4 Training data ........................................................................................................................... 32 5.5 Testing data ............................................................................................................................. 35 5.6 Evaluation result...................................................................................................................... 36 6 CONCLUSION ............................................................................................................................. 38 REFERENCES ................................................................................................................................ 39 SOURCE OF FIGURES ................................................................................................................. 41 LIST OF FIGURES Figure 1. Benefits of programming AI in Java ................................................................................. 3 Figure 2. The interface of Java Platform Manager (Netbeans IDE 8.2) .......................................... 4 Figure 3. The internal architecture of the JVM ................................................................................ 5 Figure 4. The structure of Java 2 platform SE 5.0............................................................................ 6 Figure 5. Four categories are organized for the definitions of AI. ................................................. 10 Figure 6. Autonomous driving as the start of Artificial Intelligence level ..................................... 11 Figure 7. Three learning methods of machine learning algorithms ............................................... 13 Figure 8. Weka GUI Chooser (Version 3.8.3) ................................................................................. 17 Figure 9. Problems of ARFF format in UCI dataset....................................................................... 18 Figure 10. Reading in the diabetes data .......................................................................................... 18 Figure 11. Classifier output of diabetes dataset .............................................................................. 19 Figure 12. Images of Rhino and Brontosaurus ............................................................................... 20 Figure 13. Equal frequency, 43 examples of each in the dataset .................................................... 20 Figure 14. Additional features were added to the dataset .............................................................. 21 Figure 15. Classifier output ............................................................................................................. 22 Figure 16. Package Manager in Weka ............................................................................................ 23 Figure 17. Method of Copyable interface ........................................................................................ 24 Figure 18. Method distributionForInstance() ................................................................................. 25 Figure 19. Training dataset and testing dataset .............................................................................. 28 Figure 20. TrainingData.arff opened as txt file............................................................................... 29 Figure 21. Libraries included weka.jar and JDK 1.8 ..................................................................... 30 Figure 22. Weka.core packages used in the source code ................................................................ 31 Figure 23. Weka.classifiers package and StringToWordVector class are imported in the source code ................................................................................................................................................... 31 Figure 24. Defined instances, attributes of training data and locations of training dataset files .. 32 Figure 25. Attributes "label" and "text" were added and “label” was assigned values ............... 32 Figure 26. Loading and saving dataset content ............................................................................... 33 Figure 27. Converting text to feature vector ................................................................................... 33 Figure 28. Using tokenizer to split the string .................................................................................. 33 Figure 29. Building the classifier ..................................................................................................... 34 Figure 30. Evaluating the classifier model ...................................................................................... 35 Figure 31. Main method for running classifier ............................................................................... 36 Figure 32. Output after running ...................................................................................................... 37 0 1 1 INTRODUCTION In recent years, machine learning, data science and artificial intelligence have been the most talked about technologies. This is a matter of course. These advancements in technology have brought automation and business processes to a new level. Organizations of all sizes have invested millions of dollars in research and personnel to develop these extremely powerful data-driven applications. There are many different programming languages that can be used to develop machine learning and data science appli- cations. Although Python and R have become the first choice for developing these programs, many organizations are turning to Java development to meet their

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    46 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us