public abstract class BaseDatasetNormalizer extends java.lang.Object implements Options, Commandable, Printable, java.io.Serializable, java.lang.Cloneable
Will only normalize class variable if a measure class is present. If it is present, this class will normalize both the measured and predicted class variable using the same function. Will throw an error if you try to normalize discrete classes.
Any implementation must provide the following operations:
trainOnAttributes(magpie.data.Dataset)
and trainOnMeasuredClass(magpie.data.Dataset)
normalizeAttributes(magpie.data.Dataset)
and normalizeClassVariable(magpie.data.Dataset)
restoreAttributes(magpie.data.Dataset)
and restoreClassVariable(magpie.data.Dataset)
Once you implement these functions, make sure to test them using the "test" command.
Implemented Commands:
normalize $<dataset> - Normalize attributes and/or class variable of a dataset
restore $<dataset> - Restore attributes from normalized
to original ranges
train [attributes] [class] $<dataset> - Train normalizer on a dataset
test $<dataset> - Test whether restoration actually maps
dataset back onto original ranges.
dataset: Dataset to be normalized
Must be trained first
dataset: Dataset to be restored
attributes: Train to normalizing attributes
class: Train for normalizing class variable
dataset: Dataset to use for training
dataset: Dataset used for testing
This operation is only used for debugging purposes.
Constructor and Description |
---|
BaseDatasetNormalizer() |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
about()
Prints a simple status message about this object
|
BaseDatasetNormalizer |
clone() |
boolean |
isTrained() |
void |
normalize(Dataset Data)
Transform attributes from original to standardized range.
|
protected abstract void |
normalizeAttributes(Dataset Data)
Perform the actual normalization on the attributes
|
protected abstract void |
normalizeClassVariable(Dataset Data)
Perform the actual normalization on the class variable.
|
java.lang.String |
printCommand(java.util.List<java.lang.String> Command)
Handles more complicated printing commands.
|
java.lang.String |
printDescription(boolean htmlFormat)
Print full name of object, and a simple description of the options.
|
void |
restore(Dataset Data)
Restore attributes from scaled to original range.
|
protected abstract void |
restoreAttributes(Dataset Data)
Perform the actual restoration on the attributes
|
protected abstract void |
restoreClassVariable(Dataset Data)
Perform the actual restoration on the class variables (measured and predicted!)
|
java.lang.Object |
runCommand(java.util.List<java.lang.Object> Command)
Process some command described by a list of Objects.
|
void |
setToNormalizeAttributes(boolean input)
Set whether to normalize attributes
|
void |
setToNormalizeClass(boolean input)
Set whether to normalize class variable
|
boolean |
test(Dataset data)
Check whether the normalize/restore operations are reversible.
|
void |
train(Dataset Data)
Train the normalizer.
|
protected abstract void |
trainOnAttributes(Dataset Data)
Perform the actual training work for attributes.
|
protected abstract void |
trainOnMeasuredClass(Dataset Data)
Perform the actual training work for the class variable.
|
boolean |
willNormalizeAttributes() |
boolean |
willNormalizeClass() |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
printUsage, setOptions
public BaseDatasetNormalizer clone()
clone
in class java.lang.Object
public boolean isTrained()
public boolean willNormalizeAttributes()
public boolean willNormalizeClass()
public void setToNormalizeAttributes(boolean input)
input
- Whether attributes should be normalizedpublic void setToNormalizeClass(boolean input)
input
- Whether class variable should be normalized.public void train(Dataset Data)
Data
- Training setprotected abstract void trainOnAttributes(Dataset Data)
Data
- Training setprotected abstract void trainOnMeasuredClass(Dataset Data)
NOTE: Use the measured class variable to train normalizer.
Data
- Training setpublic void normalize(Dataset Data)
Data
- Dataset to be transformedprotected abstract void normalizeAttributes(Dataset Data)
Data
- Dataset to be transformedprotected abstract void normalizeClassVariable(Dataset Data)
Data
- Dataset to be transformedpublic void restore(Dataset Data)
Data
- Dataset to be transformedprotected abstract void restoreAttributes(Dataset Data)
Data
- Dataset to be transformedprotected abstract void restoreClassVariable(Dataset Data)
Data
- Dataset to be transformedpublic boolean test(Dataset data)
data
- Dataset to use for testingspublic java.lang.String about()
Printable
public java.lang.String printDescription(boolean htmlFormat)
Printable
Example: For a model training a separate WekaRegression for intermetallics
magpie.models.regression.SplitRegression
printDescription
in interface Printable
htmlFormat
- Whether format for output to an HTML page
(e.g., <div> to create indentation) or for printing to screen.#printModel()
public java.lang.String printCommand(java.util.List<java.lang.String> Command) throws java.lang.Exception
Printable
printCommand
in interface Printable
Command
- Command specifying what to printjava.lang.Exception
- If command not understoodpublic java.lang.Object runCommand(java.util.List<java.lang.Object> Command) throws java.lang.Exception
Commandable
runCommand
in interface Commandable
Command
- Command as a list of objectsjava.lang.Exception
- If something goes wrong