Skip to content

Commit

Permalink
Merge pull request #7 from mrmaxent/predict-noclamp
Browse files Browse the repository at this point in the history
Predict noclamp
  • Loading branch information
mrmaxent authored Nov 9, 2020
2 parents 158d0ec + 2944fb5 commit 0c75981
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 10 deletions.
6 changes: 3 additions & 3 deletions density/CachedFeature.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@ a copy of this software and associated documentation files (the
package density;

class CachedFeature extends Feature {
float[] vals=null;
double[] vals=null;
Feature f;

public CachedFeature(Feature f) {
this.f = f;
name = f.name;
n = f.n;
vals = new float[n];
vals = new double[n];
for (int p=0; p<n; p++)
vals[p] = (float) f.eval(p);
vals[p] = f.eval(p);
}

public double eval(int p) { return vals[p]; }
Expand Down
1 change: 1 addition & 0 deletions density/Project.java
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ boolean wouldExtrapolate(int r, int c) {
}

public float eval(int r, int c) {
doClamp = is("doClamp");
double pred = predclamp = pred(r, c, true);
if (doClamp) {
doClamp = false;
Expand Down
4 changes: 2 additions & 2 deletions density/Runner.java
Original file line number Diff line number Diff line change
Expand Up @@ -1238,14 +1238,14 @@ Feature[] featuresWithSamples(Feature[] f, Sample[] ss) {
double[] backgroundHash = new double[f[0].n];
for (int i=0; i<f[0].n; i++)
for (int j=0; j<f.length; j++)
backgroundHash[i] += rnd[j] * (float) f[j].eval(i);
backgroundHash[i] += rnd[j] * f[j].eval(i);
Arrays.sort(backgroundHash);
ArrayList samplesToAdda = new ArrayList();
for (int i=0; i<ss.length; i++) {
double r = 0.0;
for (int j=0; j<f.length; j++)
if (f[j].hasData(ss[i]))
r += rnd[j] * (float) f[j].eval(ss[i]);
r += rnd[j] * f[j].eval(ss[i]);
if (is("addAllSamplesToBackground") || Arrays.binarySearch(backgroundHash, r) < 0) // not found
samplesToAdda.add(ss[i]);
}
Expand Down
6 changes: 3 additions & 3 deletions density/SampleSet2.java
Original file line number Diff line number Diff line change
Expand Up @@ -162,12 +162,12 @@ public void process() {
Sample s = new Sample(-1, r, c, y, x, spid, null);

int goodvals = 0;
float[] data = new float[n];
double[] data = new double[n];
for (int j=0; j<n; j++) {
int idx = layerToColumn[j];
data[j] = NODATA_value;
if (idx!=-1 && idx<fields.length && !fields[SampleSet.firstEnvVar+idx].trim().equals(""))
data[j] = Float.parseFloat(fields[SampleSet.firstEnvVar+idx]);
data[j] = Double.parseDouble(fields[SampleSet.firstEnvVar+idx]);
if (data[j] == NODATA_value && idx!=-1) {
warnPartialData(x,y,sampleFileName,layers[j].name);
if (!params.allowpartialdata())
Expand Down Expand Up @@ -204,7 +204,7 @@ static void warnPartialData(double x, double y, String sampleFileName, String fi
public void createMaps() {
Sample[] s = getSamples();
for (int i=0; i<s.length; i++) {
float[] data = (float[]) datamap.get(s[i]);
double[] data = (double[]) datamap.get(s[i]);
HashMap map = new HashMap();
for (int j=0; j<n; j++)
map.put(layers[j].getName(), (data[j]==SampleSet.NODATA_value) ? null : new Double(data[j]));
Expand Down
2 changes: 1 addition & 1 deletion density/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ a copy of this software and associated documentation files (the

public class Utils {

static String version = "3.4.1";
static String version = "3.4.3";
static boolean interrupt=false, warnings=true;
public static boolean verbose=false, visible=true;
static JFrame topLevelFrame = null;
Expand Down
12 changes: 11 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Miro Dudik ([email protected])
Steven Phillips ([email protected])
Rob Schapire ([email protected])

Version 3.4.1, April 2017
Version 3.4.3, November 2020

This file outlines the steps you should take to begin using maxent to
model species geographic distributions. To download the program, or
Expand Down Expand Up @@ -118,6 +118,16 @@ click on the maxent.bat file instead. If this is not the problem,
click on the "help" button for more advice.


Main Changes in Version 3.4.3:
-----------------------------
Fixed a bug that was causing abrupt changes in response curves for some floating -point predictor variables,
due to the "add samples to background" option not adding all samples for floating-point predictors.

Main Changes in Version 3.4.2:
-----------------------------
Fixed bug that causes nodoclamp flag not to work for dismo's predict method for MaxEnt objects


Main Changes in Version 3.4.1:
-----------------------------
Fixed bug that caused regularization multiplier to be have increasing effect over multiple runs
Expand Down

0 comments on commit 0c75981

Please sign in to comment.