public class CompositionSetDistanceFilter extends BaseDatasetFilter
Entries are labeled based on whether they are farther than a certain threshold.
Usage: $<dataset> <norm> <threshold>
Constructor and Description |
---|
CompositionSetDistanceFilter() |
Modifier and Type | Method and Description |
---|---|
void |
addComposition(CompositionEntry entry)
Add a new composition to the dataset.
|
void |
addCompositions(java.util.Collection<CompositionEntry> comps)
Add a list of compositions to the set
|
void |
clearCompositions()
Clear the list of compositions in set
|
static double |
computeDistance(java.util.Collection<CompositionEntry> set,
CompositionEntry entry,
int p)
Compute the distance between a composition and a set of other compositions.
|
static double |
computeDistance(CompositionEntry entry1,
CompositionEntry entry2,
int p)
Compute the distance between two entries.
|
static boolean |
isCloserThan(java.util.Collection<CompositionEntry> set,
CompositionEntry entry,
int p,
double dist)
Check whether an entry is closer to a known set of compounds than a certain
threshold.
|
protected boolean[] |
label(Dataset D)
Given a dataset, determine which entries passes the filter.
|
protected int |
parallelMinimum()
Minimum number of entries to label in parallel.
|
java.lang.String |
printUsage()
Print out required format for options.
|
void |
setCompositions(CompositionDataset data)
Set the list of compositions to be considered
|
void |
setDistanceThreshold(double dist)
Set the distance threshold
|
void |
setOptions(java.util.List<java.lang.Object> Options)
Set any options for this object.
|
void |
setP(int P)
Set the p-norm to use when computing distance between compositions.
|
void |
train(Dataset TrainingSet)
Train a dataset splitter, if necessary
|
filter, parallelLabel, setExclude, toExclude
public void setOptions(java.util.List<java.lang.Object> Options) throws java.lang.Exception
Options
Options
- Array of options as Objects - can be null
java.lang.Exception
- if problem with inputspublic java.lang.String printUsage()
Options
public void clearCompositions()
public void addComposition(CompositionEntry entry)
entry
- Entry to be addedpublic void addCompositions(java.util.Collection<CompositionEntry> comps)
comps
- Collection of compositions to be addedpublic void setCompositions(CompositionDataset data)
data
- Dataset containing compositions to use as datasetpublic void setP(int P) throws java.lang.Exception
P
- Desired p norm. Use -1 for Linf norm.java.lang.Exception
- If p < 0 && p != -1.public void setDistanceThreshold(double dist) throws java.lang.Exception
dist
- Desired distance thresholdjava.lang.Exception
- If distance is ≤ 0protected int parallelMinimum()
BaseDatasetFilter
parallelMinimum
in class BaseDatasetFilter
public void train(Dataset TrainingSet)
BaseDatasetFilter
train
in class BaseDatasetFilter
TrainingSet
- Dataset to use for trainingprotected boolean[] label(Dataset D)
BaseDatasetFilter
label
in class BaseDatasetFilter
D
- Dataset to be labeledpublic static double computeDistance(CompositionEntry entry1, CompositionEntry entry2, int p)
entry1
- Entry Aentry2
- Entry Bp
- Desired Lp norm (must be ≥ 0)public static double computeDistance(java.util.Collection<CompositionEntry> set, CompositionEntry entry, int p)
set
- Set of compositions to considerentry
- Composition of entryp
- Desired Lp norm. Use -1 for Linfpublic static boolean isCloserThan(java.util.Collection<CompositionEntry> set, CompositionEntry entry, int p, double dist)
set
- Set of compositions to compare againstentry
- Composition of entry to testp
- Desired Lp norm. Use -1 for Linfdist
- Distance thresholdcomputeDistance(java.util.Collection, magpie.data.materials.CompositionEntry, int)