Class ClassStratiFileAssigner
- java.lang.Object
-
- ai.libs.jaicore.ml.core.dataset.sampling.infiles.stratified.sampling.ClassStratiFileAssigner
-
- All Implemented Interfaces:
IStratiFileAssigner
public class ClassStratiFileAssigner extends java.lang.Object implements IStratiFileAssigner
-
-
Constructor Summary
Constructors Constructor Description ClassStratiFileAssigner()Constructor without a given target attribute.ClassStratiFileAssigner(int targetAttribute)Constructor with a given target attribute.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidassignDatapoint(java.lang.String datapoint)Select the suitable stratum for a datapoint and write it into the corresponding temporary file.java.util.Map<java.lang.String,java.lang.Integer>getAllCreatedStrati()Get the used strati temporary files and the amount of datapoints inside of it.voidsetArffHeader(java.lang.String arffHeader)Set the header of the original ARFF input file.voidsetTempFileHandler(ai.libs.jaicore.basic.TempFileHandler tempFileHandler)Set the temporary file handler, which will be used to manage the temporary files for the strati.
-
-
-
Constructor Detail
-
ClassStratiFileAssigner
public ClassStratiFileAssigner(int targetAttribute)
Constructor with a given target attribute.- Parameters:
targetAttribute- Index of the target attribute.
-
ClassStratiFileAssigner
public ClassStratiFileAssigner()
Constructor without a given target attribute. The last feature will be used.
-
-
Method Detail
-
setTempFileHandler
public void setTempFileHandler(ai.libs.jaicore.basic.TempFileHandler tempFileHandler)
Description copied from interface:IStratiFileAssignerSet the temporary file handler, which will be used to manage the temporary files for the strati.- Specified by:
setTempFileHandlerin interfaceIStratiFileAssigner- Parameters:
tempFileHandler- Temporary File Handler to manage the files.
-
setArffHeader
public void setArffHeader(java.lang.String arffHeader)
Description copied from interface:IStratiFileAssignerSet the header of the original ARFF input file. It has to be written on top of each temporary file. Besides of that it can be used to extract meta data about the dataset if needed.- Specified by:
setArffHeaderin interfaceIStratiFileAssigner- Parameters:
arffHeader- ARFF header lines as a string.
-
assignDatapoint
public void assignDatapoint(java.lang.String datapoint) throws ai.libs.jaicore.basic.algorithm.exceptions.AlgorithmExceptionDescription copied from interface:IStratiFileAssignerSelect the suitable stratum for a datapoint and write it into the corresponding temporary file.- Specified by:
assignDatapointin interfaceIStratiFileAssigner- Parameters:
datapoint- String representation of the datapoint taken from the input file.- Throws:
ai.libs.jaicore.basic.algorithm.exceptions.AlgorithmException- The datapoint representation was invalid or it could not be assigned to a stratum.
-
getAllCreatedStrati
public java.util.Map<java.lang.String,java.lang.Integer> getAllCreatedStrati()
Description copied from interface:IStratiFileAssignerGet the used strati temporary files and the amount of datapoints inside of it.- Specified by:
getAllCreatedStratiin interfaceIStratiFileAssigner- Returns:
- Mapping from UUID of the temporary file of a strati to the number of datapoints written into it.
-
-