There is a copy of the iris dataset on the University of California's website (Irvine) at https://archive.ics.uci.edu/ml/machine-learning-databases/iris/iris.data. We will access this data and perform several statistical operations on the same:
The Scala code is as follows:
import scala.io.Source;
//copied file locally https://archive.ics.uci.edu/ml/machine-learning-databases/iris/iris.data
val filename = "iris.data"
//println("SepalLength, SepalWidth, PetalLength, PetalWidth, Class");
val array = scala.collection.mutable.ArrayBuffer.empty[Float]
for (line <- Source.fromFile(filename).getLines) {
var cols = line.split(",").map(_.trim);
//println(s"${cols(0)}|${cols(1)}|${cols(2)}|${cols(3)} |${cols(4)}");
val i = cols(0).toFloat
array += i;
}
val count = array.length;
var min:Double = 9999.0;
var max:Double...