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()

# Construct an Evaluator to, you know, evaluate them
evaluator = Evaluator(evaluationData, rankings)

contentKNN = ContentKNNAlgorithm()
evaluator.AddAlgorithm(contentKNN, "ContentKNN")

# Just make random recommendations
Random = NormalPredictor()
evaluator.AddAlgorithm(Random, "Random")

evaluator.Evaluate(True)

evaluator.SampleTopNRecs(ml)
    return (azr, data, rankings)


# Load up common data set for the recommender algorithms
(ml, evaluationData, rankings) = LoadMovieLensData()

#(azr,evaluationData, rankings) = LoadAmazonData()

# Construct an Evaluator to, you know, evaluate them

######### our evaluation code #########

evaluator = Evaluator(evaluationData, rankings, doTopN=True)

SVDAlgorithm = SVDpp()
evaluator.AddAlgorithm(SVDAlgorithm, "SVD++")
#SVDppAlgorithm = SVDpp()
#evaluator.AddAlgorithm(SVDppAlgorithm, "SVD++")
evaluator.Evaluate()

#evaluator.SampleTopNRecs(ml)

### buit-in fonction for evaluation #######"

#algo = SVD()

# Run 3-fold cross-validation and print results
#cross_validate(algo, evaluationData, measures=['RMSE', 'MAE'], cv=3, verbose=True)

# Retrieve the trainset.
#trainset = evaluationData.build_full_trainset()