Merge branch 'kmeansTaskClassification' of https://bitbucket.org/sunybingcloud/electron into kmeansTaskClassification
This commit is contained in:
commit
e1350838f3
1 changed files with 4 additions and 2 deletions
|
@ -41,7 +41,9 @@ func ClassifyTasks(tasks []Task, numberOfClusters int) []TaskCluster {
|
||||||
func (tc TasksToClassify) classify(numberOfClusters int, taskObservation func(task Task) []float64) []TaskCluster {
|
func (tc TasksToClassify) classify(numberOfClusters int, taskObservation func(task Task) []float64) []TaskCluster {
|
||||||
clusters := make(map[int][]Task)
|
clusters := make(map[int][]Task)
|
||||||
observations := getObservations(tc, taskObservation)
|
observations := getObservations(tc, taskObservation)
|
||||||
// TODO: Make the number rounds configurable based on the size of the workload
|
// TODO: Make the max number of rounds configurable based on the size of the workload
|
||||||
|
// The max number of rounds (currently defaulted to 100) is the number of iterations performed to obtain
|
||||||
|
// distinct clusters. When the data size becomes very large, we would need more iterations for clustering.
|
||||||
if trained, centroids := gokmeans.Train(observations, numberOfClusters, 100); trained {
|
if trained, centroids := gokmeans.Train(observations, numberOfClusters, 100); trained {
|
||||||
for i := 0; i < len(observations); i++ {
|
for i := 0; i < len(observations); i++ {
|
||||||
observation := observations[i]
|
observation := observations[i]
|
||||||
|
@ -66,7 +68,7 @@ func getObservations(tasks []Task, taskObservation func(task Task) []float64) []
|
||||||
}
|
}
|
||||||
|
|
||||||
// Size tasks based on the power consumption
|
// Size tasks based on the power consumption
|
||||||
// TODO: Size the cluster in a better way just taking an aggregate of the watts resource requirement.
|
// TODO: Size the cluster in a better way other than just taking an aggregate of the watts resource requirement.
|
||||||
func clusterSize(tasks []Task, taskObservation func(task Task) []float64) float64 {
|
func clusterSize(tasks []Task, taskObservation func(task Task) []float64) float64 {
|
||||||
size := 0.0
|
size := 0.0
|
||||||
for _, task := range tasks {
|
for _, task := range tasks {
|
||||||
|
|
Reference in a new issue