def main(): with open('smartphone_classifier', 'rb') as classifier: # Load the trained model and X and y values model = pickle.load(classifier) X, y = load_dataset() # Classify as 'smartphone' or 'nao-smartphone' y_pred = model.predict(X) # Print the results print("Matriz de confusao: ") print(confusion_matrix(y, y_pred)) print("Resumo:") print(classification_report(y, y_pred)) print("Acuracia:", round((accuracy_score(y, y_pred) * 100), 4), "%") generate_output_file(y_pred) return True
Format of the input configuration: additional features. Possible options: -BASE: no changes; simple count -TD: adds time dependency in the count -EMI: mutual information extened matrix (sensor event window adjency) -TD+EMI: combination of TD and EMI -ALL: iteration that serves to test all possible input configurations """ if __name__ == "__main__": #Reading the inputs if len(sys.argv) < 4: #Bad usage of the command msg_error(USAGE) #Selecting the dataset dataset, dataset_name = load_dataset(sys.argv[3]) #Divide the testing and training data try: int_data = dataset.obtaining_data() except Exception as exc: msg_error(exc) #Selecting which features to test if sys.argv[1] == "ALL": features = POSIBLE_FEATURE_CONFIG.copy() elif sys.argv[1] in POSIBLE_FEATURE_CONFIG: features = [sys.argv[1]] else: #Unkown feature msg_error("Unkown feature: " + sys.argv[1])