From 60d3cb1c3d667fbbecf7f428031c0d100598cdef Mon Sep 17 00:00:00 2001 From: Corey Dow-Hygelund Date: Fri, 17 Jan 2020 10:26:58 -0800 Subject: [PATCH] Scaling QQ plot. Commenting out bootstrapping. --- .../milestone_5/dashboard/lib/prediction.R | 29 ++++++++++++++++++- .../milestone_5/dashboard/plotters.R | 5 ++-- 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/perf_release_criteria/milestone_5/dashboard/lib/prediction.R b/perf_release_criteria/milestone_5/dashboard/lib/prediction.R index 56e9923..6fc3f87 100644 --- a/perf_release_criteria/milestone_5/dashboard/lib/prediction.R +++ b/perf_release_criteria/milestone_5/dashboard/lib/prediction.R @@ -1,6 +1,7 @@ library(tidyr) library(purrr) library(lubridate) +# library(boot) source('lib/scoring.R') extract_health_metrics <- function(predictions, release, outcomes, v_n1){ @@ -41,4 +42,30 @@ extract_health_metrics <- function(predictions, release, outcomes, v_n1){ mutate(version = v_n1) return(health_metrics) -} \ No newline at end of file +} + +# bootstrap_mean <- function(predictions, release, metrics){ +# agg_sets <- function(predictions){ +# predictions %>% +# select(metrics) %>% +# gather("metric", "value") %>% +# group_by(metric) %>% +# summarise( +# mean = mean(value) +# ) %>% +# pull(mean) +# } +# +# bs_stat <- function(df, indices) { +# df_trim <- df[indices, ] +# predictions <- df_trim %>% filter(label == 'beta') +# release <- df_trim %>% filter(label == 'release') +# pred_agg <- agg_sets(predictions) +# # release_agg <- agg_sets(release[indices,]) +# release_agg <- agg_sets(release) +# rel_diff <- (abs(pred_agg-release_agg)/release_agg) +# return(rel_diff) +# } +# return(boot(data=predictions %>% bind_rows(release), statistic=bs_stat, +# R=100, parallel = "multicore", ncpus = 2)) +# } \ No newline at end of file diff --git a/perf_release_criteria/milestone_5/dashboard/plotters.R b/perf_release_criteria/milestone_5/dashboard/plotters.R index 1579086..2a315f8 100644 --- a/perf_release_criteria/milestone_5/dashboard/plotters.R +++ b/perf_release_criteria/milestone_5/dashboard/plotters.R @@ -43,8 +43,9 @@ plot.qq <- function(qq.df, response, ranges=NULL){ theme(axis.text.x = element_text(angle = 45, hjust = 1), plot.title = element_text(size=10), legend.position = c(0.8, 0.2)) + - # scale_x_continuous(limits = ranges$x) + - coord_cartesian(xlim = ranges$x)+ + scale_x_continuous(limits = ranges$x) + + scale_y_continuous(limits = ranges$x) + + # coord_cartesian(xlim = ranges$x)+ ggtitle(response) return(p_qq)