Skip to content
Snippets Groups Projects
Commit 7155c6b5 authored by Isabelle Sanchez's avatar Isabelle Sanchez
Browse files

improve test on objects

parent e1ead8c6
No related branches found
No related tags found
No related merge requests found
Pipeline #53927 passed
......@@ -474,10 +474,8 @@ kafino_fit<-function(datain,Tvar,Yvar,
resultat=FK_para_connu_tronc(param)
} else {
# paramètre de troncature, dépend du nombre d'observation à étudier
if (N <= 5) {
print("Warning: not enough data between expert knowledge. The algorithm is not performed.")
} else {
# N petit, si trop petit on ne fait rien
if (N > 5) {
# Not enough data - no optim
print("-------:")
print("Optimisation of initial parameters - result:")
......@@ -485,35 +483,42 @@ kafino_fit<-function(datain,Tvar,Yvar,
print(X)
print("-------:")
resultat=FK_para_connu_tronc(X)
} else {
print("Warning: not enough data between expert knowledge. The algorithm is not performed.")
resultat<-NULL
}
}
} else {
if (N <= 5) {
print("Warning: not enough data between expert knowledge. The algorithm is not performed.")
resultat<-NULL
} else {
# Pas d'optimisation et test si N petit - si trop petit on ne fait rien
if (N > 5) {
# No optimisation on initial parameters
print("-------:")
print("No optimisation of initial parameters:")
print("Used parameters: ")
print(X)
resultat=FK_para_connu_tronc(X)
} else {
print("Warning: not enough data between expert knowledge. The algorithm is not performed.")
resultat<-NULL
}
}
#--------------------------------
# Formatting output results
# If resultat NULL then create output with datain and 2 NULL objects
# else create output with detectoutlier, PredictionOK and kafino.results
# useful for the kafino_plot() function
#--------------------------------
if (is.null(resultat)){
dt.out<-datain
dt.pred<-NULL
resultat<-NULL
mylist<-list(dt.out,dt.pred,resultat)
names(mylist)<-c("detectOutlier","PredictionOK","kafino.results")
class(mylist) = c("kafino")
return(invisible(mylist))
} else{
} else {
prediction=na.omit(resultat$prediction)
label_pred=round(na.omit(resultat$label),2)
lwr=na.omit(resultat$lwr)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment