NikoMatanov
NikoMatanov

Reputation: 1

Biomod 2 Maxent

I am new using r and the package biomod2. I have the problem that when i try to run the model MAXENT.Phillips by biomod 2 i get the next error:

Error in file(file, "rt") : no se puede abrir la conexión
Además: Warning message:
In file(file, "rt") :
  no fue posible abrir el archivo 'A.Bicornis/models/A.BicornisFirstModeling/A.Bicornis_AllData_RUN2_MAXENT.Phillips_outputs/A.Bicornis_AllData_RUN2_Pred_swd.csv': No such file or directory

I have update the package and still not working. When I run the code, I'll have the maxent window when I introduce the variables and points. Then I run it in the maxent window and get this error.

The code that I use:

predictor<-stack(Bio2,Bio3,Bio8,Bio10,Bio13,Bio14)
DataSpecies1 <-data.frame(workBiomod1,package="biomod2")
myRespName1 <-as.character('A.Bicornis')
colnames(DataSpecies1)[1]<-"A.Bicornis"
myResp1 <- as.data.frame(DataSpecies1[,myRespName1])
myRespXY1 <- DataSpecies1[,c("DECLONGITUDE","DECLATITUDE")]
myExpl1<-predictor

myBiomodData1 <- BIOMOD_FormatingData(resp.var = myResp1,
                                      expl.var = myExpl1,
                                      resp.xy = myRespXY1,
                                      resp.name = myRespName1)


myBiomodData1
plot(myBiomodData1)
myBiomodOption1 <- BIOMOD_ModelingOptions(
  RF=list(ntree=128),MAXENT.Phillips=list(path_to_maxent.jar="C:\\Users\\nikom\\Desktop\\Maxent\\maxent",
                                          memory_allocated=NULL, background_data_dir="D:\\TFM\\Especies\\",
                                          linear=FALSE,quadratic=FALSE,product=TRUE,
                                          threshold=TRUE,hinge=TRUE))
myBiomodModelOut1 <- BIOMOD_Modeling(
  myBiomodData1,
  models = c('RF','MAXENT.Phillips'),
  models.options = myBiomodOption1,
  NbRunEval=10,
  DataSplit=80,
  Prevalence=0.5,
  VarImport=0,
  models.eval.meth = c('TSS','ROC','ACCURACY'),
  SaveObj = TRUE,
  rescal.all.models = TRUE,
  do.full.models = FALSE,
  modeling.id = paste(myRespName1,"FirstModeling",sep=""))

myBiomodModelOut1
myBiomodModelEval1 <- get_evaluations(myBiomodModelOut1)
dimnames(myBiomodModelEval1)
myBiomodModelEval1["TSS","Testing.data","RF",,]
myBiomodModelEval1["ROC","Testing.data",,,]
get_variables_importance(myBiomodModelOut1)

myBiomodEM1 <- BIOMOD_EnsembleModeling(
  modeling.output = myBiomodModelOut1,
  chosen.models = 'all',
  em.by='all',
  eval.metric = c('TSS'),
  eval.metric.quality.threshold = c(0.7),
  prob.mean = T,
  prob.cv = T,
  prob.ci = T,
  prob.ci.alpha = 0.05,
  prob.median = T,
  committee.averaging = T,
  prob.mean.weight = T,
  prob.mean.weight.decay = 'proportional' )

workBiomod1 is composed by XY coordinates, values of 1 (presence) and 0 (ausence), and values in the corresponding variables. Meanwhile, random forest is working well.

Upvotes: 0

Views: 774

Answers (0)

Related Questions