library(tidyverse)
library(tidyquant)
library(parsnip)
library(plotly)
library(scales)
source("scripts/separate_bikes_and_outlier_detection.R")
source("scripts/plot_product_recommendation.R")
bike_orderlines_tbl <- read_rds("data/bike_orderlines.rds")
models_tbl <- read_rds("models/parsnip_models_tbl.rds")
# CREATE NEW MODELS
new_over_mountain_trigger <- tibble(
    model = "Trigger Al 1",
    frame_material = "Aluminum",
    category_2 = "Over Mountain",
    model_base = "Trigger",
    model_tier = "Aluminum 1",
    black      = 0,
    hi_mod     = 0,
    team       = 0,
    red        = 0,
    ultegra    = 0,
    dura_ace   = 0,
    disc       = 0
) 

new_triathalon_slice_tbl <- tibble(
    model = "Slice Al 1",
    frame_material = "Aluminum",
    category_2 = "Triathalon",
    model_base = "Slice",
    model_tier = "Ultegra",
    black      = 0,
    hi_mod     = 0,
    team       = 0,
    red        = 0,
    ultegra    = 0,
    dura_ace   = 0,
    disc       = 0
) 

new_bikes_tbl <- bind_rows(new_over_mountain_trigger, 
                           new_triathalon_slice_tbl)
# GET XGBOOST MODEL
model_07_xgboost <- models_tbl %>%
    filter(model_id %>% str_detect("XGBOOST")) %>%
    pull(model) %>%
    # pluck(1) allows us to grab first element of list
    pluck(1)

Problem Statement

Research and Development wants help to determine new product ideas and pricing using existing product line as a benchmark.

Solution Summary

We’ve identified several product gaps in the existing product line including:

  1. Aluminum Over Mountain

  2. Aluminum Triathalon

The Data Science Team has developed a pricing model that uses predictive analytics to estimate the price of the new bicycle models based on the existing fleet. This ensures that new models are priced comparatively to other similar bicycles.

New product prediction for 2 new models:

  1. Trigger, Over Mountain with Aluminum Frame: $3,162

  2. Slice, Triathalon with Aluminum Frame: $2,494

Next Steps: Integrate the model into a proof-of-concept web application that can be deployed to the R&D department.

Gap Analysis

Bike List

Our current product portfolio consists of 97 bike models that were analyzed.

get_bike_features()

Gaps

The visualization segments the full bicycle product line by category and frame material. This exposes two product gaps:

  1. New Aluminum line of bikes in the Over Mountain Category

  2. New Aluminum line of bikes in the Triathalon Category

plot_bike_features(interactive = params$interactive)

Price Prediction

New product prediction for 2 new models:

  1. Trigger, Over Mountain with Aluminum Frame: $3,162

  2. Slice, Triathalon with Aluminum Frame: $2,494

# OUTPUT PREDICTIONS IN A TABLE
model_07_xgboost %>%
    predict(new_bikes_tbl) %>%
    mutate(.pred = scales::dollar(.pred, accuracy = 1)) %>%
    bind_cols(new_bikes_tbl) %>%
    gather(key = "New Model Attribute", value = "value", -model, factor_key = TRUE) %>%
    spread(key = model, value = value) %>%
    knitr::kable()
New Model Attribute Slice Al 1 Trigger Al 1
.pred $2,494 $3,162
frame_material Aluminum Aluminum
category_2 Triathalon Over Mountain
model_base Slice Trigger
model_tier Ultegra Aluminum 1
black 0 0
hi_mod 0 0
team 0 0
red 0 0
ultegra 0 0
dura_ace 0 0
disc 0 0