added HW5_final with suggestion system and repo cleanup
This commit is contained in:
+7
-3
@@ -4,6 +4,7 @@ import random
|
||||
import copy
|
||||
import game_data as gd
|
||||
import pickle
|
||||
import joblib
|
||||
import matplotlib.pyplot as plt
|
||||
import numpy as np
|
||||
import os
|
||||
@@ -310,7 +311,9 @@ def train_model(dataset_column_labels):
|
||||
impurity = False,
|
||||
proportion = True)
|
||||
graph = graphviz.Source(dot_data)
|
||||
graph.render(outfile=f"plots/tree_{i}.pdf", format='pdf')
|
||||
graph.render(outfile=f"plots/tree_{i}.pdf", format='pdf')
|
||||
|
||||
return best_model
|
||||
|
||||
if __name__ == "__main__":
|
||||
Ngames = 10
|
||||
@@ -327,5 +330,6 @@ if __name__ == "__main__":
|
||||
print("Generating dataset")
|
||||
dataset_column_labels = build_dataset()
|
||||
print("Training model")
|
||||
train_model(dataset_column_labels)
|
||||
print("Ended")
|
||||
best_model = train_model(dataset_column_labels)
|
||||
joblib.dump(best_model, 'trained_model.joblib')
|
||||
print("Ended")
|
||||
|
||||
Reference in New Issue
Block a user