This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- coding: utf-8 -*- | |
| # | |
| # Author: Taylor G Smith | |
| # | |
| # Recommender system ranking metrics derived from Spark source for use with | |
| # Python-based recommender libraries (i.e., implicit, | |
| # https://github.com/benfred/implicit/). These metrics are derived from the | |
| # original Spark Scala source code for recommender metrics. | |
| # https://github.com/apache/spark/blob/master/mllib/src/main/scala/org/apache/spark/mllib/evaluation/RankingMetrics.scala |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Ensemble(object): | |
| def __init__(self, n_splits, stacker, base_models): | |
| self.n_splits = n_splits | |
| self.stacker = stacker | |
| self.base_models = base_models | |
| def fit_predict(self, X, y, T): | |
| X = np.array(X) | |
| y = np.array(y) | |
| T = np.array(T) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """Information Retrieval metrics | |
| Useful Resources: | |
| http://www.cs.utexas.edu/~mooney/ir-course/slides/Evaluation.ppt | |
| http://www.nii.ac.jp/TechReports/05-014E.pdf | |
| http://www.stanford.edu/class/cs276/handouts/EvaluationNew-handout-6-per.pdf | |
| http://hal.archives-ouvertes.fr/docs/00/72/67/60/PDF/07-busa-fekete.pdf | |
| Learning to Rank for Information Retrieval (Tie-Yan Liu) | |
| """ | |
| import numpy as np |