select_random_points_based_on_threshold
Created: 2014-11-13 13:19:09
Last updated: 2015-05-11 13:04:13
Selects random presence and/or absence points given a threshold and a set of points with the corresponding model values.
Preview
Run
Run this Workflow in the Taverna Workbench...
Workflow Components
Authors (1)
Titles (1)
Randomly sample presence and absence points |
Descriptions (1)
This subworkflow is used to randomly sample the specified number of presence and absence points based on the points and the corresponding values provided. Presence/absence of a value is determined by the given threshold. |
Dependencies (0)
Inputs (5)
Name |
Description |
num_presences |
Number of presences to be selected.
|
num_absences |
Number of absences to be selected.
|
threshold |
Threshold used to distinguish model values between presences and absences.
|
model_values |
String containing space-separated list of model values for each point in the same order of the points.
|
points_xml |
A string containing newline-separated list of points in XML.
|
Processors (1)
Name |
Type |
Description |
triage_points |
beanshell |
Scriptimport java.util.ArrayList;
ArrayList usedPositions = new ArrayList();
int my_num_presences = Integer.parseInt(num_presences);
int my_num_absences = Integer.parseInt(num_absences);
double my_threshold = Double.parseDouble(threshold);
String[] points = points_xml.split("\n");
String[] values = model_values.split(" ");
StringBuilder absences = new StringBuilder();
StringBuilder presences = new StringBuilder();
int total_presences = 0;
int total_absences = 0;
int rp;
String presences_delim = "";
String absences_delim = "";
while (total_presences < my_num_presences || total_absences < my_num_absences) {
rp = (int)(Math.random()*values.length);
while (usedPositions.contains(rp)) {
rp = (int)(Math.random()*values.length);
}
usedPositions.add(rp);
value = Double.parseDouble( values[rp] );
if (value >= my_threshold) {
/* presence */
if (total_presences < my_num_presences) {
presences.append(presences_delim);
presences.append(points[rp]);
presences_delim = "\n";
++total_presences;
}
}
else {
/* absence */
if (total_absences < my_num_absences) {
absences.append(absences_delim);
absences.append(points[rp]);
absences_delim = "\n";
++total_absences;
}
}
}
presence_points_xml = presences.toString();
absence_points_xml = absences.toString(); |
Beanshells (1)
Name |
Description |
Inputs |
Outputs |
triage_points |
|
model_values
threshold
num_presences
num_absences
points_xml
|
absence_points_xml
presence_points_xml
|
Outputs (2)
Name |
Description |
presence_points_xml |
A string containing newline-separated list of presence points in XML.
|
absence_points_xml |
A string containing newline-separated list of absence points in XML.
|
Datalinks (7)
Source |
Sink |
threshold |
triage_points:threshold |
num_presences |
triage_points:num_presences |
points_xml |
triage_points:points_xml |
model_values |
triage_points:model_values |
num_absences |
triage_points:num_absences |
triage_points:presence_points_xml |
presence_points_xml |
triage_points:absence_points_xml |
absence_points_xml |
Uploader
Component Validity
Loading
License
All versions of this Workflow are
licensed under:
Version 2 (latest)
(of 2)
Credits (1)
(People/Groups)
Attributions (0)
(Workflows/Files)
None
Shared with Groups (0)
None
Featured In Packs (1)
Log in to add to one of your Packs
Attributed By (0)
(Workflows/Files)
None
Favourited By (0)
No one
Statistics
Other workflows that use similar services
(0)
There are no workflows in myExperiment that use similar services to this Workflow.
Comments (0)
No comments yet
Log in to make a comment