|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectuk.co.agena.minerva.util.model.DataSet
public class DataSet
A DataSet contains a set of DataPoints (i.e. numerical values). A DataSet will typically be associated with an ExtendedNode or an Observation and will contain the marginal probability of each ExtendedState or the likelihood distribution of the evidence to be entered.
For example, there may exist an ExtendedNode called "Supplier Quality" with three ExtendedStates, "Low", "Medium" and "High". After compilation of the containing ExtendedBN, the marginals could be exported as a DataSet with the following DataPoint values: {0.3, 0.4, 0.3}.
A DataSet could also be used to encapsulate, for example, that "Supplier Quality" has been observed to be "High". The associated Observation object would contain a DataSet with the following DataPoint values: {0, 0, 1} (where the last value would correspond to the "High" ExtendedState).
Field Summary | |
---|---|
static int |
LIMIT_RULE_NUMERIC_VALUE
|
static int |
LIMIT_RULE_STATENUMBER
|
static double |
version
|
Fields inherited from interface uk.co.agena.minerva.util.model.Writable |
---|
FIELD_SEPARATOR |
Constructor Summary | |
---|---|
DataSet()
Default constructor. |
|
DataSet(NameDescription name,
int connObjectId)
Creates a DataSet with the specified name and connected object ID. |
|
DataSet(NameDescription name,
int connObjectId,
java.util.List dataPoints)
Creates a DataSet with the specified name, connected object ID and DataPoints. |
Method Summary | |
---|---|
DataPoint |
addAbsoluteDataPoint(double value)
Adds a new absolute (i.e. |
void |
addDataPoint(DataPoint dataPoint)
Adds the supplied DataPoint to the DataSet. |
void |
addDataPoint(DataPoint dataPoint,
int orderPos)
Adds the supplied DataPoint to the DataSet at the specified order postion. |
DataPoint |
addIntervalDataPoint(double lower,
double upper)
Adds a new interval data point to the DataSet. |
DataPoint |
addLabelledDataPoint(java.lang.String label)
Adds a new labelled DataPoint to the DataSet. |
void |
clearDataPoints()
Clears all DataPoints out of the DataSet and reinitialises the DataSet with an empty List. |
java.lang.Object |
clone()
Creates a copy of this DataSet. |
boolean |
containsXNoZeroDataPoints(int nonZeroDataPoints)
This method returns a boolean that is true if the data set contains a number of non-0 data points equal to the specified argurment. |
void |
convertLabelsToIntegerFormat()
This method will iterate over the data points in the data set. |
void |
convertLabelsToScientificFormat(java.lang.String numberMask)
This method will itterate over the data points in the data set, If they are interval data points it will construct new labels for the data points using their range values the number mask will be appiled to the numbers before they are used in the string If the number formatted mask provided is null "", then "0.00E0" is used. |
static DataSet |
createDataSet(java.lang.String[] dataPointNames)
This method creates a dataset, with a set of data points, with names equal to the strings passed as an arguement. |
boolean |
doDataPointsHaveIntervalLabels()
This checks the first DataPoint to see if its label contains an interval. |
double[] |
getAsDoubles()
Returns the DataSet's DataPoints as simple array of doubles. |
int |
getConnObjectId()
Returns the connected object ID of the DataSet. |
DataPoint |
getDataPointAtOrderPosition(int orderPos)
Returns the DataPoint at the specified order position in the DataSet. |
java.lang.String[] |
getDataPointLabels()
Returns an array of the labels of all DataPoints. |
java.util.List |
getDataPoints()
Returns the DataPoints associated with the DataSet. |
DataPoint |
getDataPointWithConnObjectID(int id)
Returns the first data point that has the connObjectID attribute value equal to the one specified. |
DataPoint |
getHighestDataPoint()
This method will return the highest data point in the dataset. |
DataPoint |
getHighestDataPointAdjustedForProbailityMass()
This method will return the highest data point adjusted for probaility mass. |
int |
getId()
Returns the unique ID of the DataSet. |
IntervalDataPoint |
getIntervalDataPointWithHighestMidPoint()
Return the Interval data point with the highest mid point (dirived from the bounding values) if there are no Interval data points connected to the data set then a null is returned. |
IntervalDataPoint |
getIntervalDataPointWithHighestRangeValue()
Return the Interval data point with the lowest range value (lowest lower bound) if there are no Interval data points connected to the data set then a null is returned. |
IntervalDataPoint |
getIntervalDataPointWithLowestMidPoint()
Return the Interval data point with the lowest mid point (dirived from the bounding values) if there are no Interval data points connected to the data set then a null is returned. |
IntervalDataPoint |
getIntervalDataPointWithLowestRangeValue()
Return the Interval data point with the lowest range value (lowest lower bound) if there are no Interval data points connected to the data set then a null is returned. |
DataPoint |
getLowestDataPoint()
Returns the DataPoint in the DataSet that has the lowest value. |
DataPoint |
getLowestDataPointAdjustedForProbailityMass()
This method will return the lowest data point adjusted for probaility mass. |
NameDescription |
getName()
Returns the name of the DataSet. |
double |
getTotal(int fromPoint,
int toPoint)
returns the total value of all data points between the specified points, a value of -1 in a arguement will have it default to the beginning and end of the data set respectivily Thus getTotal(-1,-1) will return the total of the whole data set |
double |
getTotalAdjustedForProbabilityMass(int fromPoint,
int toPoint)
This methods will return a total of the data point values between the specified points. |
double |
getVersion()
Returns the version of the class. |
void |
normalise()
Normalises this DataSet that the values of all the DataPoints add up to one. |
void |
pad(double with,
int noOfElements,
java.lang.String label,
int connObjId)
Creates multiple identical DataPoints and adds them to this DataSet. |
int |
read(java.util.List strings,
int currentLineNumber)
|
DataPoint |
removeDataPointAtOrderPosition(int orderPos)
Removes the DataPoint at the specified order position in the DataSet. |
void |
setConnObjectId(int connObjectId)
Sets the connected object ID of the DataSet to the ID specified. |
void |
setDataPoints(java.util.List dataPoints)
Assigns a List of DataPoints to the DataSet. |
void |
setId(int id)
Sets the unique ID of the DataSet to the ID specified. |
void |
setName(NameDescription name)
Sets the name of the DataSet to the name specified. |
void |
setVersion(double version)
Sets the version number of the class. |
int |
size()
|
java.lang.String |
toHTMLString(boolean includeHTMLTag,
boolean includeTitle,
java.lang.String formatterMask)
This method will render the data set to an HTML string. |
java.lang.String |
toString()
Returns a String representation of the DataSet. |
java.lang.String |
toString(boolean includeTitle,
java.lang.String formatterMask)
This method will format the data set to a sting, it includes line breaks between data points : |
java.util.List |
write()
Writes the object in question to a List of Strings. |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static double version
public static final int LIMIT_RULE_STATENUMBER
public static final int LIMIT_RULE_NUMERIC_VALUE
Constructor Detail |
---|
public DataSet()
public DataSet(NameDescription name, int connObjectId)
name
- the name of the DataSetconnObjectId
- the ID of the connected objectpublic DataSet(NameDescription name, int connObjectId, java.util.List dataPoints)
name
- the name of the DataSetconnObjectId
- the ID of the connected objectdataPoints
- the DataPoints in the DataSetMethod Detail |
---|
public int getConnObjectId()
public void setConnObjectId(int connObjectId)
connObjectId
- the new connected object ID for the DataSetpublic double getVersion()
Writable
getVersion
in interface Writable
public void setVersion(double version)
Writable
setVersion
in interface Writable
version
- the version numberpublic int getId()
getId
in interface Identifiable
public void setId(int id)
id
- the new ID for the DataSetpublic NameDescription getName()
public void setName(NameDescription name)
name
- the new name for the DataSetpublic java.util.List getDataPoints()
public void setDataPoints(java.util.List dataPoints)
dataPoints
- the List of DataPointspublic void addDataPoint(DataPoint dataPoint)
dataPoint
- the DataPoint to be addedpublic DataPoint addIntervalDataPoint(double lower, double upper)
lower
- the lower bound of the DataPointupper
- the upper bound of the DataPoint
public DataPoint addAbsoluteDataPoint(double value)
value
- the numerical value of the DataPoint
public DataPoint addLabelledDataPoint(java.lang.String label)
label
- the label of the DataPoint
public double[] getAsDoubles()
public void normalise()
public void addDataPoint(DataPoint dataPoint, int orderPos)
dataPoint
- the DataPoint to be addedorderPos
- the position in the List where the DataPoint will be addedpublic DataPoint getDataPointAtOrderPosition(int orderPos) throws MinervaIndexException
orderPos
- the order position of the required DataPoint in the DataSet
MinervaIndexException
- if there is no DataPoint at the specified order positionpublic DataPoint getDataPointWithConnObjectID(int id)
id
- The connObjectID value attempting to match
public DataPoint removeDataPointAtOrderPosition(int orderPos) throws MinervaIndexException
orderPos
- the order position of the required DataPoint in the DataSet
MinervaIndexException
- if there is no DataPoint at the specified order positionpublic void pad(double with, int noOfElements, java.lang.String label, int connObjId)
with
- the value that will be given to each DataPointnoOfElements
- the number of DataPoints to be createdlabel
- the label that will be given to each DataPointconnObjId
- the connected object ID that will be given to each DataPointpublic DataPoint getHighestDataPoint()
public DataPoint getHighestDataPointAdjustedForProbailityMass()
public DataPoint getLowestDataPointAdjustedForProbailityMass()
public DataPoint getLowestDataPoint()
public IntervalDataPoint getIntervalDataPointWithLowestRangeValue()
public IntervalDataPoint getIntervalDataPointWithLowestMidPoint()
public IntervalDataPoint getIntervalDataPointWithHighestMidPoint()
public IntervalDataPoint getIntervalDataPointWithHighestRangeValue()
public double getTotal(int fromPoint, int toPoint)
public double getTotalAdjustedForProbabilityMass(int fromPoint, int toPoint)
fromPoint
- toPoint
-
public void clearDataPoints()
public boolean doDataPointsHaveIntervalLabels()
public java.lang.String toString()
toString
in class java.lang.Object
public int size()
public java.lang.Object clone()
clone
in class java.lang.Object
public java.util.List write() throws MinervaReadWriteException
Writable
write
in interface Writable
MinervaReadWriteException
- if therepublic int read(java.util.List strings, int currentLineNumber) throws MinervaReadWriteException
read
in interface Writable
MinervaReadWriteException
public java.lang.String[] getDataPointLabels() throws MinervaIndexException
MinervaIndexException
public void convertLabelsToScientificFormat(java.lang.String numberMask)
numberMask
- public void convertLabelsToIntegerFormat()
numberMask
- public boolean containsXNoZeroDataPoints(int nonZeroDataPoints)
nonZeroDataPoints
-
public java.lang.String toHTMLString(boolean includeHTMLTag, boolean includeTitle, java.lang.String formatterMask)
includeHTMLTag
- determines whether the string should be begun and ended with includeTitle
- determines whether the data set title should be included at the top
public java.lang.String toString(boolean includeTitle, java.lang.String formatterMask)
includeTitle
- determines whether the data set title should be included at the top
public static DataSet createDataSet(java.lang.String[] dataPointNames)
dataPointNames
-
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |