Documentation of 'org.encog.app.analyst.csv.balance.BalanceCSV' Java class
BalanceCSV
org.encog.app.analyst.csv.balance

Class BalanceCSV

  • All Implemented Interfaces:
    QuantTask


    public class BalanceCSV
    extends BasicFile
    Balance a CSV file. This utility is useful when you have several an unbalanced training set. You may have a large number of one particular class, and many fewer elements of other classes. This can hinder many Machine Learning methods. This class can be used to balance the data. Obviously this class cannot generate data. You must request how many items you want per class. Some classes will have lower than this number if they were already below the specified amount. Any class above this amount will be trimmed to that amount.
    • Constructor Detail

      • BalanceCSV

        public BalanceCSV()
    • Method Detail

      • analyze

        public void analyze(java.io.File inputFile,
                            boolean headers,
                            CSVFormat format)
        Analyze the data. This counts the records and prepares the data to be processed.
        Parameters:
        inputFile - The input file to process.
        headers - True, if headers are present.
        format - The format of the CSV file.
      • dumpCounts

        public java.lang.String dumpCounts()
        Return a string that lists the counts per class.
        Returns:
        The counts per class.
      • getCounts

        public java.util.Map<java.lang.String,java.lang.Integer> getCounts()
        Returns:
        Tracks the counts of each class.
      • process

        public void process(java.io.File outputFile,
                            int targetField,
                            int countPer)
        Process and balance the data.
        Parameters:
        outputFile - The output file to write data to.
        targetField - The field that is being balanced, this field determines the classes.
        countPer - The desired count per class.

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.