Skip to content

Instantly share code, notes, and snippets.

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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){
{
"env": {
"resources": {
"nurse": {
"capacity": 1
},
"doctor": {
"capacity": 1
}
},
{
"env": {
"resources": {
"nurse": {
"capacity": 1
},
"doctor": {
"capacity": 1
}
},
library(randomForest)
mpg_fit<-
randomForest(mpg~disp+wt+hp, mtcars)
saveRDS(mpg_fit, "mpg_fit.Rdata")
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)
}
@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
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))
clientid income age loan LTI default10yr
1 66155.9250950813 59.0170150669292 8106.53213128514 0.122536751162261 0
2 34415.1539658196 48.1171531048603 6564.74501767738 0.190751580661163 0
3 57317.1700630337 63.108049491886 8020.95329638647 0.139939799671993 0
4 42709.5342008397 45.7519723521546 6103.6422601407 0.142910532141104 0
5 66952.6888453402 18.5843359269202 8770.09923520439 0.130989499995485 1
6 24904.0641402826 57.4716071025468 15.4985984378272 0.000622332096099854 0
7 48430.3596126847 26.8091324190609 5722.58198121271 0.118161046644673 0
8 24500.1419843175 32.8975483207032 2971.00330971188 0.121264738449827 1
9 40654.8925372772 55.4968525394797 4755.8252798016 0.116980392346159 0
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))