创建一列概率值,并使用R Shiny相应地显示结果

时间:2019-02-14 11:04:54

标签: r shiny classification logistic-regression

我是R Shiny的新手,以下是我的R代码:

library(shiny)
runApp(
list(
ui = fluidPage(
  titlePanel("Upload & Results")
  sidebarLayout(
  sidebarPanel(
  fileInput('file1', 'Choose csv File',accept = c(".csv")
                )),

    mainPanel(
  tableOutput('contents'))

  )
),
server = function(input, output){
  output$contents <- renderTable({
     req(input$file1)
    inFile <- input$file1  
     df_test=read.csv(inFile$datapath, 1)
     df1_test= df_test

    Probabilty_Score = predict(classifier, type = 'response',newdata = 
    df1_test)
    Output = as.factor(ifelse(Probabilty_Score<0.55,0,1))

    cm2 = table(df_test$Result, Output)

    print(caret::confusionMatrix(cm2))

  })
}
)
)

它给了我所需的结果。在这里我想修改我的代码:

  1. 我想创建一个Number bar(0 to 100),其中包含概率值。

  2. 当我确实更改probability的值时,我的结果confusion Matrix应该相应地更改。

任何人都可以帮助我。

0 个答案:

没有答案