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 - List which elemental properties are used to generate 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 <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 |
---|---|
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 double[][] |
OxidationStates
Oxidation states of every element
|
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.
|
CompositionEntry |
addEntry(java.lang.String input)
A new entry by parsing an input string.
|
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 |
emptyClone()
Creates a new instance with the same class and attribute names, but
without any entries.
|
java.util.List<java.lang.String> |
getElementalProperties()
Get list of elemental properties 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[] |
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.
|
protected void |
readOxidationStates()
Reads in a data file that contains known oxidation states for each
element.
|
boolean |
removeElementalProperty(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 |
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, toString, usingPropertyAsClass
about, addAttribueExpander, addAttribueGenerator, addAttribute, addAttributes, clearAttributeExpanders, clearAttributeGenerators, clearAttributes, clearData, clone, combine, combine, containsEntry, deleteMeasuredClasses, finalizeGeneration, generateAttributes, getAttributeArray, getAttributeExpanders, getAttributeGenerators, getAttributeIndex, getAttributeName, getAttributeNames, getCitations, getClassName, getClassProbabilityArray, getDistribution, getDistributionCount, getEntries, getEntriesWriteAccess, getEntryArray, getMeasuredClassArray, getPredictedClassArray, getRandomSubset, getRandomSubset, getSingleAttributeArray, getSubset, getTrainingExamples, loadState, matchEntries, NAttributes, NEntries, partition, partition, printAttributeDescription, printCommand, printDescription, printDistribution, printEntries, printUsage, randomSplit, randomSplit, removeDuplicates, restoreAttributes, runAttributeExpanders, runAttributeExpansionCommand, runAttributeGeneratorCommand, runAttributeGenerators, saveState, setAttributeNames, setClassProbabilities, setMeasuredClasses, setOptions, setPredictedClasses, splitForThreading, splitIntoFolds, subtract, transferToWeka
public java.lang.String[] ElementNames
protected int[] SortingOrder
public java.lang.String DataDirectory
protected java.util.List<java.lang.String> ElementalProperties
public java.util.SortedMap<java.lang.String,double[]> PropertyData
protected double[][] OxidationStates
public CompositionDataset()
public CompositionDataset(boolean useDefaultGenerators)
useDefaultGenerators
- [in] Whether to use default generatorspublic CompositionDataset emptyClone()
Dataset
emptyClone
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 void setDataDirectory(java.lang.String directory) throws java.lang.Exception
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 directoryjava.lang.Exception
public void addElementalProperty(java.lang.String Name)
Name
- Name of propertypublic java.util.List<java.lang.String> getElementalProperties()
public boolean removeElementalProperty(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
- MeasuredProperty of interestjava.lang.Exception
public double[][] getOxidationStates()
protected void readOxidationStates()
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 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