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

📄 supervisedminingsettings.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)
 * @version 1.0
 */

package com.prudsys.pdm.Models.Supervised;

import com.prudsys.pdm.Core.MiningAttribute;
import com.prudsys.pdm.Core.MiningSettings;

/**
  * Parameters for computing a supervised model, i.e., one that requires a target
  * attribute against which to measure model accuracy. <p>
  *
  * From CWM Data Mining. <p>
  *
  * Superclasses:
  * <ul>
  *   <li> MiningSettings
  * </ul>
  * Attributes:
  * <ul>
  *   <li> <i>confidenceAttributeName</i>: Attribute name for output of confidence values
  *   of the prediction. <br>
  *     - type: String <br>
  *     - multiplicity: exactly one
  *   <li> <i>predictedAttributeName</i>: Attribute name for output of predicted values. <br>
  *     - type: String <br>
  *     - multiplicity: exactly one
  *   <li> <i>costFunction</i>: Function specifying the cost of incorrect predictions.
  *   Predefined methods are: entropy, Gini, costMatrix, pnorm, none.
  * </ul>
  * References:
  * <ul>
  *   <li> <i>target</i>: Reference MiningAttribute as Target. <br>
  *       - class: MiningAttribute <br>
  *       - defined by: UsesAsTarget::target <br>
  *       - multiplicity: exactly one
  * </ul>
  *
  * @see MiningAttribute
  */
public class SupervisedMiningSettings extends MiningSettings
{
    // -----------------------------------------------------------------------
    //  Constants representing cost functions
    // -----------------------------------------------------------------------
    public static final String COST_FUNCTION_ENTROPY = "entropy";
    public static final String COST_FUNCTION_GINI = "Gini";
    public static final String COST_FUNCTION_COSTMATRIX = "costMatrix";
    public static final String COST_FUNCTION_PNORM = "pnorm";
    public static final String COST_FUNCTION_NONE = "none";

    // -----------------------------------------------------------------------
    //  Variables declarations
    // -----------------------------------------------------------------------
    /**
     * Attribute name for output of confidence values of the prediction.
     */
    protected String confidenceAttributeName = null;

    /**
     * Attribute name for output of predicted values.
     */
    protected String predictedAttributeName = null;

    /**
     * Function specifying the cost of incorrect predictions. Predefined methods are:
     * entropy, Gini, costMatrix, pnorm, none.
     */
    protected String costFunction = COST_FUNCTION_NONE;

    /**
     * Target attribute.
     */
    protected MiningAttribute target = null;

    // -----------------------------------------------------------------------
    //  Constructor
    // -----------------------------------------------------------------------
    /**
     * Empty constructor.
     */
    public SupervisedMiningSettings()
    {
    }

    // -----------------------------------------------------------------------
    //  Getter and setter methods
    // -----------------------------------------------------------------------
    /**
     * Returns name of confidence attribute.
     *
     * @return name of confidence attribute
     */
    public String getConfidenceAttributeName()
    {
        return confidenceAttributeName;
    }

    /**
     * Sets name of confidence attribute.
     *
     * @param confidenceAttributeName new name of confidence attribute
     */
    public void setConfidenceAttributeName(String confidenceAttributeName)
    {
        this.confidenceAttributeName = confidenceAttributeName;
    }

    /**
     * Returns cost function.
     *
     * @return cost function
     */
    public String getCostFunction()
    {
        return costFunction;
    }

    /**
     * Sets cost function.
     *
     * @param costFunction new cost function
     */
    public void setCostFunction(String costFunction)
    {
        this.costFunction = costFunction;
    }

    /**
     * Returns predicted attribute name.
     *
     * @return predicted attribute name
     */
    public String getPredictedAttributeName()
    {
        return predictedAttributeName;
    }

    /**
     * Sets predicted attribute name.
     *
     * @param predictedAttributeName new name of predicted attribute
     */
    public void setPredictedAttributeName(String predictedAttributeName)
    {
        this.predictedAttributeName = predictedAttributeName;
    }

    /**
     * Returns target mining attribute.
     *
     * @return target mining attribute
     */
    public MiningAttribute getTarget()
    {
        return target;
    }

    /**
     * Sets new target mining attribute.
     *
     * @param target new target mining attribute
     */
    public void setTarget(MiningAttribute target)
    {
        this.target = target;
    }

    // -----------------------------------------------------------------------
    //  Verify settings
    // -----------------------------------------------------------------------
    /**
     * Verify settings. Call super class method (of MiningSettings) for
     * verifying settings and checks whether the target attribute
     * is defined. If settings are incomplete an illegal argument exception
     * is thrown.
     *
     * @exception IllegalArgumentException exception that is thrown for incomplete settings
     */
    public void verifySettings() throws IllegalArgumentException
    {
        super.verifySettings();
        if( target == null )
        {
            throw new IllegalArgumentException( "Attribute target can't be null." );
        }
    }

    // -----------------------------------------------------------------------
    //  Export methods
    // -----------------------------------------------------------------------
    /**
     * Returns string representation of supervised mining settings.
     *
     * @return string representation of supervised mining settings
     */
    public String toString()
    {
        return "Supervised";
    }

    /**
     * Returns HTML string representation of supervised mining settings.
     *
     * @return HTML string representation of supervised mining settings
     */
    public String toHtmlString()
    {
        String description = "Model:&nbsp;Supervised<br>" +
        "<a href=http://this?Target>Target attribute&nbsp;=&nbsp;<font color=red><b>" + target + "</b></color></a>";
        return description;
    }

}

⌨️ 快捷键说明

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