public class API extends Object
Constructor and Description |
---|
API() |
Modifier and Type | Method and Description |
---|---|
static CoreHunterArguments |
createArguments(CoreHunterData data,
int size,
CoreHunterObjective[] objectives,
int[] alwaysSelected,
int[] neverSelected,
boolean normalizeMultiObjective) |
static FrequencyGenotypeData |
createBiparentalGenotypeData(byte[][] alleleScores,
String[] ids,
String[] names,
String[] markerNames) |
static FrequencyGenotypeData |
createDefaultGenotypeData(String[][] data,
String[] ids,
String[] names,
String[] columnNames) |
static CoreHunterObjective |
createDefaultObjective(CoreHunterData coreHunterData)
Creates a default allowed objective for the data.
|
static CoreHunterObjective |
createDefaultObjective(CoreHunterData coreHunterData,
List<CoreHunterObjective> currentObjectives)
Creates a default allowed objective for the data given a list existing
objectives.
|
static List<CoreHunterObjective> |
createDefaultObjectives(CoreHunterData coreHunterData)
Creates a list of default objectives, one for each type of data available, with equal weights.
|
static DistanceMatrixData |
createDistanceMatrixData(double[][] distances,
String[] ids,
String[] names) |
static FrequencyGenotypeData |
createFrequencyGenotypeData(double[][] frequencies,
String[] ids,
String[] names,
String[] columnNames,
String[] alleleNames) |
static CoreHunterObjective |
createObjective(String type,
String measure,
double weight) |
static CoreHunterObjective |
createObjective(String type,
String measure,
double weight,
double min,
double max) |
static double |
evaluateCore(int[] selected,
CoreHunterData data,
CoreHunterObjective obj)
Evaluate a core collection.
|
static List<CoreHunterObjective> |
getAllAllowedObjectives(CoreHunterData coreHunterData)
Creates a list of all possible Core Hunter objectives for a given data object, with equal weights.
|
static double[][] |
getAlleleFrequencies(FrequencyGenotypeData data) |
static String[][] |
getAlleles(FrequencyGenotypeData data) |
static List<CoreHunterMeasure> |
getAllowedMeasures(boolean hasGenotypes,
boolean hasPhenotypes,
boolean hasDistances,
CoreHunterObjectiveType objectiveType)
Create a list of all possible Core Hunter measures for a given objective type
taking into account whether genotypes, phenotypes and/or precomputed distances
are available.
|
static List<CoreHunterMeasure> |
getAllowedMeasures(CoreHunterData coreHunterData,
CoreHunterObjectiveType objectiveType)
Create a list of all possible Core Hunter measures for a given data object and objective type.
|
static List<CoreHunterObjectiveType> |
getAllowedObjectiveTypes(CoreHunterData coreHunterData)
Creates a list of all possible Core Hunter objective types for a given data object.
|
static String[] |
getIds(uno.informatics.data.Data data) |
static String[] |
getIdsFromIndices(uno.informatics.data.Data data,
int[] indices)
Get unique identifier strings from item indices.
|
static int[] |
getIndicesFromIds(uno.informatics.data.pojo.DataPojo data,
String[] ids)
Get item indices from their string identifiers.
|
static String[] |
getMarkerNames(FrequencyGenotypeData data) |
static String[] |
getNames(uno.informatics.data.Data data) |
static double[][] |
getNormalizationRanges(CoreHunterArguments args,
String mode,
int timeLimit,
int maxTimeWithoutImprovement,
long maxSteps,
long maxStepsWithoutImprovement,
long seed)
Get normalization ranges of all objectives in a multi-objective configuration.
|
static Double[] |
getRanges(SimplePhenotypeData data) |
static DistanceMatrixData |
readDistanceMatrixData(String file) |
static FrequencyGenotypeData |
readGenotypeData(String file,
String format) |
static SimplePhenotypeData |
readPhenotypeData(String file) |
static int[] |
sampleCore(CoreHunterArguments args,
String mode,
int timeLimit,
int maxTimeWithoutImprovement,
long maxSteps,
long maxStepsWithoutImprovement,
long seed,
boolean silent)
Sample a core collection.
|
public static String[] getIds(uno.informatics.data.Data data)
public static String[] getNames(uno.informatics.data.Data data)
public static String[] getIdsFromIndices(uno.informatics.data.Data data, int[] indices)
data
- a data objectindices
- item indices (zero-based).public static int[] getIndicesFromIds(uno.informatics.data.pojo.DataPojo data, String[] ids)
data
- a data objectids
- string identifierspublic static DistanceMatrixData readDistanceMatrixData(String file) throws IOException
IOException
public static DistanceMatrixData createDistanceMatrixData(double[][] distances, String[] ids, String[] names)
public static FrequencyGenotypeData readGenotypeData(String file, String format) throws IOException
IOException
public static FrequencyGenotypeData createDefaultGenotypeData(String[][] data, String[] ids, String[] names, String[] columnNames)
public static FrequencyGenotypeData createBiparentalGenotypeData(byte[][] alleleScores, String[] ids, String[] names, String[] markerNames)
public static FrequencyGenotypeData createFrequencyGenotypeData(double[][] frequencies, String[] ids, String[] names, String[] columnNames, String[] alleleNames)
public static String[][] getAlleles(FrequencyGenotypeData data)
public static String[] getMarkerNames(FrequencyGenotypeData data)
public static double[][] getAlleleFrequencies(FrequencyGenotypeData data)
public static SimplePhenotypeData readPhenotypeData(String file) throws IOException
IOException
public static Double[] getRanges(SimplePhenotypeData data)
public static CoreHunterObjective createObjective(String type, String measure, double weight)
public static CoreHunterObjective createObjective(String type, String measure, double weight, double min, double max)
public static CoreHunterArguments createArguments(CoreHunterData data, int size, CoreHunterObjective[] objectives, int[] alwaysSelected, int[] neverSelected, boolean normalizeMultiObjective)
public static double[][] getNormalizationRanges(CoreHunterArguments args, String mode, int timeLimit, int maxTimeWithoutImprovement, long maxSteps, long maxStepsWithoutImprovement, long seed)
args
- Core Hunter arguments including data, objectives and subset size.mode
- Execution mode, one of "default" or "fast". Only affects the default
stop conditions, not the used algorithm (always random descent).timeLimit
- Absolute runtime limit in seconds.
Not used if set to a negative value.maxTimeWithoutImprovement
- Maximum time without finding an improvement, in seconds.
Not used if set to a negative value. In case no explicit
stop conditions have been specified, the maximum time without
improvement defaults to 10 seconds in default mode, or 2 seconds
in fast mode.maxSteps
- Maximum number of search steps. Not used if set to a negative value.maxStepsWithoutImprovement
- Maximum number of search steps without finding an improvement.
Not used if set to a negative value.seed
- Positive seed used for random generation to allow reproducible results.
If zero or negative, no seed is applied.public static int[] sampleCore(CoreHunterArguments args, String mode, int timeLimit, int maxTimeWithoutImprovement, long maxSteps, long maxStepsWithoutImprovement, long seed, boolean silent)
args
- Core Hunter arguments including data, objective and subset size.mode
- Execution mode, one of "default" or "fast".timeLimit
- Absolute runtime limit in seconds.
Not used if set to a negative value.maxTimeWithoutImprovement
- Maximum time without finding an improvement, in seconds.
Not used if set to a negative value. In case no explicit
stop conditions have been specified, the maximum time without
improvement defaults to 10 seconds in default mode, or 2 seconds
in fast mode.maxSteps
- Maximum number of search steps. Not used if set to a negative value.maxStepsWithoutImprovement
- Maximum number of search steps without finding an improvement.
Not used if set to a negative value.seed
- Positive seed used for random generation to allow reproducible results.
If zero or negative, no seed is applied.silent
- If true
no output is written to the console.public static double evaluateCore(int[] selected, CoreHunterData data, CoreHunterObjective obj)
selected
- Indices of selected items (zero-based).data
- Core Hunter dataobj
- Objective used to evaluate the core.public static final List<CoreHunterObjective> createDefaultObjectives(CoreHunterData coreHunterData)
coreHunterData
- the data for which the objectives are requiredpublic static final CoreHunterObjective createDefaultObjective(CoreHunterData coreHunterData)
coreHunterData
- the data for which the objective is requiredpublic static final CoreHunterObjective createDefaultObjective(CoreHunterData coreHunterData, List<CoreHunterObjective> currentObjectives)
coreHunterData
- the data for which the objective is requiredcurrentObjectives
- a list existing objectivespublic static final List<CoreHunterObjective> getAllAllowedObjectives(CoreHunterData coreHunterData)
coreHunterData
- the data for which the objectives are requiredpublic static final List<CoreHunterObjectiveType> getAllowedObjectiveTypes(CoreHunterData coreHunterData)
coreHunterData
- the data for which the objective types are requiredpublic static final List<CoreHunterMeasure> getAllowedMeasures(CoreHunterData coreHunterData, CoreHunterObjectiveType objectiveType)
coreHunterData
- the data for which the measures are requiredobjectiveType
- the objective type for which the measures are requiredpublic static final List<CoreHunterMeasure> getAllowedMeasures(boolean hasGenotypes, boolean hasPhenotypes, boolean hasDistances, CoreHunterObjectiveType objectiveType)
hasGenotypes
- true
if genotypic data is present in the datahasPhenotypes
- true
if phenotypic data is present in the datahasDistances
- true
if distances data is present in the dataobjectiveType
- the objective type for which the measures are requiredCopyright © 2017. All rights reserved.