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

📄 hierarchicalclusteringminingmodel.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 Michael Thess
 * @version 1.1
 */

package com.prudsys.pdm.Models.Clustering.Hierarchical;

import java.io.Reader;
import java.io.Writer;
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.Clustering.ClusteringMiningModel;

/**
  * Description of data produced by a hierarchical clustering mining function. <p>
  *
  * From PDM CWM extension. <p>
  *
  * Superclasses:
  * <ul>
  *   <li> ClusteringMiningModel
  * </ul>
  */
public class HierarchicalClusteringMiningModel extends ClusteringMiningModel
{
    // -----------------------------------------------------------------------
    //  Constructor
    // -----------------------------------------------------------------------
    /**
     * Constructor sets function and algorithm parameters.
     */
    public HierarchicalClusteringMiningModel()
    {
        function  = CLUSTERING_FUNCTION;
        algorithm = HIERARCHICAL_CLUSTERING_ALGORITHM;
    }

    // -----------------------------------------------------------------------
    //  Getter and setter methods
    // -----------------------------------------------------------------------
    /**
     * Returns array of all those hierarchical cluster
     * whose merging distance is smaller the given threshold.
     *
     * @param threshold threshold for cluster selection
     * @return array of all cluster which meet the threshold condition
     */
    public HierarchicalCluster[] getClustersByThreshold(double threshold) {

      if (clusters == null || threshold  < 0.0)
        return null;

      Vector tclust = new Vector();
      for (int i = 0; i < clusters.length; i++) {
        if ( ((HierarchicalCluster) clusters[i]).getMergingDistance() < threshold)
          tclust.addElement(clusters[i]);
      };

      HierarchicalCluster[] hc = new HierarchicalCluster[ tclust.size() ];
      for (int i = 0; i < tclust.size(); i++)
        hc[i] = (HierarchicalCluster) tclust.elementAt(i);

      return hc;
    }

    // -----------------------------------------------------------------------
    //  Apply model to new data
    // -----------------------------------------------------------------------
    /**
     * Applies function of clustering mining model to a mining vector.
     * The meta data of the mining vector should be similar to the
     * metaData of this class. This ensures compatibility of training
     * and application data.
     * Not implemented.
     *
     * @param miningVector mining vector where the model should be applied
     * @return function value of the mining vector
     * @throws MiningException always thrown
     */
    public double applyModelFunction(MiningVector miningVector)
        throws MiningException {
      throw new MiningException("Not implemented.");
    }

    /**
     * General function of applying the clustering mining model to some data.
     * Not implemented.
     *
     * @param miningData mining data where the model should be applied
     * @return data resulting from the model application
     * @throws MiningException always thrown
     */
    public MiningMatrixElement applyModel(MiningMatrixElement miningData)
        throws MiningException {
      throw new MiningException("Not implemented.");
    }

    // -----------------------------------------------------------------------
    //  Methods of PMML handling
    // -----------------------------------------------------------------------
    /**
     * Write clustering model to PMML document. Not supported, exception is
     * always thrown.
     *
     * @param writer writer for the PMML document
     * @exception MiningException always thrown
     */
    public void writePmml( Writer writer ) throws MiningException
    {
        throw new MiningException( "Not realized yet." );
    }

    /**
     * Read clustering model from PMML document. Not supported, exception is
     * always thrown.
     *
     * @param reader reader for the PMML document
     * @exception MiningException always thrown
     */
    public void readPmml( Reader reader ) throws MiningException
    {
        throw new MiningException( "Not realized yet." );
    }

    /**
     * Write clustering model to PMML element. Not supported, exception is
     * always thrown.
     *
     * @return PMML element of clustering model
     * @exception MiningException always thrown
     */
    public Object createPmmlObject() throws MiningException
    {
        throw new MiningException( "Not realized yet." );
    }

    /**
     * Read clustering model from PMML element. Not supported, exception is
     * always thrown.
     *
     * @param pmmlObject PMML element to read in
     * @exception MiningException always thrown
     */
    public void parsePmmlObject( Object pmmlObject ) throws MiningException
    {
        throw new MiningException( "Not realized yet." );
    }

    // -----------------------------------------------------------------------
    //  Other export methods
    // -----------------------------------------------------------------------
    /**
     * Write clustering model as plain text. Not supported, exception is
     * always thrown.
     *
     * @param writer writer for plain text
     * @exception MiningException always thrown
     */
    public void writePlainText( Writer writer ) throws MiningException
    {
        throw new MiningException( "Not realized yet." );
    }

    /**
     * Returns string representation (just few words).
     *
     * @return string representation
     */
    public String toString()
    {
        return "Hierarchical clustering mining model";
    }

    /**
     * Returns HTML representation of clustering model.
     *
     * @return HTML string representation of clustering model
     */
    public String toHtmlString()
    {
        return toString();
    }
}

⌨️ 快捷键说明

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