Using AI in Business Data Analytics

BUS 320

Introduction

  • AI is revolutionizing business data analytics
  • Powerful tool for automating tasks and improving efficiency
  • Learn how to leverage AI to diagnose and correct coding errors

AI Applications in Business Data Analytics

  • Data preprocessing and cleaning
  • Exploratory data analysis
  • Predictive modeling and forecasting

Correcting Coding Errors with AI

  • AI can help identify and correct coding errors
  • Common errors include typos, incorrect function names, and misused operators

Example

  • Load libraries
  • Read data
library(tidyverse)

sales_data <- read_csv("https://bus320-quarto.netlify.app/data/sales_data.csv")

Example data

Data dictionary

  • date: The date of the sales transaction in the format YYYY-MM-DD.
  • product: The name of the product sold (Product A, Product B, or Product C).
  • sales: The sales amount for the corresponding product on the given date.

Example data

glimpse(sales_data)
Rows: 31
Columns: 3
$ date    <date> 2023-01-01, 2023-01-02, 2023-01-03, 2023-01-04, 2023-01-05, 2…
$ product <chr> "Product A", "Product B", "Product C", "Product A", "Product B…
$ sales   <dbl> 1500, 800, 1200, 900, 1100, 1800, 1300, 1000, 1600, 1100, 1200…

1: Incorrect Code

sales_data  |>
  filter(sales > 1000) |>
  groupby(product) |>
  summarise(total_sales = sum(sales))
  • What is the error?

  • Copy and paste into ChatGPT 3.5

1: Correct Code

2: Incorrect Code

sales_data  |>
  select(product, sales) |>
  filter(sales > 1000) |>
  group_by(product) |>
  summarise(total_sales = sales)

2: Correct Code

3: Incorrect Code

sales_data  |>
  select(sales) |>
  filter(sales > 1000) |>
  group_by(product) |>
  summarise(avg_sales = mean(sales))

3: Correct Code

Benefits of AI in Business Data Analytics

  • Increased efficiency and productivity
  • Reduced errors and improved accuracy
  • Faster insights and decision-making
  • Automation of repetitive tasks

Challenges and Considerations

  • Data privacy and security concerns
  • Ethical considerations in AI-driven decision-making
    • Potential bias in AI algorithms
  • Need for domain expertise and human oversight
  • Interpretability and transparency of AI models
  • Regulatory compliance and legal implications
  • Scalability and integration with existing systems