Book Image

Java Data Analysis

By : John R. Hubbard
Book Image

Java Data Analysis

By: John R. Hubbard

Overview of this book

Data analysis is a process of inspecting, cleansing, transforming, and modeling data with the aim of discovering useful information. Java is one of the most popular languages to perform your data analysis tasks. This book will help you learn the tools and techniques in Java to conduct data analysis without any hassle. After getting a quick overview of what data science is and the steps involved in the process, you’ll learn the statistical data analysis techniques and implement them using the popular Java APIs and libraries. Through practical examples, you will also learn the machine learning concepts such as classification and regression. In the process, you’ll familiarize yourself with tools such as Rapidminer and WEKA and see how these Java-based tools can be used effectively for analysis. You will also learn how to analyze text and other types of multimedia. Learn to work with relational, NoSQL, and time-series data. This book will also show you how you can utilize different Java-based libraries to create insightful and easy to understand plots and graphs. By the end of this book, you will have a solid understanding of the various data analysis techniques, and how to implement them using Java.
Table of Contents (20 chapters)
Java Data Analysis
Credits
About the Author
About the Reviewers
www.PacktPub.com
Customer Feedback
Preface
Index

The command line


On a Mac, the command line is accessed through the Terminal app (in Windows, it's called Command Prompt.) You will find the Terminal app in the Applications/Utilities/ folder. When you launch it, a Terminal window will appear, like the one in Figure A-1:

Figure A-1. Terminal window

The prompt shows the name of the computer, a colon (:), the current directory (the folder), a space, the current user, a dollar sign ($), a space, and then the prompt symbol (□).

There are several hundred commands that you can run from the Terminal window. To see a list of them all, hold the Esc key down for a second and then press Y, to answer yes to the question. Each time the listing pauses, press the space bar to see the next screen of commands. Press Q to terminate the listing.

Press Ctrl+C to abort the execution of any Terminal command. Use the up and down arrow keys to scroll through the saved list of previously executed commands (to avoid re-typing them).

Try the cal command (Figure A-2):

Figure A-2. The calendar command

It simply displays the calendar for the current month.

Most Terminal window commands are Unix commands. To view the Unix manual description (the man page) of a command, type man followed by the command. For example, to see the man page for the calendar command, enter man cal.

Whenever a response is too large to fit in the window, use the space bar or the Q key to either continue to the next screen of output or to quit that output.

The prompt string is saved in a system variable name PS1. You can change it to just about anything you want by a simple assignment statement. Here we changed it, first to "Now what?" (just for fun), and then to "\w $". The code \w means to specify the current working directory, representing the user's home directory with the tilde character (~). The current working directory in Figure A-3 is the user's home directory.

Figure A-3. Changing the Command Prompt string

The part of the computer's operating system that responds to user commands this way is called the shell and a series of interactive commands and responses like these is called a shell session.

The shell session shown in Figure A-4 illustrates the cd and ls commands. The cd command changes the current directory to the one specified in the command. So, cd hub changed the current directory from ~ (my home directory) to ~/hub, which is a subdirectory of my home directory.

Figure A-4. Listing contents and changing directories

The ls command lists the contents of the current directory. So, when I executed the ls command the first time here, it listed the 11 subdirectories that I have in my ~/hub directory. These included app, books, data, and so on.

To go back up your directory tree, use the cd .. command, or cd ../.. to go back up two levels at once. The double dot means the parent directory.