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
simple_roc <- function(labels, scores){ | |
labels <- labels[order(scores, decreasing=TRUE)] | |
data.frame(TPR=cumsum(labels)/sum(labels), FPR=cumsum(!labels)/sum(!labels), labels) | |
} |
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 relevant packages | |
library(dplyr) | |
library(tidyverse) | |
library(arulesSequences) | |
#Import standard transaction data | |
transactions = read.csv("transactions.csv") | |
# Start time of data to be considered | |
start_month <- "2015-07-01" |
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
# Scrapes CRAN archives to determine the number of packages per release | |
# Create a list of pages to scrape, including both archive and current | |
extract_url <- function() { | |
url <- list( | |
archive = "https://cran-archive.r-project.org/bin/windows/contrib/", | |
active = "https://cran.r-project.org/bin/windows/contrib/" | |
) | |
get_urls <- function(url) { |
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
--- | |
title: "Outliers are a matter of opinion?" | |
author: "Antony Unwin" | |
date: ' ' | |
output: html_document | |
--- | |
```{r include=FALSE} | |
library(ggplot2) | |
library(ggthemes) | |
library(OutliersO3) |
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
#### Code from slides | |
## This code is excerpted from experiments-with-R.Rmd, | |
## edited and reformatted for use on slides | |
## SLIDE: Prepare Data | |
library(azuremlsdk) | |
ws <- load_workspace_from_config() | |
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
# Get frequent sequences and corresponding support values | |
s1 <- cspade(trans_matrix, parameter = list(support = 0.3), control = list(verbose = TRUE)) | |
s1.df <- as(s1, "data.frame") | |
summary(s1) |
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(AzureRMR) | |
library(AzureGraph) | |
library(AzureStor) | |
# set your Azure organization and subscription details here | |
tenant <- "mytenant" | |
sub_id <- "12345678-aaaa-bbbb-cccc-0123456789ab" | |
# create a Graph client | |
gr <- AzureGraph::create_graph_login(tenant) |
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
## get n colors at once | |
random.colors <- function(n) { | |
hexbot <- GET(endpoint, query=list(count=n)) | |
unlist(content(hexbot)$colors) | |
} | |
ncol <- 5 | |
barplot(rep(1,ncol),col=random.colors(ncol), axes=FALSE) |
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
## get n colors with locations | |
random.points <- function(n,width=100,height=100) { | |
hexbot <- GET(endpoint, query=list(count=n, width=width, height=height)) | |
data <- matrix(unlist(content(hexbot)$colors),ncol=3,byrow=TRUE) | |
cols <- data[,1] | |
x <- as.numeric(data[,2]) | |
y <- as.numeric(data[,3]) | |
data.frame(cols, x, y) | |
} |
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
## get a single color, and display on screen | |
random.color <- function() { | |
hexbot <- GET(endpoint) | |
content(hexbot)$colors[[1]]$value | |
} | |
rcol <- random.color() | |
barplot(1, col=rcol, main=rcol, axes=FALSE) |
NewerOlder