R 应用程序中输入值的模糊化
我正试图将输入值模糊化,并通过在闪亮的应用程序上解模糊得到输出。但我不知道如何从输入中获取这些值 那么,是否可以使用输入值将其模糊化,然后对值进行反模糊化,并将该值作为输出?如果是,如何进行?谢谢 下面是代码的一个概念:R 应用程序中输入值的模糊化,r,shiny,fuzzy-logic,R,Shiny,Fuzzy Logic,我正试图将输入值模糊化,并通过在闪亮的应用程序上解模糊得到输出。但我不知道如何从输入中获取这些值 那么,是否可以使用输入值将其模糊化,然后对值进行反模糊化,并将该值作为输出?如果是,如何进行?谢谢 下面是代码的一个概念: library(shiny) library(sets) library(datasets) ui <- fluidPage(numericInput(inputId = "one", label="Type number",1, min=
library(shiny)
library(sets)
library(datasets)
ui <- fluidPage(numericInput(inputId = "one", label="Type number",1, min=1, max=120),
numericInput(inputId = "two", label="Type number",1, min = 1, max=120),
numericInput(inputId = "three", label="Type number",1, min = 1, max=120),
numericInput(inputId = "four", label="Type number",1, min = 1, max=120),
textOutput("sub"), br(),
actionButton("button", "Show"),
br()
)
server <- function(input, output){
variables <- set(wo = fuzzy_partition(varnames = c(notMany2 = 15, enough2 = 25, many2 = 35),FUN = fuzzy_cone, radius = 10),
top = fuzzy_partition(varnames = c(notMany3 = 20, enough3 = 50, many3 = 100),FUN = fuzzy_cone, radius = 25),
c = fuzzy_partition(varnames = c(k4 = 52, k3 = 42, k2 = 32,k1 = 22), sd = 3))
rules <- set (fuzzy_rule(wo %is% notMany2 && top %is% notMany3
|| wo %is% notMany2 && top %is% notMany3
|| wo %is% notMany2 && top %is% notMany3
, c %is% k1),
fuzzy_rule( wo %is% notMany2 && top %is% enough3
|| wo %is% notMany2 && top %is% many3,c %is% k2))
system <- fuzzy_system(variables,rules)
fi <- fuzzy_inference(system, list(wo = 20, top= 10))
fuz <- gset_defuzzify(fi, 'centroid')
output$sub <- renderText({fuz})
}
shinyApp(ui = ui, server = server)
库(闪亮)
图书馆(套)
图书馆(数据集)
ui这不起作用:模糊推理(系统,列表(wo=输入$1,top=输入$2));模糊推理(系统,列表(wo=renderText({input$one}),top=renderText({input$two}))。这不起作用:模糊推理(系统,列表(wo=input$one,top=input$two));模糊推理(系统,列表(wo=renderText({input$one}),top=renderText({input$two}))。