|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectJavaML.DatasetDouble
public class DatasetDouble
An implementation of IDataset using doubles
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface JavaML.IOnlineDataset |
---|
IOnlineDataset.DataType, IOnlineDataset.FeatureType |
Constructor Summary | |
---|---|
DatasetDouble(double[][] newFeatureMatrix,
int[] newTargetVector)
Constructor from data |
|
DatasetDouble(double[][] newFeatureMatrix,
int[] newTargetVector,
double[] newDataWeights,
int newTotalWeight)
Constructor from weighted data |
|
DatasetDouble(java.lang.String fileToLoad,
boolean classIsFirst,
boolean weightingIsFirst)
Constructor from file |
Method Summary | |
---|---|
IDataset |
getDataFeatureSubset(int[] featuresRequired)
Returns a new IDataset which contains a subset of the features of the original |
double[][] |
getDataMatrixDouble()
|
IDataset |
getDataSampleSubset(int[] samplesRequired)
Returns a new IDataset which contains a subset of the samples of the original |
IOnlineDataset.DataType |
getDataType()
|
double[] |
getDataWeights()
|
double[] |
getNextDataPoint()
|
int |
getNextTarget()
|
int |
getNumberOfFeatures()
|
int |
getNumberOfSamples()
|
IDataset |
getSampledDataset(double[] distributionOverFeatures,
int sampleSize)
Returns a new IDataset a sampled version of the original, based upon the supplied distribution over examples |
double[] |
getSampleDouble(int sampleNumber,
boolean hasTarget)
|
int[] |
getTargetVector()
|
int |
getTotalWeight()
|
boolean |
hasData()
|
void |
resetDataset()
|
int |
returnCurrentDataSampleNumber()
|
int |
returnCurrentTargetSampleNumber()
|
IDataset |
returnSampledTestingSet(int foldNumber,
int sampleSize)
Returns a new dataset containing fold foldNumber , by sampling from the weight distribution |
IDataset |
returnSampledTrainingSet(int foldNumber,
int sampleSize)
Returns a new dataset without fold foldNumber , by sampling from the weight distribution |
IDataset |
returnWeightedTestingSet(int foldNumber)
Returns a new dataset containing fold foldNumber |
IDataset |
returnWeightedTrainingSet(int foldNumber)
Returns a new dataset without fold foldNumber |
void |
setDataWeights(double[] newWeights)
Assigns the newWeights to the data weights. |
void |
setRandomSeed(long newSeed)
|
void |
splitIntoFolds(int newNumberOfFolds)
Prepares the dataset to be split into newNumberOfFolds folds, all previous splits are forgotten
MUST BE CALLED before using any other folds function |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DatasetDouble(java.lang.String fileToLoad, boolean classIsFirst, boolean weightingIsFirst)
fileToLoad
- is the path of the csv file to read inclassIsFirst
- specifies if the class label is at the start or the end of the fileweightingIsFirst
- specifies if the file has example weights (appears before the class label if so)public DatasetDouble(double[][] newFeatureMatrix, int[] newTargetVector)
newFeatureMatrix
- is the new feature matrix, must have the same number of examples as newTargetVector
newTargetVector
- is the new list of targetspublic DatasetDouble(double[][] newFeatureMatrix, int[] newTargetVector, double[] newDataWeights, int newTotalWeight)
newFeatureMatrix
- is the new feature matrix, must have the same number of examples as newTargetVector
newTargetVector
- is the new list of targetsnewDataWeights
- is the new list of weightsnewTotalWeight
- is the sum of all the weightsMethod Detail |
---|
public double[][] getDataMatrixDouble()
getDataMatrixDouble
in interface IDataset
public int[] getTargetVector()
getTargetVector
in interface IDataset
public double[] getSampleDouble(int sampleNumber, boolean hasTarget)
getSampleDouble
in interface IDataset
public double[] getDataWeights()
getDataWeights
in interface IDataset
public void setDataWeights(double[] newWeights)
setDataWeights
in interface IDataset
public int getTotalWeight()
getTotalWeight
in interface IDataset
public IDataset getDataFeatureSubset(int[] featuresRequired)
getDataFeatureSubset
in interface IDataset
featuresRequired
- is a vector of required features, all values must be < numberOfFeatures
public IDataset getDataSampleSubset(int[] samplesRequired)
getDataSampleSubset
in interface IDataset
samplesRequired
- is a vector of required samples, all values must be < numberOfSamples
public IDataset getSampledDataset(double[] distributionOverFeatures, int sampleSize)
getSampledDataset
in interface IDataset
distributionOverFeatures
- is a distribution vector, with length equal to the numberOfSamplessampleSize
- is the number of datapoints in the new IDatasetpublic double[] getNextDataPoint()
getNextDataPoint
in interface IOnlineDataset
public int getNextTarget()
getNextTarget
in interface IOnlineDataset
public int returnCurrentDataSampleNumber()
returnCurrentDataSampleNumber
in interface IOnlineDataset
public int returnCurrentTargetSampleNumber()
returnCurrentTargetSampleNumber
in interface IOnlineDataset
public void resetDataset()
resetDataset
in interface IOnlineDataset
public void splitIntoFolds(int newNumberOfFolds)
newNumberOfFolds
folds, all previous splits are forgotten
MUST BE CALLED before using any other folds function
splitIntoFolds
in interface IDataset
newNumberOfFolds
- is the number of folds requiredpublic IDataset returnWeightedTrainingSet(int foldNumber)
foldNumber
returnWeightedTrainingSet
in interface IDataset
foldNumber
- is the current testing foldpublic IDataset returnWeightedTestingSet(int foldNumber)
foldNumber
returnWeightedTestingSet
in interface IDataset
foldNumber
- is the current testing foldpublic IDataset returnSampledTrainingSet(int foldNumber, int sampleSize)
foldNumber
, by sampling from the weight distribution
returnSampledTrainingSet
in interface IDataset
foldNumber
- is the current testing foldsampleSize
- is the number of examples in the new datasetpublic IDataset returnSampledTestingSet(int foldNumber, int sampleSize)
foldNumber
, by sampling from the weight distribution
returnSampledTestingSet
in interface IDataset
foldNumber
- is the current testing foldsampleSize
- is the number of examples in the new datasetpublic void setRandomSeed(long newSeed)
setRandomSeed
in interface IOnlineDataset
public IOnlineDataset.DataType getDataType()
getDataType
in interface IOnlineDataset
public int getNumberOfFeatures()
getNumberOfFeatures
in interface IOnlineDataset
public int getNumberOfSamples()
getNumberOfSamples
in interface IOnlineDataset
public boolean hasData()
hasData
in interface IOnlineDataset
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |