Skip to content

Instantly share code, notes, and snippets.

View dhimmel's full-sized avatar
🎯
Focusing

Daniel Himmelstein dhimmel

🎯
Focusing
View GitHub Profile
@dhimmel
dhimmel / onename.txt
Created September 3, 2014 20:27
onename verification
Verifying that +dhimmel is my Bitcoin username. You can send me #bitcoin here: https://onename.io/dhimmel
@dhimmel
dhimmel / vtm.R
Last active August 29, 2015 14:21
Variable threshold metrics in R for evaluating classifier performance
library(ROCR)
library(caTools)
VariableThresholdMetrics <- function(score, status) {
#' Evaluate the performance of predictions for a binary outcome.
#'
#' @param score A vector of predictions for which performance should be evalauted.
#' @param status A vector of the actual outcome: \code{0} (for negatives) and \code{1} (for positives).
#' @return A list.
@dhimmel
dhimmel / sung-views.ipynb
Created June 6, 2015 06:15
Retrieve article level metrics for a PLOS article and visualize views over time.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@dhimmel
dhimmel / elevcan-voe.ipynb
Created June 16, 2015 00:03
Vibration of effects analysis for lung cancer versus elevation
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@dhimmel
dhimmel / bto-terms-in-gnf.tsv
Created June 19, 2015 22:05
BTO (BRENDA Tissue Ontology) terms corresponding to GNF expression atlas tissues
bto_id bto_name cell_line
BTO:0000038 SW-480 cell 1
BTO:0000041 medulla oblongata 0
BTO:0000045 adrenal cortex 0
BTO:0000047 adrenal gland 0
BTO:0000084 vermiform appendix 0
BTO:0000089 blood 0
BTO:0000141 bone marrow 0
BTO:0000142 brain 0
BTO:0000211 caudate nucleus 0
@dhimmel
dhimmel / weighted-r2.R
Last active September 5, 2022 06:03
Computing the R-squared of a linear regression model with weighted observations in R
# Compare four methods for computing the R-squared (R2, coefficient of determination)
# with wieghted observations for a linear regression model in R.
# This work was written by Daniel Himmelstein (@dhimmel) with guidance
# from Alex Pankov (@a-pankov). It is released as CC0 (public domain).
get_r2_cor <- function(y, y_pred, w) {
# Calculate R2 using the correlation coefficient method
xy = cbind(y, y_pred)
return(boot::corr(d=xy, w=w) ^ 2)
}
@dhimmel
dhimmel / keybase.md
Created November 23, 2015 17:25
Proving account ownership for keybase.io

Keybase proof

I hereby claim:

  • I am dhimmel on github.
  • I am dhimmel (https://keybase.io/dhimmel) on keybase.
  • I have a public key whose fingerprint is 8CA9 B3A5 A4B4 D442 A285 867B 03A8 B7F8 47EE A45D

To claim this, I am signing this object:

@dhimmel
dhimmel / cypher-edge-swap.adoc
Last active December 28, 2018 23:38
Randomized edge swaps in cypher

Degree-Preserving Edge-Swap

Background

We designed a hetnet for drug repurposing that contains 50 thousand nodes (of 10 labels) and 3 million relationships (of 27 types). And we’ve chosen neo4j for handling network storage and interaction.

@dhimmel
dhimmel / preprints.ipynb
Last active January 4, 2016 16:44
Growth of bioscience preprints in 2015
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@dhimmel
dhimmel / hetio-ind.adoc
Last active January 31, 2016 21:43
2016 GraphGist Challenge · Drug repurposing by hetnet relationship prediction: a new hope · http://portal.graphgist.org/graph_gists/drug-repurposing-by-hetnet-relationship-prediction-a-new-hope

Drug repurposing by hetnet relationship prediction: a new hope


A long time ago in a galaxy far, far away…​.