public class CompositionDataset extends MultiPropertyDataset
Some of the available features include:
importText
function,
the data must be whitespace-delimited with a header row giving property names
and the composition of the material as the first row:
Composition property_1{class1,class2} property_2 ... property_N
As,0.2,B,0.8, class1 0.4 0.8 ...
AsB4, class2 0.9 none ...
Cu2Zr,4, class1 0.1 10.8 ...
<as many entries as you desire>
A few things to know about this format:
Attributes Generates several categories of attributes by default, which are described in CompositionDataset(boolean).
Implemented Commands:
attributes composition <true|false> -
Set whether to use composition as attributes
attributes properties add <names...> - Add elemental properties to use when generating attributes attributes properties add set <name> - Add in all elemental properties from a pre-defined set
attributes properties remove <names...> - Remove properties from list of those used when generating attributes
attributes properties pair add <names...> - Add properties of element pairs to use when generating attributes attributes properties pair remove <names...> - Remove properties of element pairs from list of those used when generating attributes
attributes properties pair add <difference|ratio> <names...>
- Add properties of element pairs generated by computing the difference or ratio
of properties of each element in the pair
attributes properties <directory> - Specify directory that contains the elemental property lookup files
Implemented Save Formats
comp - All properties with composition written by element fraction
By default, this class does not use composition (by itself) as attributes
Very similar to the "prop" format"
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
DataDirectory
Location of lookup date files
|
protected java.util.List<java.lang.String> |
ElementalProperties
List of properties used when generating attributes
|
java.lang.String[] |
ElementNames
List of element names
|
protected java.util.List<java.lang.String> |
ElementPairProperties
List of properties of pairs of elements used when generating attributes
|
protected double[][] |
OxidationStates
Oxidation states of every element
|
protected java.util.SortedMap<java.lang.String,double[][]> |
PairPropertyData
Map of properties of pairs of elements
|
protected java.util.SortedMap<java.lang.String,double[]> |
PropertyData
Map of elemental property names to values
|
protected int[] |
SortingOrder
Order in which elements are sorted (used when printing)
|
AttributeName, Entries, Expanders, Generators
Constructor and Description |
---|
CompositionDataset()
Create a dataset using the default set of attribute generators.
|
CompositionDataset(boolean useDefaultGenerators)
Create a blank dataset.
|
Modifier and Type | Method and Description |
---|---|
void |
addElementalProperty(java.lang.String Name)
Define a new elemental property to use when generating attributes.
|
void |
addElementalPropertySet(java.lang.String setName)
Add a set of elemental properties to the list of those used when computing attributes.
|
void |
addElementPairProperty(java.lang.String propName)
Add a property of a pair of elements that will be used when generating attributes
|
CompositionEntry |
addEntry(java.lang.String input)
A new entry by parsing an input string.
|
java.lang.String |
addGeneratedElementPairProperty(java.lang.String basePropName,
java.lang.String method)
Generate a new lookup table for properties of pairs of elements from
properties of single elements
|
protected void |
calculateAttributes()
Compute attributes that are specific to this class.
|
boolean |
compositionCanFormIonic(CompositionEntry entry)
Whether a composition can form a neutral compound assuming each element
takes only a single oxidation state.
|
CompositionDataset |
createTemplate()
Create a template designed to be saved using serialization
|
CompositionDataset |
emptyClone()
Creates a new instance with the same class and attribute names, but
without any entries.
|
java.lang.String |
getDataDirectory()
Get path to directory containing elemental property lookup-data
|
java.util.List<java.lang.String> |
getElementalProperties()
Get list of elemental properties currently being used to generate attributes.
|
java.util.List<java.lang.String> |
getElementPairProperties()
Get list of properties of pairs of elements currently being used to generate attributes.
|
CompositionEntry |
getEntry(int index)
Retrieve a single entry from the dataset
|
double[][] |
getOxidationStates()
Get the list of known oxidation states
|
double[][] |
getPairPropertyLookupTable(java.lang.String propertyName)
Get a lookup table for the properties of pairs of elements
|
double[] |
getPropertyLookupTable(java.lang.String propertyName)
Reads in a data file that contains properties for each element.
|
int[] |
getSortingOrder()
Get the order in which elements are sorted when storing a composition.
|
void |
importText(java.lang.String filename,
java.lang.Object[] options)
Read in an dataset from file.
|
java.lang.String |
printEntryDescription(boolean htmlFormat)
Print out what the entries to this dataset are.
|
boolean |
removeElementalProperty(java.lang.String name)
Remove an elemental property from the list used when generating
attributes
|
boolean |
removeElementPairProperty(java.lang.String name)
Remove an elemental property from the list used when generating
attributes
|
protected java.lang.Object |
runAttributeCommand(java.util.List<java.lang.Object> Command)
Run commands related to attributes of each entry.
|
java.lang.Object |
runCommand(java.util.List<java.lang.Object> Command)
Process some command described by a list of Objects.
|
protected java.lang.Object |
runPairPropertyCommand(java.util.List<java.lang.Object> command)
Run commands that set the element pair properties to be used when generating attributes.
|
protected java.lang.Object |
runPropertyCommand(java.util.List<java.lang.Object> Command)
Run commands that control which elemental properties are used when
generating attributes
|
java.lang.String |
saveCommand(java.lang.String Basename,
java.lang.String Format)
Handles complicated saving commands.
|
void |
setDataDirectory(java.lang.String directory)
Define whether to look for elemental property lookup tables.
|
void |
useCompositionAsAttributes(boolean decision)
Set whether to use composition (i.e.
|
addEntries, addEntries, addEntry, addProperty, addProperty, clearPropertyData, combine, definePropertyNames, getClassNames, getMeasuredPropertyArray, getMeasuredPropertyArray, getPredictedPropertyArray, getPredictedPropertyArray, getPropertyClassCount, getPropertyClasses, getPropertyClasses, getPropertyIndex, getPropertyName, getPropertyNames, getTargetPropertyIndex, getTargetPropertyName, hasProperty, importEntryProperties, importPropertyNames, NClasses, NProperties, setClassNames, setPropertyClasses, setTargetProperty, setTargetProperty, toJSON, toString, usingPropertyAsClass
about, addAttribute, addAttributeExpander, addAttributeGenerator, addAttributes, clearAttributeExpanders, clearAttributeGenerators, clearAttributes, clearData, clone, combine, combine, containsEntry, deleteMeasuredClasses, deletePredictedClasses, finalizeGeneration, generateAttributes, getAttributeArray, getAttributeExpanders, getAttributeGenerators, getAttributeIndex, getAttributeName, getAttributeNames, getCitations, getClassName, getClassProbabilityArray, getDistribution, getDistributionCount, getDuplicates, getEntries, getEntriesWriteAccess, getEntryArray, getMeasuredClassArray, getPredictedClassArray, getRandomSplit, getRandomSplit, getRandomSplit, getRandomSplit, getRandomSubset, getRandomSubset, getSingleAttributeArray, getSubset, getTrainingExamples, getUniqueEntries, loadState, matchEntries, NAttributes, NEntries, partition, partition, printAttributeDescription, printCommand, printDescription, printDistribution, printEntries, printUsage, removeDuplicates, resolveDuplicates, restoreAttributes, runAttributeExpanders, runAttributeExpansionCommand, runAttributeGeneratorCommand, runAttributeGenerators, saveState, saveTemplate, setAttributeNames, setClassProbabilities, setMeasuredClasses, setOptions, setPredictedClasses, splitForThreading, splitIntoFolds, splitIntoFolds, subtract, transferToWeka
public java.lang.String[] ElementNames
protected int[] SortingOrder
protected java.lang.String DataDirectory
protected java.util.List<java.lang.String> ElementalProperties
protected java.util.List<java.lang.String> ElementPairProperties
protected java.util.SortedMap<java.lang.String,double[]> PropertyData
protected java.util.SortedMap<java.lang.String,double[][]> PairPropertyData
protected double[][] OxidationStates
public CompositionDataset()
public CompositionDataset(boolean useDefaultGenerators)
useDefaultGenerators
- [in] Whether to use default generatorspublic CompositionDataset emptyClone()
Dataset
emptyClone
in class MultiPropertyDataset
public CompositionDataset createTemplate()
Dataset
createTemplate
in class MultiPropertyDataset
public CompositionEntry getEntry(int index)
Dataset
getEntry
in class MultiPropertyDataset
index
- Index of entrypublic CompositionEntry addEntry(java.lang.String input) throws java.lang.Exception
Dataset
public int[] getSortingOrder()
public void importText(java.lang.String filename, java.lang.Object[] options) throws java.lang.Exception
importText
in class Dataset
filename
- Path of file to be importedoptions
- Any options used to control importjava.lang.Exception
public void useCompositionAsAttributes(boolean decision)
By default: This class does not use fractions as attributes.
decision
- Whether to use it or notpublic java.lang.String getDataDirectory()
public void setDataDirectory(java.lang.String directory)
Elemental property tables should have the properties for each element on a separate line, sorted by Atomic Number. If the property is not known, write "None". You will be alerted if that property was needed generating attributes.
directory
- Path to the elemental property lookup directorypublic void addElementalProperty(java.lang.String Name)
Name
- Name of propertypublic void addElementalPropertySet(java.lang.String setName) throws java.lang.Exception
setName
- Name of setjava.lang.Exception
PropertyLists.getPropertySet(java.lang.String)
public void addElementPairProperty(java.lang.String propName)
propName
- Name of propertypublic java.lang.String addGeneratedElementPairProperty(java.lang.String basePropName, java.lang.String method) throws java.lang.Exception
basePropName
- Name of property used to generate the new lookup tablemethod
- Method used to generate new attributes. Supported methods
are: "difference" and "ratio"java.lang.Exception
public java.util.List<java.lang.String> getElementalProperties()
public java.util.List<java.lang.String> getElementPairProperties()
public boolean removeElementalProperty(java.lang.String name)
name
- Name of propertypublic boolean removeElementPairProperty(java.lang.String name)
name
- Name of propertyprotected void calculateAttributes()
Dataset
calculateAttributes
in class Dataset
public double[] getPropertyLookupTable(java.lang.String propertyName) throws java.lang.Exception
propertyName
- Elemental property of interestjava.lang.Exception
public double[][] getPairPropertyLookupTable(java.lang.String propertyName) throws java.lang.Exception
propertyName
- Name of desired lookup tablejava.lang.Exception
LookupData.ElementPairProperties
public double[][] getOxidationStates()
public boolean compositionCanFormIonic(CompositionEntry entry)
entry
- Composition to be assessedpublic java.lang.Object runCommand(java.util.List<java.lang.Object> Command) throws java.lang.Exception
Commandable
runCommand
in interface Commandable
runCommand
in class MultiPropertyDataset
Command
- Command as a list of objectsjava.lang.Exception
- If something goes wrongprotected java.lang.Object runAttributeCommand(java.util.List<java.lang.Object> Command) throws java.lang.Exception
Dataset
runAttributeCommand
in class Dataset
Command
- Operation to be run on/about attributesjava.lang.Exception
- On any errorprotected java.lang.Object runPairPropertyCommand(java.util.List<java.lang.Object> command) throws java.lang.Exception
command
- Command to be parsedjava.lang.Exception
protected java.lang.Object runPropertyCommand(java.util.List<java.lang.Object> Command) throws java.lang.Exception
Command
- Command to act onjava.lang.Exception
public java.lang.String saveCommand(java.lang.String Basename, java.lang.String Format) throws java.lang.Exception
Savable
Dev Note: Make sure to add save format to Javadoc. See Dataset as an example. Required format:
<save><p><b>format<b> - Description
<br>Optional room to talk more about format </save>
saveCommand
in interface Savable
saveCommand
in class MultiPropertyDataset
Basename
- Name of file without extensionFormat
- Command specifying format in which to printjava.lang.Exception
- If command not understoodpublic java.lang.String printEntryDescription(boolean htmlFormat)
Dataset
printEntryDescription
in class Dataset
htmlFormat
- Whether to print in HTML format