liferay-ui:具有模型上下文的搜索容器,输入隐藏

时间:2015-11-25 13:45:30

标签: java liferay liferay-aui

    library(data.table);library(stringr);library(nnet);library(mlogit);library(mnlogit)
data("ModeCanada", package = "mlogit")
bususers <- with(ModeCanada, case[choice == 1 & alt == "bus"])
ModeCanada <- subset(ModeCanada, !case %in% bususers)
ModeCanada <- subset(ModeCanada, nchoice == 4)
ModeCanada <- subset(ModeCanada, alt != "bus")
ModeCanada$alt <- ModeCanada$alt[drop = TRUE]
KoppWen00 <- mlogit.data(ModeCanada, shape='long', chid.var = 'case',
                         alt.var = 'alt', choice='choice',
                         drop.index=TRUE)

data("ModeCanada", package = "mlogit")
busUsers <- with(ModeCanada, case[choice == 1 & alt == "bus"])
Bhat <- subset(ModeCanada, !case %in% busUsers & alt != "bus" &
                     nchoice == 4)
Bhat$alt <- Bhat$alt[drop = TRUE]
head(ModeCanada)
Mode = data.table(ModeCanada)

# Some additional editing in order to make it more similar to the typical data sets I work with
Bhat2 = data.table(KoppWen00)
Bhat2[,Choice:=gsub("\\.","",str_sub(row.names(KoppWen00),5,-1))][,id:=as.character(as.numeric(str_sub(row.names(Bhat),1,4)))]
Bhat2 = Bhat2[choice=="TRUE"][,c("Choice","urban","income","id"),with=F]

# nnet package
ml.nn<- multinom(Choice ~ urban + income,
                 Bhat2)
tmp = data.table(cbind(Bhat2, predict(ml.nn, type="probs", newdata=Bhat2)))
# nnet predictions
tmp[urban=="0" & income==45 & Choice=="air"][1,c("Choice", "urban", "income" , "air","car","train"),with=F]

# mlogit package
ml <- mlogit(Choice ~ 1| urban + income,shape="wide",
                Bhat2)
pml = data.table(cbind(Bhat2, predict(ml,mlogit.data(Bhat2, shape="wide", choice="Choice"))))
# mlogit predictions
unique(pml[Choice=="air" & urban=="0" & income==45 ][,c("Choice", "urban", "income" , "air","car","train"),with=F])

# mnlogit packages
mln.MC <- mnlogit(Choice ~ 1| urban + income, mlogit.data(Bhat2,choice = "Choice",shape="wide"))
preddata = data.table(cbind(mlogit.data(Bhat2,choice = "Choice",shape="wide"), predict(mln.MC)))
# mnlogit predictions, returns several probabilities for each outcome
preddata[Choice==TRUE & urban=="0" & income==45 & alt == "air"]

从这段代码我可以预料到我的表单输入是由模型上下文填充的。但是在我的jsp中,表单输入都是隐藏的,我只能看到每个表单的标签。

liferay服务层是在一个隔离的portlet插件上实现的,在需要服务实现的每个portlet上添加了依赖项。

如果我尝试手动添加输入类型,则会出现,但只是输入文本类型。如果我有一个布尔属性并且我在特定输入上指定type =“checkbox”,则没有值设置为输入。

1 个答案:

答案 0 :(得分:0)

我的意思是使用模型上下文实现的搜索容器,用于自动定义输入类型和值。输入被隐藏,导致在service.xml中缺少命名空间定义。问题解决了