⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 inducer.java

📁 java数据挖掘算法
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
*****************************************************************************/
   public double project_train_and_test_files(String fileStem, 
                                     String namesExtension, 
                                     String dataExtension, 
                                     boolean[] bitString)
   {
      return project_train_and_test_files(fileStem,namesExtension,
                       dataExtension,
                       Globals.DEFAULT_TEST_EXT,bitString);
   }

/*****************************************************************************
  Reads the training and test files in, trains the inducer, and tests the 
inducer on the attributes specified by the bit string input.
@param fileStem The name of the names, data, and test files without the
                the file extensions.
@param namesExtension	The extension used for the names file. Should
					begin with a period.
@param dataExtension	The extension used for the data file. Should
					begin with a period.
@param testExtension	The extension used for the test file. Should
					begin with a period.
@param bitString		A boolean array with the same number of values as 
					there are attributes. Each boolean element 
					corresponds to an attribute in the order they 
					were input. True values represent attributes 
					that are used.
@return The probability of incorrect test responses. Possible values
        are 0.0 to 1.0.
*****************************************************************************/
   public double project_train_and_test_files(String fileStem, 
                                     String namesExtension, 
                                     String dataExtension, 
                                     String testExtension, 
                                     boolean[] bitString)
   {
      InstanceList trainList = new InstanceList(Globals.EMPTY_STRING, 
                                                fileStem + namesExtension,
						fileStem + dataExtension);
      InstanceList testList = new InstanceList(trainList.get_schema(),
         trainList.get_original_schema(),
         fileStem + testExtension);
      return train_and_test(trainList.project(bitString), 
                            testList.project(bitString));

   }

/*****************************************************************************
  Train and tests this inducer on the attributes specified. Uses the 
train_and_perf method, so this method will be specific to the induction 
algorithm of the subclass.
@param trainingSet	The data set used to train this inducer.
@param testSet		The data set used to test this inducer.
@param bitString		A boolean array with the same number of values as 
					there are attributes. Each boolean element 
					corresponds to an attribute in the order they 
					were input. True values represent attributes 
					that are used.
@return The CatTestResult object containing results for this inducer.
*****************************************************************************/
   public CatTestResult project_train_and_perf(InstanceList trainingSet, 
                                        InstanceList testSet, 
                                        boolean[] bitString)
   {
      return train_and_perf(trainingSet.project(bitString),
                            testSet.project(bitString));
   }

/*****************************************************************************
  Reads the training and test files in, trains the inducer, and tests the 
inducer on the attributes specified by the bit string input.
@param fileStem The name of the names, data, and test files without the
                the file extensions.
@param namesExtension	The extension used for the names file. Should
					begin with a period.
@param dataExtension	The extension used for the data file. Should
					begin with a period.
@param testExtension	The extension used for the test file. Should
					begin with a period.
@param bitString		A boolean array with the same number of values as 
					there are attributes. Each boolean element 
					corresponds to an attribute in the order they 
					were input. True values represent attributes 
					that are used.
@return The CatTestResult object containing results for this inducer.
*****************************************************************************/
   public CatTestResult project_train_and_perf_files(String fileStem, 
                                     String namesExtension, 
                                     String dataExtension, 
                                     String testExtension, 
                                     boolean[] bitString)
   {
      InstanceList trainList = new InstanceList(Globals.EMPTY_STRING, 
                                                fileStem + namesExtension,
						fileStem + dataExtension);
      InstanceList testList = new InstanceList(trainList.get_schema(),
         trainList.get_original_schema(),
         fileStem + testExtension);
      return train_and_perf(trainList.project(bitString), 
                            testList.project(bitString));

   }

/*****************************************************************************
  Reads the training and test files in, trains the inducer, and tests the 
inducer on the attributes specified by the bit string input.
@param fileStem The name of the names, data, and test files without the
                the file extensions.
@param bitString		A boolean array with the same number of values as 
					there are attributes. Each boolean element 
					corresponds to an attribute in the order they 
					were input. True values represent attributes 
					that are used.
@return The CatTestResult object containing results for this inducer.
*****************************************************************************/
   public CatTestResult project_train_and_perf_files(String fileStem , 
                                              boolean[] bitString)
   {
      return project_train_and_perf_files(fileStem,Globals.DEFAULT_NAMES_EXT,
                       Globals.DEFAULT_DATA_EXT,
                       Globals.DEFAULT_TEST_EXT,bitString);
   }

/*****************************************************************************
  Reads the training and test files in, trains the inducer, and tests the 
inducer on the attributes specified by the bit string input.
@param fileStem The name of the names, data, and test files without the
                the file extensions.
@param namesExtension	The extension used for the names file. Should
					begin with a period.
@param bitString		A boolean array with the same number of values as 
					there are attributes. Each boolean element 
					corresponds to an attribute in the order they 
					were input. True values represent attributes 
					that are used.
@return The CatTestResult object containing results for this inducer.
*****************************************************************************/
   public CatTestResult project_train_and_perf_files(String fileStem, 
                                     String namesExtension, 
                                     boolean[] bitString)
   {
      return project_train_and_perf_files(fileStem,namesExtension,
                       Globals.DEFAULT_DATA_EXT,
                       Globals.DEFAULT_TEST_EXT,bitString);
   }

/*****************************************************************************
  Reads the training and test files in, trains the inducer, and tests the 
inducer on the attributes specified by the bit string input.
@param fileStem The name of the names, data, and test files without the
                the file extensions.
@param namesExtension	The extension used for the names file. Should
					begin with a period.
@param dataExtension	The extension used for the data file. Should
					begin with a period.
@param bitString		A boolean array with the same number of values as 
					there are attributes. Each boolean element 
					corresponds to an attribute in the order they 
					were input. True values represent attributes 
					that are used.
@return The probability of incorrect test responses. Possible values
        are 0.0 to 1.0.
*****************************************************************************/
   public CatTestResult project_train_and_perf_files(String fileStem, 
                                     String namesExtension, 
                                     String dataExtension, 
                                     boolean[] bitString)
   {
      return project_train_and_perf_files(fileStem,namesExtension,
                       dataExtension,
                       Globals.DEFAULT_TEST_EXT,bitString);
   }


/*****************************************************************************
  Returns the Categorizer trained and removes ownership by this Inducer 
object.
@return The Categorizer trained.
*****************************************************************************/
   abstract public Categorizer release_categorizer();

/*****************************************************************************
  Checks if this Inducer object can be cast to an Inducer.
@return TRUE if this object can be cast to an Inducer, FALSE otherwise.
*****************************************************************************/
   public boolean can_cast_to_inducer()
   {
      return true;
   }

   /** Casts this object to an Inducer class.
    * @returns This object as an Inducer object.
    * @return Returns an Inducer reference to this object.
    */
   public Inducer cast_to_inducer() 
   {
   // Note that a class may override can_cast_to_inducer(), so this
   //   ensures consistency and avoids the need to override cast_to_inducer().
   //   This happens in wrapper inducers that may or may not wrap around
   //   a real inducer.
      if (!can_cast_to_inducer())
         Error.fatalErr("Inducer "+description()+" (class id " + class_id()
            +") cannot be cast into an inducer");
      return (Inducer)this;
   }

/*****************************************************************************
     These two methods are needed to extract information from tree inducers.
     Other inducers may only have to return 0 if they produce no tree.
*****************************************************************************/
     public abstract int num_nontrivial_nodes();
     public abstract int num_nontrivial_leaves();
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -