use of org.apache.ignite.ml.util.generators.primitives.vector.ParametricVectorGenerator in project ignite by apache.
the class ParametricVectorGeneratorExample method main.
/**
* Run example.
*
* @param args Args.
*/
public static void main(String... args) throws IOException {
// Example of Archimedean spiral.
DataStreamGenerator spiral = new ParametricVectorGenerator(// 't' will be in [-50, 50] range
new UniformRandomProducer(-50, 50), t -> Math.cos(Math.abs(t)) * Math.abs(t), t -> Math.sin(Math.abs(t)) * Math.abs(t)).asDataStream();
Tracer.showClassificationDatasetHtml("Spiral", spiral, 20000, 0, 1, false);
// Example of heart shape.
DataStreamGenerator heart = new ParametricVectorGenerator(new UniformRandomProducer(-50, 50), t -> 16 * Math.pow(Math.sin(t), 3), t -> 13 * Math.cos(t) - 5 * Math.cos(2 * t) - 2 * Math.cos(3 * t) - Math.cos(4 * t)).asDataStream();
Tracer.showClassificationDatasetHtml("Heart", heart, 2000, 0, 1, false);
// Example of butterfly-like shape.
DataStreamGenerator butterfly = new ParametricVectorGenerator(// 't' will be in [-100, 100] range
new UniformRandomProducer(-100, 100), t -> 10 * Math.sin(t) * (Math.exp(Math.cos(t)) - 2 * Math.cos(4 * t) - Math.pow(Math.sin(t / 12), 5)), t -> 10 * Math.cos(t) * (Math.exp(Math.cos(t)) - 2 * Math.cos(4 * t) - Math.pow(Math.sin(t / 12), 5))).asDataStream();
Tracer.showClassificationDatasetHtml("Butterfly", butterfly, 2000, 0, 1, false);
System.out.flush();
}
Aggregations