File size: 3,172 Bytes
acd23ae
9f3d312
acd23ae
9f3d312
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
acd23ae
9f3d312
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
acd23ae
9f3d312
 
 
 
 
 
acd23ae
 
9f3d312
acd23ae
9f3d312
 
 
 
 
 
 
 
 
 
 
 
 
 
acd23ae
9f3d312
 
 
 
 
 
 
 
 
 
acd23ae
9f3d312
 
 
 
 
 
 
 
acd23ae
 
9f3d312
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
library(shiny)
library(DT)

# --- Mock Data ---
model_data <- data.frame(
  Methodology = c(
    "Linear Regression",
    "Logistic Regression",
    "Random Forest",
    "Gradient Boosting (XGBoost)",
    "Support Vector Machine",
    "Neural Network (MLP)",
    "K-Nearest Neighbors",
    "LASSO Regression",
    "Decision Tree",
    "Naive Bayes"
  ),
  Category = c(
    "Regression", "Classification", "Ensemble", "Ensemble",
    "Kernel-based", "Deep Learning", "Instance-based",
    "Regression", "Tree-based", "Probabilistic"
  ),
  Interpretability = c(
    "High", "High", "Medium", "Low",
    "Low", "Low", "Medium",
    "High", "High", "High"
  ),
  Scalability = c(
    "High", "High", "Medium", "High",
    "Low", "High", "Low",
    "High", "Medium", "High"
  ),
  Handles_Nonlinearity = c(
    "No", "No", "Yes", "Yes",
    "Yes", "Yes", "Yes",
    "No", "Yes", "No"
  ),
  Typical_Use_Case = c(
    "Continuous outcome prediction",
    "Binary/multi-class classification",
    "Tabular data, feature importance",
    "Competitions, structured data",
    "High-dimensional classification",
    "Complex pattern recognition",
    "Recommendation, anomaly detection",
    "Feature selection, sparse models",
    "Simple rule-based decisions",
    "Text classification, spam filtering"
  ),
  Requires_Feature_Scaling = c(
    "No", "No", "No", "No",
    "Yes", "Yes", "Yes",
    "No", "No", "No"
  ),
  stringsAsFactors = FALSE
)

# --- UI ---
ui <- fluidPage(
  titlePanel("Model / Methodology Comparison"),
  
  sidebarLayout(
    sidebarPanel(
      width = 3,
      h4("Filters"),
      selectInput(
        "category_filter", "Category:",
        choices = c("All", sort(unique(model_data$Category))),
        selected = "All"
      ),
      selectInput(
        "interp_filter", "Interpretability:",
        choices = c("All", "High", "Medium", "Low"),
        selected = "All"
      ),
      checkboxInput("nonlinear_only", "Only models handling nonlinearity", FALSE),
      hr(),
      p("This table summarizes key properties of common modeling methodologies.",
        style = "color: grey; font-size: 0.9em;")
    ),
    
    mainPanel(
      width = 9,
      DTOutput("model_table")
    )
  )
)

# --- Server ---
server <- function(input, output, session) {
  
  filtered_data <- reactive({
    df <- model_data
    
    if (input$category_filter != "All") {
      df <- df[df$Category == input$category_filter, ]
    }
    if (input$interp_filter != "All") {
      df <- df[df$Interpretability == input$interp_filter, ]
    }
    if (input$nonlinear_only) {
      df <- df[df$Handles_Nonlinearity == "Yes", ]
    }
    df
  })
  
  output$model_table <- renderDT({
    datatable(
      filtered_data(),
      options = list(
        pageLength = 10,
        autoWidth = TRUE,
        columnDefs = list(
          list(width = "180px", targets = 0),
          list(width = "200px", targets = 5)
        )
      ),
      rownames = FALSE,
      colnames = c(
        "Methodology", "Category", "Interpretability", "Scalability",
        "Handles Nonlinearity", "Typical Use Case", "Requires Feature Scaling"
      )
    )
  })
}

shinyApp(ui, server)