def main(): games, users, rec = loadSystem() user_list = users['user_id'].unique().tolist() gui = GUI() def Recommend(user_input): user_id = int(user_input) print("Recommending for {0}".format(user_id)) recommendations = rec.recommend(user_id) print("Done!") gui.resultWindow(recommendations) gui.mainWindow(choice_list=user_list, menu_button_action=Recommend) # Running application # main() # Running evaluation dt = Data() rec = RecSys(dt.games, dt.users, top_n=10, models={'collab': 0.4, 'tags': 0.5, 'price': 0.1}) eval = Evaluator(rec) eval.evaluate() eval.report()
def getCluster(data): global label cluster = [] for i in range(label): cluster.append([]) for i in range(len(data.data)): cluster[data.data[i].label].append(data.data[i]) return cluster def DbScanRun(data, eps, minPts): global label begin = clock() label = 1 data = makePoint(data, eps, minPts) data = merge(data, eps) end = clock() cluster = getCluster(data) ev = Evaluate() ev.EvaluateRun(data, cluster) print("number of cluster:%d" % (label)) print("purity is %f" % (ev.purity)) print("FScore is %f" % (ev.FScore)) print("time used: %d s" % (end - begin)) if __name__ == '__main__': data = Data() DbScanRun(data, 4, 5)