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
predict_function_full = function(test.obs){ | |
obs.NAs = sum(is.na(test.obs)) | |
if(obs.NAs == 0){ | |
return(predict(M0.svm.full, test.obs[-1], probability = TRUE, na.rm = TRUE)) | |
} | |
else if(obs.NAs == 1){ | |
return(predict(M1.svm.full, test.obs[-1], probability = TRUE, na.rm = TRUE)) | |
} | |
else if(obs.NAs == 7){ |
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
cost = seq(-3, 5, length = 3) | |
gamma = seq(-5, 1, length = 3) | |
set.seed(0) | |
M0.index = sample(1:nrow(M0.training), 10000) | |
cv.svm.M0 = tune(svm, | |
Label ~ ., | |
data = M0.training[M0.index, -c(1, ncol(M0.training) - 1)], | |
kernel = "radial", | |
ranges = list(cost = 10^(cost), |
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("shiny") | |
library("dplyr") | |
library("ggplot2") | |
# I will create a function that inputs the parameters the user is prompted for, | |
# and main data frame items_tbl, and outputs a data frame that will be used for | |
# plotting the histogram. | |
items_filter = function(items_tbl, | |
Price_Range_selected, |
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(shiny) | |
library(dplyr) | |
library(ggplot2) | |
source("./helpers.R") | |
load("./shinydataframe.RData") | |
server <- function(input, output) { | |
data <- eventReactive(input$go, {items_filter(items_tbl, | |
input$Price_Range_selected, | |
input$Payment_Types_selected, |
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(shiny) | |
library(dplyr) | |
fluidPage( | |
titlePanel("What Kind of Revenue Interests You?"), | |
sidebarLayout( | |
sidebarPanel( | |
sliderInput(inputId = "Price_Range_selected", | |
label = h3("Product Unit Price Range ($)"), |
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
# preparing data for Shiny app | |
load("/Users/adamcone/Desktop/projects/Shiny Project/data munging/op_data_conversion_filtered.RData") | |
rm(sales_tbl) | |
items_tbl = select(items_tbl, DateTime, Payment_Type, Unit_Cost, Item_Total) | |
items_tbl = mutate(items_tbl, Date = as.Date(DateTime)) | |
first_date = as.Date(min(items_tbl$DateTime)) | |
last_date = as.Date(max(items_tbl$DateTime)) | |
break_points = seq(from = first_date, |