Skip to content

Instantly share code, notes, and snippets.

mpg_fit<-
readRDS("mpg_fit.Rdata")
predict_mpg<-function(disp, wt, hp){
new_data<-data.frame(disp=as.numeric(disp),
wt=as.numeric(wt),
hp=as.numeric(hp))
predict(mpg_fit, newdata = new_data)
}
library(randomForest)
mpg_fit<-
randomForest(mpg~disp+wt+hp, mtcars)
saveRDS(mpg_fit, "mpg_fit.Rdata")
@bart6114
bart6114 / OECDcareresources.csv
Created January 19, 2014 12:44
Evolution hospital beds, resources and consumption
Variable Unit Country Year Value Flags
Total hospital beds Number Australia 1960 99191
Total hospital beds Number Australia 1961 99670
Total hospital beds Number Australia 1962 100413
Total hospital beds Number Australia 1963 102109
Total hospital beds Number Australia 1964 102618
Total hospital beds Number Australia 1965 103580
Total hospital beds Number Australia 1966 103636
Total hospital beds Number Australia 1967 104262
Total hospital beds Number Australia 1968 103397
Evolution hospital beds, resources and consumption
========================================================
```{r setup, echo=FALSE, message=FALSE, warning=FALSE}
imgur_insecure<-function (file, key = "75ace4c8e871b86")
{
if (!is.character(key))
stop("The Imgur API Key must be a character string!")
res = RCurl::postForm("https://api.imgur.com/3/image.xml",
image = RCurl::fileUpload(file), .opts = RCurl::curlOptions(httpheader = c(Authorization = paste("Client-ID",
key)),ssl.verifypeer = FALSE))
{
"env": {
"resources": {
"nurse": {
"capacity": 1
},
"doctor": {
"capacity": 1
}
},
{
"env": {
"resources": {
"nurse": {
"capacity": 1
},
"doctor": {
"capacity": 1
}
},
library(lpSolveAPI)
#used for result visualization
library(ggplot2)
library(reshape)
library(gridExtra)
#define the datasets
train<-data.frame(wagon=c('w1','w2','w3'), weightcapacity=c(10,8,12), spacecapacity=c(5000,4000,8000))
library(R6)
library(simmer)
BatchGate <- R6Class("BatchGate",
public = list(
queue_length = 0,
opens_at_length = NA,
open = FALSE,
allowed_to_pass = 0,
initialize = function(opens_at_length){
@bart6114
bart6114 / bpnn.py
Created December 13, 2014 19:34
adjusted bpnn.py
# Back-Propagation Neural Networks
#
# Written in Python. See http://www.python.org/
# Placed in the public domain.
# Neil Schemenauer <nas@arctrix.com>
# Adapted for instructional purposes by Bart Smeets <bartsmeets86@gmail.com>
import math
import random
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.