This file contains 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
makeglm <- function(formula, ..., family, data=NULL) { | |
dots <- list(...) | |
out<-list() | |
tt <- terms(formula, data=data) | |
if(!is.null(data)) { | |
mf <- model.frame(tt, data) | |
vn <- sapply(attr(tt, "variables")[-1], deparse) | |
if((yvar <- attr(tt, "response"))>0) | |
vn <- vn[-yvar] |
This file contains 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
# (C) Mathieu Blondel, November 2013 | |
# License: BSD 3 clause | |
import numpy as np | |
def ranking_precision_score(y_true, y_score, k=10): | |
"""Precision at rank k | |
Parameters |