Skip to content

Instantly share code, notes, and snippets.

@yabyzq
Last active March 22, 2017 12:13
Show Gist options
  • Save yabyzq/912381a4b1bc6344663b05ca815311d0 to your computer and use it in GitHub Desktop.
Save yabyzq/912381a4b1bc6344663b05ca815311d0 to your computer and use it in GitHub Desktop.
SOM
library(shiny)
shinyUI(fluidPage(
titlePanel("Self-Organized-Maps"),
fluidRow(
sidebarPanel(
fileInput("file1", "Select CSV:", accept = c("text/csv", "text/comma-separated-values,text/plain", ".csv")),
selectInput("sep", label = "Separator",
choices = list("Coma" = ",", "Semicolon" = ";", "Tab" = "\t"),
selected = 1),
checkboxInput("header", "Header", TRUE, width = "50%"),
selectInput("select", label = "Graph Type",
choices = c("Codebook" = "code",
"Training mean distance" = "changes",
"Objects per unit" = "counts",
"Distance to neighbours - class boundary have higher distance" = "dist.neighbours",
"Distance to codebook - lower the better" = "quality"), selected = 1),
# selectInput("fig", label = "Shape",
# choices = list("Hexagonal" = "hexagonal", "Rectangular" = "rectangular"), selected = 1),
sliderInput("slider1", label = "Granularity X", min = 2, max = 20, value = 10),
sliderInput("slider2", label = "Granularity Y", min = 2, max = 20, value = 10),
sliderInput("clusterSize", label = "Cluster Size", min = 2, max = 10, value = 4),
checkboxInput("clusterChart", "Cluster wss plot", TRUE),
tags$br(),
plotOutput("distribution", width = "100%"),
verbatimTextOutput("info"),
tags$hr(),
downloadButton("downloadData", "Save as (PNG)"),
downloadButton("downloadTabla", "Save SOM as (CSV)")
),
mainPanel(
navbarPage(
title = "Generate SOM",
tabPanel("Table", helpText("This table shows the content of the entered data. In order to generate the diagrams all values must be numeric."),
DT::dataTableOutput("table") ),
tabPanel("Histogram", helpText(" Generate histograms to inspect data"),
plotOutput("histogram"), width = "100%"),
tabPanel("SOM", plotOutput("visual", width = "100%", click = "plot_click", hover = "plot_hover") ),
tabPanel("SOM Property", plotOutput("property", width = "100%") ),
tabPanel("SOM Cluster", plotOutput("cluster", width = "100%") )
)
)
)
))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment