From the course: Data Science for Java Developers
Unlock this course with a free trial
Join today to access over 22,600 courses taught by industry experts.
Calculating mean and standard deviation - Java Tutorial
From the course: Data Science for Java Developers
Calculating mean and standard deviation
- [instructor] Alright, so at this point, all we have left to do is implement these methods that we've typed out here. So there's three of them. Let's start off with get column means. So going up a little bit in our Naive Bayes classifier class, we're going to create a private method, we're going to say private, it's going to return a list of doubles, called get column means (keyboard chattering) it's going to take a list of data items, we'll call it items as an argument. And again, what it's going to do is calculate the mean of each column for a given group, right, so it's going to calculate the mean of first, second, third fourth columns, basically as many columns as are in the data set. So the first thing we're going to do, we're going to create an empty list called column means. Alright, we're going to say equals new ArrayList. And then we're basically going to loop through each of the columns. For the…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.