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
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!") |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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) |
I created a function called "extract_colours()" in my "rPlotter" package. Using this function, any image in PNG, JPG, JPEG or TIFF format can be converted into a simple colour palette.
YET, this is my very first attempt, the colours are only sorted by alphabetical order at the moment. More work is needed to arrange colours based on colour theory and other factors.
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
# 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 |
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
## Convert Breast Cancer into H2O | |
dat <- BreastCancer[, -1] # remove the ID column | |
dat_h2o <- as.h2o(localH2O, dat, key = 'dat') | |
## Import MNIST CSV as H2O | |
dat_h2o <- h2o.importFile(localH2O, path = ".../mnist_train.csv") |
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
## 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, |
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:
- demo how we can use
htmltools
to build html/js in R - help users understand some of the things
rCharts
does f
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
## 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 |
NewerOlder