blob: 31e65c76156478035676552ffe65e62cefe6244e (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
package scalam.plotting
import scalam.m.ast.Identifier
import scalax.file.Path
import breeze.linalg.{ Vector, DenseVector }
case class DataSet(points: Seq[(Double, Double)], label: String, name: String) {
lazy val (xs, ys) = points.unzip
def save(path: Path) = {
path.createFile(createParents = true, failIfExists = false)
for (processor <- path.outputProcessor; out = processor.asOutput)
for ((x, y) <- points) out.write(x + " " + y + "\n")
}
}
object DataSet {
def apply(points: Seq[(Double, Double)], label: String) = new DataSet(points, label, Identifier.makeValid(label))
}
|