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

📄 miningautomationcallback.java

📁 一个数据挖掘软件ALPHAMINERR的整个过程的JAVA版源代码
💻 JAVA
字号:
/*
 *    This program is free software; you can redistribute it and/or modify
 *    it under the terms of the GNU General Public License as published by
 *    the Free Software Foundation; either version 2 of the License, or
 *    (at your option) any later version.
 *
 *    This program is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *    GNU General Public License for more details.
 *
 *    You should have received a copy of the GNU General Public License
 *    along with this program; if not, write to the Free Software
 *    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

 /**
  * Title: XELOPES Data Mining Library
  * Description: The XELOPES library is an open platform-independent and data-source-independent library for Embedded Data Mining.
  * Copyright: Copyright (c) 2002 Prudential Systems Software GmbH
  * Company: ZSoft (www.zsoft.ru), Prudsys (www.prudsys.com)
  * @author Valentine Stepanenko (valentine.stepanenko@zsoft.ru)
  * @author Michael Thess
  * @version 1.0
  */
package com.prudsys.pdm.Automat;

import com.prudsys.pdm.Core.MiningAlgorithm;
import com.prudsys.pdm.Core.MiningAlgorithmSpecification;
import com.prudsys.pdm.Core.MiningException;
import com.prudsys.pdm.Core.MiningSettings;

/**
 * If the mining model does not satisfy the given conditions we
 * use this class to recompute algorithm parameters.
 * Here algorithm parameters are the mining settings and the
 * mining algorithm specification of the mining algorithm. <p>
 *
 * In any callback step we have the current algorithm parameters
 * and the current assessment value (from MiningModelAssessment)
 * as input and the next algorithm parameters as output.
 * The process is started by the method calculateNewMiningParameters
 * which internally calls the abstract method runParameterCalculation.
 *
 * @see MiningModelAssessment
 * @see MiningAutomationAssignment
 */
public abstract class MiningAutomationCallback extends com.prudsys.pdm.Cwm.Core.Class
{
    // -----------------------------------------------------------------------
    //  Constants of calculation status
    // -----------------------------------------------------------------------
    public static final int CALCULATION_STATUS_SUCCESSFUL = 0;

    public static final int CALCULATION_STATUS_NO_IMPROVEMENT = -1;

    // -----------------------------------------------------------------------
    //  Variables declarations
    // -----------------------------------------------------------------------
    /** Mining automation assignment for automation specification. */
    protected MiningAutomationAssignment miningAutomationAssignment;

    /** Current assessment value. */
    protected double currentAssessment;

    /** Current mining settings. */
    protected MiningSettings currentMiningSettings;

    /** New mining settings for next algorithm run. */
    protected MiningSettings newMiningSettings;

    /** Current mining algorithm specification. */
    protected MiningAlgorithmSpecification currentMiningAlgorithmSpecification;

    /** New mining algorithm specification for next algorithm run. */
    protected MiningAlgorithmSpecification newMiningAlgorithmSpecification;

    /** Reference to mining algorithm. */
    protected MiningAlgorithm miningAlgorithm;

    // -----------------------------------------------------------------------
    //  Constructor
    // -----------------------------------------------------------------------
    /**
     * Empty constructor.
     */
    public MiningAutomationCallback() {

    }

    // -----------------------------------------------------------------------
    //  Getter and setter methods
    // -----------------------------------------------------------------------
    /**
     * Returns object of automation assignment.
     *
     * @return object of automation assignment
     */
    public MiningAutomationAssignment getMiningAutomationAssignment()
    {
      return miningAutomationAssignment;
    }

    /**
     * Sets object of automation assignment.
     *
     * @param miningAutomationAssignment new object of automation assignment
     */
    public void setMiningAutomationAssignment(MiningAutomationAssignment miningAutomationAssignment)
    {
      this.miningAutomationAssignment = miningAutomationAssignment;
    }

    /**
     * Returns current assessment value.
     *
     * @return current assessment value
     */
    public double getCurrentAssessment()
    {
      return currentAssessment;
    }

    /**
     * Sets current assessment value.
     *
     * @param currentAssessment new current assessment value
     */
    public void setCurrentAssessment(double currentAssessment)
    {
      this.currentAssessment = currentAssessment;
    }

    /**
     * Returns current mining algorithm specification.
     *
     * @return current mining algorithm specification
     */
    public MiningAlgorithmSpecification getCurrentMiningAlgorithmSpecification()
    {
        return currentMiningAlgorithmSpecification;
    }

    /**
     * Returns current mining settings.
     *
     * @return current mining settings
     */
    public MiningSettings getCurrentMiningSettings()
    {
        return currentMiningSettings;
  }

    /**
     * Returns new mining algorithm specification for restarting the algorithm.
     *
     * @return new mining algorithm specification for restarting the algorithm
     */
    public MiningAlgorithmSpecification getNewMiningAlgorithmSpecification()
    {
        return newMiningAlgorithmSpecification;
    }

    /**
     * Returns new mining settings for restarting the algorithm.
     *
     * @return new mining settings for restarting the algorithm
     */
    public MiningSettings getNewMiningSettings()
    {
        return newMiningSettings;
    }

    /**
     * Returns mining algorithm of callback.
     *
     * @return mining algorithm of callback
     */
    public MiningAlgorithm getMiningAlgorithm()
    {
      return miningAlgorithm;
    }

    /**
     * Sets mining algorithm of callback.
     *
     * @param miningAlgorithm new mining algorithm of callback
     */
    public void setMiningAlgorithm(MiningAlgorithm miningAlgorithm)
    {
      this.miningAlgorithm = miningAlgorithm;
    }

    // -----------------------------------------------------------------------
    //  Methods of new parameter calculation
    // -----------------------------------------------------------------------
    /**
     * Calculates new mining parameters. The parameters can be read
     * using the methods getNewMiningSettings and getNewMiningAlgorithmSpecification.
     *
     * @return status of calculation
     * @exception MiningException error during calculation
     */
    protected abstract int runParameterCalculation() throws MiningException;

    /**
     * Calculates new mining parameters. The parameters can be read
     * using the methods getNewMiningSettings and getNewMiningAlgorithmSpecification.
     * Internally uses method runParameterCalculation.
     *
     * @return status of calculation
     * @exception MiningException error during calculation
     */
    public int calculateNewMiningParameters( ) throws MiningException {

      return runParameterCalculation();
    }

}

⌨️ 快捷键说明

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