From 9761370e94943c3bb5d2215595edfe85fa857b3e Mon Sep 17 00:00:00 2001 From: Conrad Date: Sat, 26 May 2018 18:54:54 +0200 Subject: [PATCH] Updated code template for kmeans --- src/algorithms/kmeansMkI.py | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/src/algorithms/kmeansMkI.py b/src/algorithms/kmeansMkI.py index 3e3569d..2a3efc7 100644 --- a/src/algorithms/kmeansMkI.py +++ b/src/algorithms/kmeansMkI.py @@ -1,6 +1,6 @@ #!/usr/bin/env python #title: kmeansMkI.py -#description: Our personal Python K-Means implementation +#description: Our personal Python K-Means++ implementation #author: Tillmann Brendel, Conrad Großer #date: 26.05.2018 #version: 0.1 @@ -10,5 +10,35 @@ #python_version: 3.x #============================================================================== +# IMPORTS + +# Importing the time for benchmarking purposes +import time +from datetime import date + +# Importing libary for multi core processing +import multiprocessing + +# CODE +# Main function of the algorithm +def kmeansmk1(clusters): + print("Sorting data into " + str(clusters) + " clusters.") + +# Startup function for collecting necesarry data def startup(): - print("Hello World") \ No newline at end of file + clusters = int(input("How many clusters are known? ")) + # cores = input("How many cores should be used? ") + # path = input("Where is the data? ") + + # For benchmarking starting the timer now + start_time = time.time() + + # Firing up the engines! + kmeansmk1(clusters) + # kmeansmk1(clusters, cores, path) + + # Stopping benchmark + seconds = time.time() - start_time + print(str(seconds) + " seconds for execution") + +startup() \ No newline at end of file