Skip to content

Instantly share code, notes, and snippets.

View woobe's full-sized avatar
🏡
WFH

Jo-fai Chow woobe

🏡
WFH
View GitHub Profile
@woobe
woobe / app.py
Created March 17, 2022 09:23
Tutorial - Setup for HAIC App Developers
from h2o_wave import main, app, Q, ui
@app('/demo')
async def serve(q: Q):
q.page["my_form_card"] = ui.form_card(
box='1 1 -1 -1',
items=[
ui.text("My first app!")
@woobe
woobe / airline_sentiment_python_api.ipynb
Created September 11, 2018 19:27
Example notebook for Airline Sentiment using Driverless AI's Python API
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@woobe
woobe / split_airline_sentiment.py
Created September 11, 2018 18:25
A simple script to split airline sentiment dataset into train and test set
import numpy as np
import pandas as pd
from sklearn import model_selection
al = pd.read_csv("Airline-Sentiment-2-w-AA.csv", encoding='ISO-8859-1')
train_al, test_al = model_selection.train_test_split(al, test_size=0.2, random_state=2018)
train_al.to_csv("train_airline_sentiment.csv", index=False)
test_al.to_csv("test_airline_sentiment.csv", index=False)
@woobe
woobe / h2o_save_load_model.R
Last active June 14, 2017 15:39
An example of saving and loading H2O model in R
# Example: Saving and loading H2O models
# Using Iris for this example
d_train <- iris
# Initialize H2O
library(h2o)
h2o.init(nthreads = -1)
# Train a DRF model
@woobe
woobe / Readme.md
Last active August 29, 2015 14:06 — forked from timelyportfolio/Readme.md

Introduction

This d3.js parallel coordinates plot is another experiment in how we might use interactive plots in Javascript to represent a partykit / rpart object from R. The example builds on this d3.js collapsible tree plot. Eventually, it would be nice to combine the tree and parallel coordinates into a layout with synced interactivity.


### Almost No [`rCharts`](http://rcharts.io) Also, this is fairly different from most of my interactive plots from R in that it almost completely avoids [`rCharts`](http://rcharts.io) (almost because I did use its `publish` to make this gist). I chose to exclude `rCharts` for two reasons:
  1. demo how we can use htmltools to build html/js in R
  2. help users understand some of the things rCharts does f
@woobe
woobe / link_data.R
Last active January 7, 2016 15:42
[Blog]: Things to try after useR! Part 1: Regularized Deep Learning with H2O
@woobe
woobe / code.R
Last active October 30, 2015 14:11
[recharts]: ECharts Style Area Charts
## Load package
library(recharts) ## see https://github.com/taiyun/recharts
## Convert UKgas time series into a matrix
mat_UKgas <- matrix(UKgas, ncol = 4, byrow = TRUE)
rownames(mat_UKgas) <- rep(1960:1986, each = 1)
colnames(mat_UKgas) <- c("Q1", "Q2", "Q3", "Q4")
## Create the echarts plot object
e1 <- eArea(mat_UKgas,
@woobe
woobe / code.R
Last active August 29, 2015 14:02
[rCrimemap]: All Crimes in January 2014 on Open Street Map
## Load Library
library(rCrimemap) # devtools::install_github("woobe/rCrimemap")
## Create Crime Heatmap with Nokia map base
r1 <- rcmap_quick(period = "2014-01",
map_size = c(960, 500),
provider = "OpenStreetMap.BlackAndWhite",
zoom = 6)
## Save the Heatmap as a self-contained HTML
@woobe
woobe / code.R
Last active August 29, 2015 14:02
[rCharts]: Parallel Coordinates Plot x Bart Simpson Colour Palette
library(rCharts) ## devtools::install_github("ramnathv/rCharts@dev")
library(rPlotter) ## devtools::install_github("woobe/rPlotter")
## Using Theoph as the demo data.
dat <- Theoph
## Initialise rCharts-parcoords
p1 <- rCharts$new()
p1$setLib(system.file('parcoords', package = 'rCharts'))
@woobe
woobe / index.html
Last active August 29, 2015 14:02
[rChartsCalendar]: Points Scored by Paul George
<!doctype HTML>
<meta charset = 'utf-8'>
<html>
<head>
<link rel='stylesheet' href='http://cdn.jsdelivr.net/cal-heatmap/3.3.10/cal-heatmap.css'>
<script src='http://d3js.org/d3.v3.min.js' type='text/javascript'></script>
<script src='http://cdn.jsdelivr.net/cal-heatmap/3.3.10/cal-heatmap.min.js' type='text/javascript'></script>
<style>