func (k *TriangleKMeans) MaxIterations() int {
	return k.maxIterations
}
MaxIterations returns the number of maximum iterations
the model will go through
package cluster
import (
	"encoding/json"
	"fmt"
	"io"
	"io/ioutil"
	"math/rand"
	"os"
	"time"
	"github.com/cdipaolo/goml/base"
)
type TriangleKMeans struct {
	maxIterations int
	alpha float64
	trainingSet [][]float64
	guesses     []int
	info        []pointInfo
	Centroids [][]float64 `json:"centroids"`
	centroidDist    [][]float64
	minCentroidDist []float64
	Output io.Writer
}
type pointInfo struct {
	lower []float64
	upper float64
	recompute bool
}
func NewTriangleKMeans(k, maxIterations int, trainingSet [][]float64) *TriangleKMeans {
	var features int
	if len(trainingSet) != 0 {
		features = len(trainingSet[0])
	}
	var guesses []int
	var info []pointInfo
	guesses = make([]int, len(trainingSet))
	info = make([]pointInfo, len(trainingSet))
	for i := range info {
		info[i] = pointInfo{
			lower:     make([]float64, k),
			upper:     0,
			recompute: true,
		}
	}
	rand.Seed(time.Now().UTC().Unix())
	centroids := make([][]float64, k)
	centroidDist := make([][]float64, k)
	minCentroidDist := make([]float64, k)
	for i := range centroids {
		centroids[i] = make([]float64, features)
		centroidDist[i] = make([]float64, k)
	}
	return &TriangleKMeans{
		maxIterations: maxIterations,
		trainingSet: trainingSet,
		guesses:     guesses,
		info:        info,
		Centroids:       centroids,
		centroidDist:    centroidDist,
		minCentroidDist: minCentroidDist,
		Output: os.Stdout,
	}
}
func (k *TriangleKMeans) UpdateTrainingSet(trainingSet [][]float64) error {
	if len(trainingSet) == 0 {
		return fmt.Errorf("Error: length of given training set is 0! Need data!")
	}
	k.trainingSet = trainingSet
	k.guesses = make([]int, len(trainingSet))
	return nil
}
func (k *TriangleKMeans) Examples() int {
	return len(k.trainingSet)
}