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 | |
from tensorflow import keras | |
from tensorflow.keras import layers | |
import time | |
start_time = time.time() | |
# Model / data parameters | |
num_classes = 10 | |
input_shape = (28, 28, 1) |
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
var MAX_AGENTS_TO_TEST = 200; | |
function determineAgents(callDuration, calls, periodLength, answerTarget, serviceLevelTarget) { | |
if(calls === 0) return(0); | |
for (var agents = 1; agents <= MAX_AGENTS_TO_TEST; agents++) { | |
if(serviceLevel(callDuration, calls, periodLength, agents, answerTarget) >= serviceLevelTarget) break; | |
} | |
return(agents); | |
} |
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
library(lubridate) # needs >= v1.6.0.9 for correct handling of lubridate.week.start with floor_date | |
options(lubridate.week.start = 1) # Weeks start on Mondays, use 7 for Sundays | |
library(dplyr) | |
library(ggplot2) | |
library(scales) | |
library(glue) | |
source("../analytics/utils/db.R", local = FALSE) | |
query <- function(sql, db = mainframe_db) {return(collect(tbl(db, sql(sql))))} | |
period_diff <- function(start, end, unit = "month") { |
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
select | |
product_segment as Segment, | |
round(avg(revenue_then)) as `Average Revenue`, | |
count(distinct company_id) as n, | |
round(power(power(sum(revenue_now) / sum(revenue_then), 1/period_diff(date_format(month_now, "%Y%m"), date_format(month_then, "%Y%m"))), 12), 2) as `Annual Revenue Retention`, | |
round(1 - power(1 - sum(churned)/count(*), 1/period_diff(date_format(month_now, "%Y%m"), date_format(month_then, "%Y%m"))), 3) as `Monthly Churn` | |
from ( | |
select old.company_id, product_segment, size_segment, channel_segment, old.revenue as revenue_then, new.revenue as revenue_now, new.revenue is null as churned, new.revenue_month as month_now, old.revenue_month as month_then | |
from ( | |
select |
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
library(RPostgreSQL) | |
library(dplyr) | |
library(whisker) | |
source("config.R") | |
redshift <<- src_postgres( | |
dbname = redshift_database, | |
host = redshift_server, | |
port = redshift_port, | |
user = redshift_username, |
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
library(rvest) | |
library(ggvis) | |
trim <- function (x) gsub("^\\s+|\\s+$", "", x) | |
to_number <- function(string) { | |
string <- trim(string) | |
len <- nchar(string) | |
last_char <-substr(string, len, len) | |
suppressWarnings( |
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
require(RMySQL) | |
require(ggplot2) | |
require(scales) | |
myusername = "peter" | |
mypassword = "sekret" | |
system('ssh -f [email protected] -L 3306:localhost:3306 -N -o ExitOnForwardFailure=yes') | |
con <- dbConnect(MySQL(), | |
user=myusername, password=mypassword, |
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
// Global variables | |
var BASEURI = 'https://app.firmafon.dk/api/v1'; | |
var OPENTIME, CLOSETIME; | |
var SS = SpreadsheetApp.getActiveSpreadsheet(); | |
function readConfig() { | |
OPENTIME = new Date(); | |
OPENTIME.setHours(SS.getRangeByName("OpenHour").getValue()); | |
OPENTIME.setMinutes(SS.getRangeByName("OpenMinute").getValue()); | |
OPENTIME.setSeconds(0); |
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
// Global variables | |
var BASEURI = 'https://app.firmafon.dk/api/v1'; | |
var OPENTIME, CLOSETIME; | |
var SS = SpreadsheetApp.getActiveSpreadsheet(); | |
function readConfig() { | |
OPENTIME = new Date(); | |
OPENTIME.setHours(SS.getRangeByName("OpenHour").getValue()); | |
OPENTIME.setMinutes(SS.getRangeByName("OpenMinute").getValue()); | |
OPENTIME.setSeconds(0); |
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
# Formulas from http://www.mitan.co.uk/erlang/elgcspsh.htm | |
#input | |
n = 80 # number of calls | |
t = 8*60*60 # period length in seconds | |
d = 4.5*60 # call duration in seconds | |
M = 2 # number of agents | |
s = 20 # target SLA in seconds | |
# Output |
NewerOlder