problem with maxnet.predictRaster in ENMeval for categorical variables -- please use new version

75 views
Skip to first unread message

Jamie M. Kass

unread,
May 1, 2025, 8:34:17 PMMay 1
to Maxent
All,

I recently discovered a problem with the maxnet.predictRaster function in ENMeval, so I fixed it in v2.0.5.2, now on CRAN -- please update your version.

The problem was that the function was ignoring categorical features when making predictions. This is because the matrix output by terra::values (and by extension, raster::values that previous versions of 2.0.0 used), was converting factor values to numeric, and maxnet.predict was ignoring them. This is not an issue for maxent.jar because it converts factor values to numeric internally anyway. This is fixed in v2.0.5.2 by using as.data.frame instead to get the raster values (which preserves the factor values).

Please be aware that this function was used to create the rasters in "e@predictions" (if e is your ENMevaluation object), so if you used categorical variables to fit the maxnet model, the raster is likely missing their contribution.

My sincerest apologies about this bug, but this happens sometimes with open software (especially when mainly one person is managing it!). Thanks for your support and use of ENMeval.

-Jamie

Antonio Sampedro

unread,
Nov 17, 2025, 9:18:32 AM (2 days ago) Nov 17
to Maxent
HI Jamie,

I am experiencing some problems recently. I noticed that v2.0.5.2 is not yet available in for mac users, right?

Here is my problem. Recently, I moved from maxent.jar to Maxnet algorithm. Model outputs were slightly different for extracting metrics, but computation time improved.

My problem is that I am not so familiar with MExnet slots and I am strugling to find the functions for predictions.
I used to do this:
pred.ssp126.2030 <- terra::predict(lancov.model@models[[1]], lancov.ssp126.2030)

Being lancov.model my ENMevaluate object, and lancov.ssp126.2030 a SpatRaster with my 14 covariates projected in future. Lancov model contains already only the best model. This sintax is not working anymore.

How should I proceed? maxnet.predict seems not available (v2.0.4) and eval.predictions() do not allow to introduce environmental rasters to calculate predictions.

Thank you very much in advance.

Antonio Sampedro

unread,
Nov 17, 2025, 10:33:02 AM (2 days ago) Nov 17
to Maxent
Re- my previous email.

Dear Jamie and folks. I have been able to install 2.0.5.2 . EVen when my system is arm64, and the MacOS binaries were not 2.0.5.2, the one from (x86-64) seems to be working fine. So I could find the function maxnet.predictRaster(). Temporarilly my problem is solved.

Thank you anyway!

Antonio
Reply all
Reply to author
Forward
0 new messages