#!/usr/bin/python """ Starter code for the evaluation mini-project. Start by copying your trained/tested POI identifier from that which you built in the validation mini-project. This is the second step toward building your POI identifier! Start by loading/formatting the data... """ import pickle import sys sys.path.append("../tools/") from feature_format import featureFormat, targetFeatureSplit data_dict = pickle.load(open("../final_project/final_project_dataset.pkl", "r") ) ### add more features to features_list! features_list = ["poi", "salary"] data = featureFormat(data_dict, features_list) labels, features = targetFeatureSplit(data) ### your code goes here from time import time features_train = features features_test = features labels_train = labels labels_test = labels from sklearn.tree import DecisionTreeClassifier from sklearn.metrics import accuracy_score print("Features: ", len(features[0])) clf = DecisionTreeClassifier() t0 = time() clf.fit(features_train, labels_train) print "training time:", round(time()-t0, 3), "s" t1 = time() print (clf.score(features_test, labels_test)) print "scoring time:", round(time()-t1, 3), "s" pred = clf.predict(features_test) acc = accuracy_score(labels_test, pred) print ("Accuracy: ", acc)