Skip to content

Instantly share code, notes, and snippets.

@aficionado
aficionado / local_predictions.py
Created March 13, 2013 01:06
A simple example to create local predictions using a pre-built model
# import BigML class
from bigml.api import BigML
# import local Model class
from bigml.model import Model
# Instantiate the API with your credentials. You can avoid this if you set up your username and API key in your environment
api = BigML('yourusername', '3ff25044b4f4582903d90000a5fab240442e734c')
# Get the model. Assuming that you already created in BigML
@aficionado
aficionado / support_vs_confidence.py
Last active December 15, 2015 13:39
Plot Support vs Confidence for BigML promotional sources
from bigml.api import BigML
from bigml.model import Model
api = BigML()
def support_vs_confidence(model_id):
model = api.get_model(model_id)
local_model = Model(model)
leaves = local_model.get_leaves()
outputs = unique([leaf['output'] for leaf in leaves])
colors = linspace(0, 1, len(outputs))
@aficionado
aficionado / index.html
Last active December 15, 2015 15:39
Pima Indians Diabetes - Scattergraph (support vs confidence)
<!DOCTYPE html>
<meta charset="utf-8">
<style>
body {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
margin: auto;
position: relative;
width: 960px;
background: #fff;
@aficionado
aficionado / index.html
Last active December 15, 2015 15:39
Iris - Scattergraph (support vs confidence) -
<!DOCTYPE html>
<meta charset="utf-8">
<style>
body {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
margin: auto;
position: relative;
width: 960px;
background: #fff;
@aficionado
aficionado / index.html
Last active December 15, 2015 15:39
Adult - Scattergraph (support vs confidence)
<!DOCTYPE html>
<meta charset="utf-8">
<style>
body {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
margin: auto;
position: relative;
width: 960px;
background: #fff;
@aficionado
aficionado / index.html
Last active December 15, 2015 15:39
Cover - Scattergraph (support vs confidence)
<!DOCTYPE html>
<meta charset="utf-8">
<style>
body {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
margin: auto;
position: relative;
width: 960px;
background: #fff;
@aficionado
aficionado / index.html
Created April 2, 2013 22:32
private public model
<!DOCTYPE html>
<meta charset="utf-8">
<style>
body {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
margin: auto;
position: relative;
width: 960px;
background: #fff;
@aficionado
aficionado / index.html
Last active December 24, 2015 06:09
Visualizing Model Performance
<!DOCTYPE html>
<meta charset="utf-8">
<style>
body {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
margin: auto;
position: relative;
width: 960px;
background: #fff;
@aficionado
aficionado / README.md
Created November 19, 2013 00:56 — forked from mbostock/.block

Click to add new points. Hit the DELETE key to remove the selected point. Use the dropdown menu to change the interpolation mode.

@aficionado
aficionado / README.md
Created November 19, 2013 02:39 — forked from mbostock/.block

The first 15 seconds of the D3 show reel. See full video at http://vimeo.com/29862153. Includes seamless transitions between the following visualization types:

  • lines
  • horizons
  • areas
  • stacked areas
  • streamgraph
  • overlapping areas
  • grouped bars
  • stacked bars