Book Image

Hands-On Artificial Intelligence with Java for Beginners

By : Nisheeth Joshi
Book Image

Hands-On Artificial Intelligence with Java for Beginners

By: Nisheeth Joshi

Overview of this book

Artificial intelligence (AI) is increasingly in demand as well as relevant in the modern world, where everything is driven by technology and data. AI can be used for automating systems or processes to carry out complex tasks and functions in order to achieve optimal performance and productivity. Hands-On Artificial Intelligence with Java for Beginners begins by introducing you to AI concepts and algorithms. You will learn about various Java-based libraries and frameworks that can be used in implementing AI to build smart applications. In addition to this, the book teaches you how to implement easy to complex AI tasks, such as genetic programming, heuristic searches, reinforcement learning, neural networks, and segmentation, all with a practical approach. By the end of this book, you will not only have a solid grasp of AI concepts, but you'll also be able to build your own smart applications for multiple domains.
Table of Contents (14 chapters)
Title Page
Copyright and Credits
Packt Upsell
Contributors
Preface
Index

An introduction to rule-based systems with Prolog


Now, we'll look at how to create a knowledge base and apply inference in Prolog. Let's start by looking at the Prolog environment:

  • If you are on Windows, go to Programs | Prolog
  • If you are on a Mac, go to Applications | Prolog
  • In Linux, go to the Terminal and type Prolog, and the environment will come up

The following screenshot shows the Prolog environment in Windows:

 

The ?- object is the Prolog prompt, or the Prolog interpreter. Whatever we type here will be executed; Prolog will be treated as a predicate, and it will give the result as either true or false. Therefore, if we want to create new rules, we go to File and either create a new knowledge base (using New ...) or Edit ... an existing knowledge base, as follows:

If you're working on Windows or Mac, you will have to open your knowledge base in a text editor. You can use gedit, you can use Mino on Linux, or you can use the text editor that is available with Mac. We've already created a...