Skip to content

Instantly share code, notes, and snippets.

View quartox's full-sized avatar

Jesse Lord quartox

View GitHub Profile
def import_module(file_name):
"""Import the file (including optional relative or absolute path) into
a module namespace.
Args:
file_name - A string with the name of the file to load as a module.
Returns:
The module namespace.
"""
@quartox
quartox / plotInteractions.R
Created April 14, 2016 16:15
Using plotly to create 3d partial dependence plots for variable interactions in a gbm model.
suppressMessages(library("gbm"))
suppressMessages(library("plotly"))
PlotInteraction <- function(model, interactingVariables) {
interactionEffect <- .ComputeInteractionEffect(model, interactingVariables)
.PlotInteractionSurface(interactionEffect, interactingVariables)
}
.PlotInteractionSurface <- function(interactionEffect, interactingVariables) {
xAxis <- .GetXAxis(interactionEffect)