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

📄 ruleslist.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 Stefan Ludwig
 * @author Michael Thess
 * @author Valentine Stepanenko (valentine.stepanenko@zsoft.ru)
 * @version 1.2
 */

package com.prudsys.pdm.Models.Classification.Rules;

import java.util.Vector;

import com.prudsys.pdm.Core.MiningException;
import com.prudsys.pdm.Core.MiningMatrixElement;
import com.prudsys.pdm.Input.MiningVector;
import com.prudsys.pdm.Models.Supervised.Classifier;

/**
 * Class representing a list of classification rules.  <p>
 *
 * From PDM CWM extension.
 *
 * @see com.prudsys.pdm.Input.Predicates.Predicate
 */
public class RulesList extends com.prudsys.pdm.Cwm.Core.Class implements Classifier, MiningMatrixElement
{
    // -----------------------------------------------------------------------
    //  Variables declarations
    // -----------------------------------------------------------------------
    /** Vector of rules. */
    public Vector rules = new Vector();

    // -----------------------------------------------------------------------
    //  Constructors
    // -----------------------------------------------------------------------
    /**
     * Empty constructor.
     */
    public RulesList()
    {
    }

    /**
     * Constructs rules list from vector of rules.
     *
     * @param rules vector of rules
     */
    public RulesList(Vector rules)
    {
       this.rules = rules;
    }

    // -----------------------------------------------------------------------
    //  Getter and setter methods
    // -----------------------------------------------------------------------
    /**
     * Returns number of rules.
     *
     * @return number of rules
     */
    public int getNumberOfRules()
    {
       return rules.size();
    }

    /**
    * Get the rules.
    *
    * @return vector of rules
    */
    public Vector getRules()
    {
        return rules;
    }

    /**
     * Sets rules.
     *
     * @param rules new vector of rules
     */
    public void setRules(Vector rules)
    {
        this.rules = rules;
    }

    /**
     * Returns rule at given position.
     *
     * @param pos position of rule
     * @return rule at given position
     */
    public Rule getRuleAt(int pos)
    {
        return (Rule) rules.elementAt(pos);
    }

    // -----------------------------------------------------------------------
    //  Apply tree node to mining vector
    // -----------------------------------------------------------------------
    /**
     * Applies rules to miningVector and returns score value.
     *
     * @param miningVector vector to be classified
     * @return score value of classfication
     * @throws MiningException could not run this method
     */
    public double apply( MiningVector miningVector ) throws MiningException
    {
      for (int i = 0; i < rules.size(); i++) {
        return 0;
      }

      return 0;
    }

    //<<17/03/2005, Frank J. Xu
    //Do not add any changes for the current version except implementing the interface.
    // -----------------------------------------------------------------------
    //  Apply tree node to mining vector
    // -----------------------------------------------------------------------
    /**
     * Applies rules to miningVector and returns score value.
     *
     * @param miningVector vector to be classified
     * @return score value of classfication
     * @throws MiningException could not run this method
     */
    public double apply( MiningVector miningVector, Object a_wekaInstances) throws MiningException
    {
      for (int i = 0; i < rules.size(); i++) {
        return 0;
      }

      return 0;
    }
    //17/03/2005, Frank J. Xu>>
    
    // -----------------------------------------------------------------------
    //  java.lang.Object methods
    // -----------------------------------------------------------------------
    /**
    * String representation of rules list.
    *
    * @return String representation of rules list
    */
    public String toString()
    {
        String text = "";
        for (int i = 0; i < rules.size(); i++)
          text = text + rules.elementAt(i).toString() +"\n";
        return text;
    }

    /**
    * Prints the rules list.
    */
    public void print()
    {
        System.out.println( toString() );
    }
}

⌨️ 快捷键说明

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