Skip to content

Instantly share code, notes, and snippets.

View sebnyberg's full-sized avatar
🇸🇪

Sebastian Nyberg sebnyberg

🇸🇪
View GitHub Profile
library(ggplot2)
# returns the odds of a model given an input vector x
get_log_odds <- function(model,x) {
n_coeff <- length(model$coefficients)
if (n_coeff - length(x) == 1) {
# user forgot the first 1 in [1, x1,...]
x <- c(1,x)
source('helpers.R')
# ========================================
# ==============[ Q 3.3.1 ]===============
# ========================================
load('hilda.Rdata')
# redefine the hospitaldays to be 1 for anything above 1
# ========================================
# ==============[ Q 3.2.1 ]===============
# ========================================
load('hilda.Rdata')
source('helpers.R')
hilda <- setup_data_base(hilda)
# form the first model by splitting the ages into groups of five
# ========================================
# ==============[ Q 3.1.1 ]===============
# ========================================
# load data
load('hilda.Rdata')
source('helpers.R')
# redifine the hospitaldays to be 1 for anything above 1
hilda$hospdays[(hilda$hospdays >= 1)] = 1
library(ggplot2)
source('helpers.R')
# ======================================
# ==============[ Q 3.4 ]===============
# ======================================
# prepare the model by defining factors
library(ggplot2)
source('helpers.R')
load('data.Rda')
head(data)
####### Setup data
data$crm <- (data$crimes / data$popul) * 1000
data$crm <- ceiling(data$crm)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DataReader.Extensions;
using iTextSharp.text.log;
using iTextSharp.text.pdf;
using iTextSharp.text.pdf.parser;
namespace DataReader.ExploredCode
@sebnyberg
sebnyberg / Decorators-For-React-Native-Instruction.md
Created September 7, 2017 16:17
How to setup decorators in React Native

Using decorators in React Native

  1. Install babel plugins to enable decorators.

    npm install babel-plugin-transform-decorators-legacy --save-dev
  2. Create or update your .babelrc file in root folder:

@sebnyberg
sebnyberg / Dockerfile
Last active October 27, 2020 21:34 — forked from yefim/Dockerrun.aws.json
Build a Docker image, push it to AWS EC2 Container Registry, then deploy it to AWS Elastic Beanstalk
# Example Dockerfile
FROM hello-world