public class Parameters extends java.lang.Object implements java.lang.Iterable<Parameter>, java.io.Serializable
Modifier and Type | Class and Description |
---|---|
class |
Parameters.ParameterException
Exception related to the parameters
|
Constructor and Description |
---|
Parameters()
Creates an empty set of parameters
|
Parameters(java.util.ArrayList<Parameter> params)
Creates a set of parameters containing the given parameters
|
Modifier and Type | Method and Description |
---|---|
void |
addParameter(Parameter p)
Add a parameter
|
void |
addParameters(Parameters pp)
Adds the parameters from another set of parameters
|
void |
calculated()
Resets the testfor whether probability matrices need to be recalculalated.
|
Parameters |
clone() |
static Parameters |
fromFile(java.io.File f)
Reads parameters from a file.
|
Parameter |
getParam(java.lang.String name)
Gets the parameter with the given name
|
double |
getValue(java.lang.String name)
Gets the value of a parameter
|
java.util.HashMap<java.lang.String,java.lang.Double> |
getValues()
Gets a map from parameter name to the value of that parameter
|
boolean |
hasParam(java.lang.String name)
Checks whether there is a parameter with the given name
|
java.util.Iterator<Parameter> |
iterator() |
int |
numberEstimate()
Gets the number of parameters to be estimated
|
boolean |
recalculateMatrix()
Tests whether any parameters that would require recalculation of the
probability matrices have been changed since the last call to
calculated() |
void |
setValue(Parameter p,
double v)
Sets the value of a parameter
|
void |
toFile(java.io.File f)
Writes the parameter values to a file.
|
void |
toFile(java.io.File f,
double like)
Writes the parameter values to a file and writes a line labeled likelihood
and which gives the likelihood given as input.
|
java.lang.String |
toString() |
public Parameters()
public Parameters(java.util.ArrayList<Parameter> params)
params
- A list of parameterspublic Parameters clone()
clone
in class java.lang.Object
public void addParameter(Parameter p)
p
- The parameterpublic void addParameters(Parameters pp)
pp
- The other set of parameterspublic boolean recalculateMatrix()
calculated()
public void calculated()
public void setValue(Parameter p, double v)
p
- The parameterv
- The valuepublic double getValue(java.lang.String name) throws Parameters.ParameterException
name
- The parameters nameParameters.ParameterException
- Thrown if there is no
parameter with that namepublic Parameter getParam(java.lang.String name) throws Parameters.ParameterException
name
- The name of the parameterParameters.ParameterException
- Thrown if there is no
parameter with that namepublic boolean hasParam(java.lang.String name)
name
- The name of the parameterpublic java.util.HashMap<java.lang.String,java.lang.Double> getValues()
public int numberEstimate()
public java.lang.String toString()
toString
in class java.lang.Object
public java.util.Iterator<Parameter> iterator()
iterator
in interface java.lang.Iterable<Parameter>
public void toFile(java.io.File f) throws OutputException
Parameter.fromString(java.lang.String)
f
- File to write the parameters toOutputException
- Thrown if an error occurs writing the filepublic void toFile(java.io.File f, double like) throws OutputException
Parameter.fromString(java.lang.String)
f
- File to write the parameters tolike
- The likelihood valueOutputException
- Thrown if an error occurs writing the filepublic static Parameters fromFile(java.io.File f) throws InputException
Parameter.fromString(java.lang.String)
.f
- The input fileInputException
- If there is an input error