diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 00000000..cd8d3d51 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,3 @@ +{ + "recommendations": ["james-yu.latex-workshop"] +} diff --git a/midterm/main.py b/midterm/code/main.py similarity index 98% rename from midterm/main.py rename to midterm/code/main.py index 69625c20..cc026d0c 100644 --- a/midterm/main.py +++ b/midterm/code/main.py @@ -156,12 +156,12 @@ def preprocessing(rating_data, anime_contact_data, debug=False): return pivot_table -def predict(prediction_model, pivot_table): +def predict(prediction_model, pivot_table, seed=42): """ This will choose a random anime name and our prediction_model will predict similar anime. """ + np.random.seed(seed) random_anime = np.random.choice(pivot_table.shape[0]) - query = pivot_table.iloc[random_anime, :].values.reshape(1, -1) distance, suggestions = prediction_model.kneighbors(query, n_neighbors=6) random_anime_name = pivot_table.index[random_anime] diff --git a/midterm/requirements.txt b/midterm/code/requirements.txt similarity index 100% rename from midterm/requirements.txt rename to midterm/code/requirements.txt