Body: <p>I've been trying to hyper tuning my KNNBasic algorithm by the help of grid search for recommendation system for movie review data. The problem is that both of my KNNBasicTuned and KNNBasicUntuned shows the same result. Here is my code for KNNTuning..
  I have tried the SVD algo tuning and it worked perfectly so all my libraries are working perfectly. However my all libraries are in my github linke : <a href="https://github.com/iSarcastic99/KNNBasicTuning" rel="nofollow noreferrer">https://github.com/iSarcastic99/KNNBasicTuning</a></p>
  
  <p>Code of KNNBasicTuning :</p>
  
  <p><a href="https://i.sstatic.net/wXuBB.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/wXuBB.png" alt="enter image description here"></a></p>
  
  <pre><code># -*- coding: utf-8 -*-
  """
  Created on Sat Apr  4 01:25:40 2020
  
  @author: rahulss
  """
  #My libraries
  
  from MovieLens import MovieLens    
  from surprise import KNNBasic
  from surprise import NormalPredictor
  from Evaluator import Evaluator
  from surprise.model_selection import GridSearchCV
  
  import random
  import numpy as np
  
  #loading my working data
  def LoadMovieLensData():
      ml = MovieLens()
      print("Loading movie ratings...")
      data = ml.loadMovieLensLatestSmall()
      print("\nComputing movie popularity ranks so we can measure novelty later...")
      rankings = ml.getPopularityRanks()
      return (ml, data, rankings)
  
  np.random.seed(0)
  random.seed(0)
  
  # Load up common data set for the recommender algorithms
  (ml, evaluationData, rankings) = LoadMovieLensData()
  
  print("Searching for best parameters...")
  param_grid = {'n_epochs': [10, 30], 'lr_all': [0.005, 0.010],
            'n_factors': [50, 90]}
  gs = GridSearchCV(KNNBasic, param_grid, measures=['rmse', 'mae'], cv=3)
  
  gs.fit(evaluationData)
  
  # best RMSE score
  print("Best RMSE score attained: ", gs.best_score['rmse'])
  
  # combination of parameters that gave the best RMSE score
  print(gs.best_params['rmse'])
  
  # Construct an Evaluator to, you know, evaluate them
  evaluator = Evaluator(evaluationData, rankings)
  
  params = gs.best_params['rmse']
  KNNBasictuned = KNNBasic(n_epochs = params['n_epochs'], lr_all =  params['lr_all'], n_factors = params['n_factors'])
  evaluator.AddAlgorithm(KNNBasictuned, "KNN - Tuned")
  
  KNNBasicUntuned = KNNBasic()
  evaluator.AddAlgorithm(KNNBasicUntuned, "KNN - Untuned")
  
  
  # Evaluating all algorithms
  evaluator.Evaluate(False)
  
  evaluator.SampleTopNRecs(ml, testSubject=85, k=10)
  </code></pre>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-04-07T19:22:46.590Z
Comments.Text: Hi and welcome to AI SE! You say "The problem is that both of my KNNBasicTuned and KNNBasicUntuned shows the same result.", but what do you mean by "result"?
Comments.UserDisplayName: nbro
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-04-07T20:58:29.237Z
Comments.Text: @nbro, Thanks for welcoming me. By result, I meant my RMSE and MAE score of both KNNBasicTuned and KNNBasicUntuned are same.
Comments.UserDisplayName: techPirate99
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-04-10T01:20:41.020Z
Comments.Text: All the parameters you set on the grid search are completely irrelevant for KNN. You probably get the same results cause you're always training the model with default parameters. The only parameters you can fine tune are k, min_k and eventually extra options (like the metric to use to compute the distances). Check the documentation [link](https://surprise.readthedocs.io/en/stable/knn_inspired.html)
Comments.UserDisplayName: Edoardo Guerriero
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-04-10T21:04:13.393Z
Comments.Text: @EdoardoGuerriero, First thanks for trying to help. However, as you can see that i've used GridSearchCV and it requires the given parameters above. For more infor pls check the link here     [GridSearchCV](https://surprise.readthedocs.io/en/stable/getting_started.html#tune-algorithm-parameters-with-gridsearchcv)
Comments.UserDisplayName: techPirate99
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-04-10T21:17:46.727Z
Comments.Text: @techPirate99 In a grid search you need to specify the parameters you want to tune, but a KNN is not trained using epochs, and it doesn't require a learning rate, it is not a neural network. I'll write an answer in an hour to show you what you can tune.
Comments.UserDisplayName: Edoardo Guerriero
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-04-12T03:21:13.023Z
Comments.Text: @EdoardoGuerriero, I completely agree with you that i need something else(other than GridSearchCV) which can help tuning knn and thats what i was hoping to be answered. Waiting for your answer. Thanks again.
Comments.UserDisplayName: techPirate99
Tags: <python><hyperparameter-optimization><recommender-system>
Title: Why can't I Hyper tune my KNNBasic Algorithm?
UserDisplayName: techPirate99
ThreadText: # Why can't I Hyper tune my KNNBasic Algorithm?
  
  (Asked by: username_0 on 2020-04-07)
  
  I've been trying to hyper tuning my KNNBasic algorithm by the help of grid search for recommendation system for movie review data. The problem is that both of my KNNBasicTuned and KNNBasicUntuned shows the same result. Here is my code for KNNTuning..
  I have tried the SVD algo tuning and it worked perfectly so all my libraries are working perfectly. However my all libraries are in my github linke : <https://github.com/iSarcastic99/KNNBasicTuning>
  
  Code of KNNBasicTuning :
  
  [![enter image description here](https://i.sstatic.net/wXuBB.png)](https://i.sstatic.net/wXuBB.png)
  
  ```
  # -*- coding: utf-8 -*-
  """
  Created on Sat Apr  4 01:25:40 2020
  
  @author: rahulss
  """
  #My libraries
  
  from MovieLens import MovieLens    
  from surprise import KNNBasic
  from surprise import NormalPredictor
  from Evaluator import Evaluator
  from surprise.model_selection import GridSearchCV
  
  import random
  import numpy as np
  
  #loading my working data
  def LoadMovieLensData():
      ml = MovieLens()
      print("Loading movie ratings...")
      data = ml.loadMovieLensLatestSmall()
      print("\nComputing movie popularity ranks so we can measure novelty later...")
      rankings = ml.getPopularityRanks()
      return (ml, data, rankings)
  
  np.random.seed(0)
  random.seed(0)
  
  # Load up common data set for the recommender algorithms
  (ml, evaluationData, rankings) = LoadMovieLensData()
  
  print("Searching for best parameters...")
  param_grid = {'n_epochs': [10, 30], 'lr_all': [0.005, 0.010],
            'n_factors': [50, 90]}
  gs = GridSearchCV(KNNBasic, param_grid, measures=['rmse', 'mae'], cv=3)
  
  gs.fit(evaluationData)
  
  # best RMSE score
  print("Best RMSE score attained: ", gs.best_score['rmse'])
  
  # combination of parameters that gave the best RMSE score
  print(gs.best_params['rmse'])
  
  # Construct an Evaluator to, you know, evaluate them
  evaluator = Evaluator(evaluationData, rankings)
  
  params = gs.best_params['rmse']
  KNNBasictuned = KNNBasic(n_epochs = params['n_epochs'], lr_all =  params['lr_all'], n_factors = params['n_factors'])
  evaluator.AddAlgorithm(KNNBasictuned, "KNN - Tuned")
  
  KNNBasicUntuned = KNNBasic()
  evaluator.AddAlgorithm(KNNBasicUntuned, "KNN - Untuned")
  
  # Evaluating all algorithms
  evaluator.Evaluate(False)
  
  evaluator.SampleTopNRecs(ml, testSubject=85, k=10)
  
  ```
  
  **Tags:** python, hyperparameter-optimization, recommender-system
  
  > **Comments:**
  > **username_1**: Hi and welcome to AI SE! You say "The problem is that both of my KNNBasicTuned and KNNBasicUntuned shows the same result.", but what do you mean by "result"?  
  > **username_0**: @username_1, Thanks for welcoming me. By result, I meant my RMSE and MAE score of both KNNBasicTuned and KNNBasicUntuned are same.  
  > **username_2**: All the parameters you set on the grid search are completely irrelevant for KNN. You probably get the same results cause you're always training the model with default parameters. The only parameters you can fine tune are k, min_k and eventually extra options (like the metric to use to compute the distances). Check the documentation [link](https://surprise.readthedocs.io/en/stable/knn_inspired.html)  
  > **username_0**: @username_2, First thanks for trying to help. However, as you can see that i've used GridSearchCV and it requires the given parameters above. For more infor pls check the link here     [GridSearchCV](https://surprise.readthedocs.io/en/stable/getting_started.html#tune-algorithm-parameters-with-gridsearchcv)  
  > **username_2**: @username_0 In a grid search you need to specify the parameters you want to tune, but a KNN is not trained using epochs, and it doesn't require a learning rate, it is not a neural network. I'll write an answer in an hour to show you what you can tune.  
  > **username_0**: @username_2, I completely agree with you that i need something else(other than GridSearchCV) which can help tuning knn and thats what i was hoping to be answered. Waiting for your answer. Thanks again.  
  
  ---
  
  ## 0 answers
  
  