-
-
Save MiraLak/a130849a9fa7a1916d55 to your computer and use it in GitHub Desktop.
Actitacker Spark Cassandra
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static String predict(JavaSparkContext sc) { | |
//load the defined model | |
DecisionTreeModel model = DecisionTreeModel.load(sc.sc(), "actitracker"); | |
Vector feature = computeFeature(sc); | |
double prediction = model.predict(feature); | |
String result = "No activity predicted"; | |
switch ((int) prediction) { | |
case 0: | |
result = "Walking"; | |
break; | |
case 1: | |
result = "Jogging"; | |
break; | |
case 2: | |
result = "Standing"; | |
break; | |
case 3: | |
result = "Sitting"; | |
break; | |
case 4: | |
result = "Upstairs"; | |
break; | |
case 5: | |
result = "Downstairs"; | |
break; | |
} | |
return result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment