Overview of this book

If you are looking to build data science models that are good for production, Java has come to the rescue. With the aid of strong libraries such as MLlib, Weka, DL4j, and more, you can efficiently perform all the data science tasks you need to. This unique book provides modern recipes to solve your common and not-so-common data science-related problems. We start with recipes to help you obtain, clean, index, and search data. Then you will learn a variety of techniques to analyze, learn from, and retrieve information from data. You will also understand how to handle big data, learn deeply from data, and visualize data. Finally, you will work through unique recipes that solve your problems while taking data science to production, writing distributed data science applications, and much more - things that will come in handy at work.
Java Data Science Cookbook
Credits
www.PacktPub.com
Customer Feedback
Preface
Indexing and Searching Data
Visualizing Data

Computing frequency distribution

The `Frequency` class has methods to count the number of data instances in a bucket, to count unique number of data instances, and so on. The interface to `Frequency` is very simple, and in most cases, it requires very few lines of code to get the desired calculations done.

As value types, Strings, integers, longs, and chars are all supported.

Note

Natural ordering is the default ordering for cumulative frequencies, but this can be overridden by supplying a `Comparator` to the `constructor`.

How to do it...

1. Create a method that takes a `double` array as argument. We will be computing the frequency distributions of the values of this array:

```        public void getFreqStats(double[] values){
```
2. Create an object of the `Frequency` class:

```        Frequency freq = new Frequency();
```
3. Add the values of the `double` array to this object:

```        for( int i = 0; i < values.length; i++) {