

############ ModelMap 1.1 06/04/08 ######################

Added check for factor or character training or test predictors not specified as categorical 
factors by argument 'predFactor'

Added warning if NA values in map production predictor layers. These NA values will be 
automatically changed to -9999 and a warning will be given.

Changed read.table command for reading in training and test datasets to read in data "as.is",
now character values will be read in as characters, and not be automatically converted to
factors.


############ ModelMap 1.1.1 12/31/08 ######################

Fixed bug so map creation option will not crash when numrows=1 or when final loop has only one row.


############ ModelMap 1.1.2 01/09/09 ######################

increased the resolution of output jpegs to publication quality
added output textfile of values for each argument (even if choosen by GUI prompt) to make maps more easily repeatable


############ ModelMap 1.1.3 01/12/09 ######################

Rewrote calls to choose.dir() and choose.files() so that these functions will only be called if platform is windows. On other platforms, functions will stop with meaningfull messages specifying which additional arguments must be added to function call. 

On non-windows platforms, output dirrectory will default to working dirrectory. 

Changed internal variable rastnmList to rastnmVector, to make the name more descriptive as this variable is vector and not a list.

Added argument rastLUTfn. This will make it easier to specify a raster Look Up Table if running model.map() in a non-GUI mode.

Added argument rastnmVector to make it easier to run model.map() in a non-GUI mode.

############ ModelMap 1.1.4 01/13/09 ######################

Fixed diagnostic graphs so active graph sheet ends up on top.

Standardized file name conventions for output files:
	* if other output filenames are not specified in arguments, MODELfn is used as a basis to build the unspecified names.
	* if output filenames include a path [checked by identical(basename(foo),foo) ] then they are left alone, but if they do 
	  not include a path, the path in argument 'folder' is used for the output.

Shortened header on diagnostic plots to basename(MODELfn) instead of full path and filename.

Changed filename for ARGfn to 'MODELfn'_arguments.txt instead of 'asciifn'_arguments.txt

Added date and time stamp to argument record file.

added arguments 'jpeg.res', 'device.width', and 'device.type' to give users more control over diagnostic plot output. (the increased jpeg resolution from version 1.1.2 caused crashes on some computers, with error message "unable to allocate bitmap".)

############ ModelMap 1.1.5 02/02/09 ######################

Changed input filenames ('qdata.trainfn', 'qdata.testfn', 'rastLUTfn') to have a more flexible format to match output file names. Now input file names can be specified either with the full path, or with the basename, and the path from 'folder' will be used.

Added pdf option for diagnostic plots

Added cex argument for diagnostic plots

Added req.sens, req.spec, FPC, and FNC arguments for model validation diagnostics, for categorical response model threshold optimization, to be passed along to PresenceAbsence package.

Fixed bug in saving text file of Arguments, that cause function to fail when qdata.trainfn or qdata.testfn were dataframes or matrices. 

############ ModelMap 1.1.6 02/05/09 ######################

Prediction output for v fold cross validation will now have an additional column listing which fold each datapoint was in

Updated help file with more info on production map st.dev. and the fact that it can on;y be generated for RF models.

Commented out many of the little progress notes (i.e. "Now starting...").

Turned some of the print() statements into warning() statements.

Fixed bug that caused coefficient of variation map to overwrite regular map when map.sd=TRUE

Fixed bug that occurred if qdata.testfn was a dataframe or matrix.
'
Removed SGB argument 'keep.data' because it was useless. It turns out that when using gbm.fit(), which ModelMap does, 'keep.data' has to equla TRUE. There is no point in having an argument that can only be set to one value!!!

When using cross validation on SGB models, Changed starting value for number of trees for each fold to 100. Previously, each fold would start at the number of trees used for the main model, then build up from there. I'm not sure this is the final form, but it seemed like either all folds should be set at the same number as the main model, or each fold should start from scratch, not have folds that require fewer trees forced to use the main model, but folds that require more allowed to generate extra.

############ ModelMap 1.1.7 02/13/09 ######################

Changed meaning of SGB argument n.trees. Previously, n.trees gave the starting number of trees to be increased iteritivly. Now, if you want ot increase your number of trees iterativly set n.trees=NULL (the default), and if you want to build a set number of trees set n.trees to that number. In both cases, when the predictions are made from the model, the number of trees from the model actually used for predicting will still be determined by best.iter<-gbm.perf(method="OOB")

As a side effect of this change, when you are using cross validation for your model validation, if n.trees=NULL, all folds will have models built with iteritivly determined n.trees, and if n.trees equals a number all folds will have that number of trees built. However, when the predictions are made from these models, the number of trees in the fold's model actually used for predicting will still be determined by best.iter<-gbm.perf(method="OOB")

Added argument 'folder' to get.test() so that file name conventions would match model.map().

Fixed warning message about catagorical levels found in map data but not in training data so that there are spaces between each level

Fixed how NA values are treated when making predictions. Now the argument 'na.action' specifies not just how catagorical predictors with categories not found in the training data are treated, but also how NA values in the test and map production datasets are treated. 

Updated help files to cover required spatial data format, and better describe 'na.action'

############ ModelMap 1.1.8 02/13/09 ######################

Fixed bug in get.test() that failed to correctly check if filenames were full path or basename only.

############ ModelMap 1.1.9 03/24/09 ######################

Changed text size for labels of SGB varibale importance plot to avoid cutting the topsoff the characters.

Added warning to SGB models to advise users that: 

"ModelMap currently uses OOB estimation to determine optimal number of trees in SGB model when calling gbm.perf in the gbm package. OOB generally underestimates the optimal number of iterations although predictive performance is reasonably competitive. Using cv.folds>0 when calling gbm usually results in improved predictive performance but is not yet supported in ModelMap."

Added additional info to help file describing why this warning is issued.

Changed 'response.type' options to "continuous" and "bivariate" (instead of "categorical"), but added backwards compatibility so if argument 'response.type' is given as "categorical" it will automatically be switched to "bivariate".

Fixed citation file.

Changed 'response.type' options to "continuous" and "binary" (instead of "bivariate")

############ ModelMap 1.1.10 03/27/09 ######################

got rid of test() function

changed liscense to Unlimited

added platform check before doing anything involving Filters

############ ModelMap 1.1.11 03/27/09 ######################

changed help files default graphic device from windows to jpeg

changed windows() to dev.new() and graphics.device="windows" to "default"

############ ModelMap 1.1.12 06/11/09 ######################

Fixed bug in that crashed GUI version when asking "response.type"

############ ModelMap 1.1.13 06/11/09 ######################

Fixed bug in that crashed GUI version when asking "response.type"

############ ModelMap 1.1.14 11/12/09 ######################

Changed diagnostic plots so datapoints with pred=-9999 (categorical predictors not included in training data and na.action="na.omit") will be left out when creating diagnostic plots.

############ ModelMap 1.1.15 11/23/09 ######################

Fixed bug in how map production handled SGB models created outside of ModelMap

Fixed bug in prediction on the training data in SGB models with factored predictors. Bug only occured when predictions were made in a separate function call from model creation.

############ ModelMap 2.0.0 12/04/09 ######################

Restructured ModelMap to use three separate function calls: model.build(), model.diagnostics(), and model.mapmake(). Also simplified argument lists.

Added user function build.rastLUT()

In model.diagnostics() and model.mapmake(), when response name differs between model object and 'response.name' argument, priority is now given to 'response.name' argument.

Added package vignette.

Moved helpfile example data to a subfolder within external, and added a second subfolder for vignette data.


############ ModelMap 2.0.1 02/12/10 ######################

Added random forest arguments: 'strata' 'sampsize' 'replace'

Fixed bug in model.diagnostics() GUI for selecting prediction type
 
Added warning messages for improper 'model.type' or 'response.type'

In 'model.diagnostics()' changed main title for graphics from 'MODELfn' to 'MODELpredfn'

Added table of observed and predicted prevalence to output of 'model.diagnostics()' for binary response models.

############ ModelMap 2.0.2 12/06/10 ######################

Removed duplicate pdf from vignette

Added info to help file for model.mapmake() to show that it will take both ESRI Grids and imagine images as predictors.

############ ModelMap 2.0.3 12/10/10 ######################

In 'model.diagnostics()' added option "none" to 'device.type'.

Fixed typos in help files


############ ModelMap 2.1.0 01/15/11 ######################

Changed how SGB 'n.trees' argument works to allow options other than OOB for determining best number of trees. Added 'n.trees' argument to 'model.diagnostics()' and 'model.mapmake()' funtions.

Added RMSD to diagnostic plot for continuous models.

Added argument 'keep.data' to 'model.build()'. If 'keep.data=TRUE' then predictor.data is attached to model.obj, to allow for two way partial dependecy plots.

Fixed bug in 'model.diagnostics()' and 'model.mapmake()' that caused models built outside ModelMap using the formula interface to crash.

Added function 'model.interaction.plot().

Added 'var.monotonic' SGB argument to 'model.build()'

############ ModelMap 2.1.1 04/21/11 ######################


############ ModelMap 2.2.1 11/01/11 ######################

Added option "categorical" to 'response.type' for RF models. Note, in previous versions option "categorical" could be included in function arguments, but would be modeled as binary response. Now it will be true multiple categorical response.

Added function 'model.importance.plot'.

Changed behavior of 'dev.type = "none' so that now a graph is made, but a new device is not opened. This will allow 'model.interaction.plot()' and 'model.importance.plot()' to be used in conjunction with 'par(mfrow='


############ ModelMap 2.2.2 12/01/11 ######################

Fixed bug in 'model.interaction.plot' that occured when categorical response variable had numeric categories

Minor edits in Vignette

############ ModelMap 2.3.0 01/20/12 ######################

Fixed bugs in way ModelMap handles NA values. Also modified NA behavior to more closely follow standardized NA behavior in models such as lm() and glm().

This required adding required arguments 'unique.rowname' and 'na.action' to 'model.build()' function.

If the model has been built outside of ModelMap, 'model.mapmake()' now requires 'na.action' regardess of whether the map images contain missing values. Since the predictor maps are read in chunks, there is no simple way to precheck for NA's before starting map production. If the model was built in ModelMap and 'na.action' is not provided, then 'model.mapmake()' will default to the na.action used to build the model.

Added model argument 'PLOTfn' to function 'model.interaction.plot()'. MODELfn will have the interaction variables pasted onto it. PLOTfn will be used as is with only .jped, etc added to the end.

Added response.type="categorical" for RF models.

Added category specific diagnostic plots to 'model.diagnostics()'

Added additional arguments to 'model.importance.plot()' to specify category and importance types of each model. 

'model.mapmake()' now outputs both ascii grid file and imagine image files of maps. This requires raster package.

############# ModelMap 2.3.1 05/17/12 ######################

Fixed bugs in response type categorical that occured when categories were number codes instead of character strings.

Fixed bug when GUI prompt was used with new 'na.action' code

Moved Vignette from 'ModelMap\inst\doc' to 'ModelMap\inst\vignette'

Moved Vignette data from 'ModelMap\inst\external\vignetteexamples' to 'ModelMap\inst\vignette'


############# ModelMap 2.3.2 05/17/12 ######################

Fixed package vignette

############# ModelMap 2.3.3 08/12/12 ######################

Fixed miss spelling

############# ModelMap 2.3.4 08/12/12 ######################

Fixed further miss spellings

############# ModelMap 3.0.0 01/25/13 ######################

Switched map production over to raster package

############# ModelMap 3.0.1 02/07/13 ######################

Fixed bug when an entire row of predictor raster was entirely NA or -9999

############# ModelMap 3.0.2 02/11/13 ######################

Fixed bug that occured when 'response.type="categorical"' and categories in training data were numeric rather than charactor.

############# ModelMap 3.0.3 03/06/13 ######################

Updated help files and Vignette to reflect use of raster package.

Updated 'model.build()' to use argument 'nTrain' instaid of 'train.fraction' to be consistent with current verion of gbm package.

############# ModelMap 3.0.4 05/01/13 ######################

Added better warning messages to projection checking of predictor layers in 'model.mapmake()' and added output file that lists original projections of all predictor layers.

############# ModelMap 3.0.5 05/27/13 ######################

Added checks for more than one '.'s in output filenames, and that any extensions are on list of valid extensions. 

When path was not included in file names, ModelMap formerly used 'paste(folder,filename,sep="/")' to add folder to filenames. Switched to 'file.path(folder,filename)' to be valid across all platforms.

Fixed error that would crash model.mapmake() if OUTPUTfn had more than one '.'.

############# ModelMap 3.0.6 06/26/13 ######################

############# ModelMap 3.0.7 06/26/13 ######################

Switched to from our own projcompare() function to the raster package compareRaster() function for checking predictor rasters for consistency.

Updated help file for model.mapmake().

############# ModelMap 3.0.8 07/23/13 ######################

Switched native raster format map to a tmp file, so only image file, or other format map is permanently saved.

Added argument 'keep.predictor.brick' (defaults to false). If TRUE, predictor brick is saved as a native raster package format object, with name
constructed by appending '_brick' to 'OUTPUTfn'. If FALSE, predictor brick is a tmp file that is deleated after map construction.

Got rid of arguments 'OUTPUTfn.mean', 'OUTPUTfn.stdev', and 'OUTPUTfn.coefv'. Instead, file names for these output maps are constructed by appending '_mean', '_stdev', and '_coefv' to 'OUTPUTfn'.

Changed DEPENDS field of package DESCRIPTION, to remove unneccessary packages that gbm depends on, and to move package 'fields' from DEPENDS to  Imports, as ModelMap only uses a single function from 'fields'. Edited NAMESPACE to match.

Shortened help examples for 'model.diagnostics', 'model.mapmake', 'model.interaction.plot' and 'model.importance.plot'.

############# ModelMap 3.0.9 10/25/13 ######################

Added argument 'diagnostic.flag' to model.diagnostic(). This allows specification of a subset of training or test data to be used for model diagnostics that depend on predicted and observed values. 

Fixed bug in how model.build() handled 'strata' argument when it was a character string rather than a vector.

############# ModelMap 3.0.10 11/14/13 ######################

Added 'proximity' argument to model.build()

added quote() to setup for do.call() in model.build(), to avoid having extra copy of data saved in model.obj$call

############# ModelMap 3.0.11 12/13/13 ######################

changed model.diagnostics() argument 'diagnostics.flag' to 'diagnostic.flag'

fixed but when model.build() argument that occured 'strata' was given as column name rather than vector of values.

############# ModelMap 3.0.12 02/25/13 ######################

added MAUC to model.diagnostics for categorical response

############# ModelMap 3.0.13 + 3.0.14 02/25/13 #############

fixed depends field of package description

############# ModelMap 3.0.15 04/03/13 ######################

fixed bug in model.diagnostics in handling na.omit

changed na.action so that na.roughfix only applies to predictors, and NA responses are always omitted

in model.mapmake() changed naming prefix for tmp files so that they all start with 'raster_tmp_' and thus will be detected by showTmpfiles() and removeTmpFiles().

fixed bug that caused model.diagnostics() to crash when calculating MAUC when 'prediction.type="CV"' and 'response.type="categorical"' 

fixed bug that caused model.diagnostics() to crash when calculating MAUC when 'response.type="categorical" andthere was a test set observed response that was not in the training data.

added check to model.build() that all elements in'predList' are found in data column names

added check to model.build() that all elements in'predFactor' are found in 'predList'

added check to model.diagnostics() that 'diagnistic.flag' is found in data column names

added check to model.diagnostics() that 'unique.rownames' is found in data column names

added check to model.build() and model.diagnostics() that unique.rownames really are unique

added check to model.diagnostics(), that for OOB predictions, responses in training data match the responses from data used to build the model

updated readme


############# ModelMap 3.1.1 03/31/14 ######################

fixed bug in model.mapmake() that kept the temp file for the votes map from closing properly, and thus prevented it from being deleated


############# ModelMap 3.1.2 04/01/14 ######################

in model.mapmake() changed naming prefix for tmp files so that they all start with 'raster_tmp_' and thus will be detected by showTmpfiles() and removeTmpFiles().

############# ModelMap 3.1.3 04/17/14 ######################

fixed bug in how model diagnostics handled na.action="na.omit"

added check to model.build() and model.diagnostics() that unique.rownames really are unique

everything from 3.0.15

############# ModelMap 3.1.4 08/27/14 ######################

Fixed bug that crashed model.diagnostics if response categories were numeric or contained symbols other than '.' and '_'.

Added dominance measures text file output to model.diagnostics() for categorical response RF models.

############# ModelMap 3.1.5 09/09/14 and 03/09/15######################

Tweaked model.importance.plot() so that the 'predList' argument used to specify the order of the predictors for plotting can contain a subset of predictors rather than requireing all the predictors from the model.

Added color options to model.importance.plot()

Added an option to specify 'z.range="range"' to model.interaction.plot(). This option will override the default behavior for binary and categorical models, which default to z.range=c(0,1). Instead the function will use the range found in the data similar to the default for continuous models.

Added arguments 'xlim' 'ylim and 'zlim' to 'model.interaction.plot()' as alternates to 'x.range' 'y.range' and 'z.range'.

Added quantile regression forest models "QRF".

Fixed bug in 'model.diagnostics()'. For "SGB" models cross validation predictions. Previously the unique id would get scrambled on cross validation predictions for "SGB".

Fixed bug that might have crashed 'model.mapmake()' if a row contained one and only one non-NA pixel.


############# ModelMap 3.2.0 09/09/14 and 04/15/15######################

Added categorical respose SGB models.

############# ModelMap 3.2.1 05/16/15######################

Added CF models from party package.

Added function model.explore().

################ ModelMap 3.2.4 08/09/15 ###########################

Add QRF arguments 'all' and 'obs' to 'model.interaction.plot()'.


################ ModelMap 3.2.5 10/29/15 ###########################

Fixed bugs in model.explore() that affected legend labes for categorical predictors with categories present in the map raster but missing from the training data.

Fixed spot in model.explore() argument list where training data argument was incorrectly given as 'qdatatrain.fn' instead of 'qdata.trainfn'.

Changed the color for NA in the model.explore() maps from white to black.

Changed argument name used to specify NA value in rasters from 'NAval' to 'na.value' to better match that 'na.option' argument.

Added option to specify NA values to model.mapmake() to match model.explore().


################ ModelMap 3.2.6 11/04/15 ###########################

Fixed bug in model.explore() that cause it to crash if 'predList' was of length 1.


################ ModelMap 3.2.7 11/07/15 ###########################

Added graphic device options "png" and "tiff"

Fixed bug in get.test() that kept 'folder' from being used for function output to better match behavior of other functions in ModelMap. Previous to fix 'folder' was only used for input. 

Fixed bug in model.interaction.plot() that caused image plots to crash if all predicted values were zero.

################ ModelMap 3.2.8 01/07/16 ###########################

Changes to model.explore():
   fixed bug in categorical response that caused crash when response color categories not specified
   fixed binary response legend labels being reversed
   made separate map colors for NA and MASK
   added colors to fequency histograms

################ ModelMap 3.2.9 02/17/16 ###########################

Cleaned up code to model.explore() to make it more memory safe and efficient for large rasters. Graphical figures now done on subsampled versions of large rasters. Made full resolution output extrapolation rasters optional.

################ ModelMap 3.3.0 02/19/16 ###########################

Final version for CRAN with new model types quantile regression forests (QRF) and conditional inference forests (CF), as well as new exploratory function 'model.explore()'. And two new vignettes.


################ ModelMap 3.3.1 02/22/16 ###########################

Fixed output of model.diagnostics


################ ModelMap 3.3.2 02/25/16 ###########################

NAMESPACE fix: added check on OS before importing 'choose.dir' and 'choose.files' 

################ ModelMap 3.3.4 06/17/16 ###########################

In model.build(), changed default value for 'proximity' from TRUE to FALSE.

Changed quantregForest argument 'quantiles' to 'what' (change in internal code only - does not affect ModelMap function arguments)

Temporarily disabled importance for QRF models, as current version of quantregForest does not support quantile importances. Will re-enable when new version of quantregForest is released.


################ ModelMap 3.3.6 01/31/17 ###########################

fixed bug where ‘response.type’ wasn't properly defined when running ‘model.mapmake()’ with ‘map.sd=TRUE’

fixed bug where default quantiles weren't found when ‘quantiles’ argument to ‘model.dignostics()’ was not specified

fixed bug in model.diagnostics() that crashed at corrplot if diagnostic.flag was used.

################ ModelMap 3.3.7 08/31/18 ###########################

fixed bug in model.diagnostics() that crashed at corrplot if model contained only factored preditors.

################ ModelMap 3.4.0 09/10/18 ###########################

added latin-1 encoding to vignettes

disabled SGB models (until when and if the gbm package is no longer orphaned).

################ ModelMap 3.4.0.2 08/17/22 ###########################

Wrapped help file examples in \dontrun{} to avoid "non-standard things in the check directory"

################ ModelMap 3.4.0.3 01/05/23 ###########################

Updated both email and postal addresses for package maintainer and citation

################ ModelMap 3.4.0.4 04/12/23 ###########################

Removed references to rgdal in package DESCRIPTION and NAMESPACE. 

Updated CITATION file to use currently preference functions c() insteas of as.personList() and bibentry() instead of citEntry()

