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

📄 statisticsalgorithm.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 Victor Borichev
 * @version 1.0
 */

package com.prudsys.pdm.Models.Statistics;

import java.util.Vector;

import com.prudsys.pdm.Core.MiningAlgorithm;
import com.prudsys.pdm.Core.MiningAttribute;
import com.prudsys.pdm.Core.MiningException;
import com.prudsys.pdm.Core.MiningModel;
import com.prudsys.pdm.Core.MiningSettings;

/**
 * Base class for statistical algorithms.
 */
public abstract class StatisticsAlgorithm extends MiningAlgorithm
{
    protected MiningAttribute univariateTarget;
    protected MiningAttribute multivariateTarget1;
    protected MiningAttribute multivariateTarget2;
    protected Vector grouping = new Vector();

    /**
     * Sets statistics settings.
     *
     * @param miningSettings new statistics settings
     * @exception IllegalArgumentException mining settings not statistics settings
     */
    public void setMiningSettings( MiningSettings miningSettings ) throws IllegalArgumentException
    {
        if( miningSettings instanceof StatisticsSettings )
        {
            super.setMiningSettings( miningSettings );
            StatisticsSettings statisticsSettings = (StatisticsSettings)miningSettings;
            this.univariateTarget = statisticsSettings.getUnivariateTarget();
            this.multivariateTarget1 = statisticsSettings.getMultivariateTarget1();
            this.multivariateTarget2 = statisticsSettings.getMultivariateTarget2();
            this.grouping = statisticsSettings.getGrouping();
        }
        else
        {
            throw new IllegalArgumentException( "MiningSettings have to be an StatisticsSettings." );
        }
    }

    /**
     * Builds mining model by running the statistics algorithm internally.
     *
     * @return statistics mining model generated by the algorithm
     */
    public MiningModel buildModel() throws MiningException
    {
        long start = ( new java.util.Date() ).getTime();

        runAlgorithm();
        StatisticsMiningModel model = new StatisticsMiningModel();
        model.setMiningSettings( miningSettings );
        model.setInputSpec( applicationInputSpecification );
        model.setRootGroup( getRootGroup() );
        this.miningModel = model;

        long end = ( new java.util.Date() ).getTime();
        timeSpentToBuildModel = ( end - start ) / 1000.0;

        return model;
    }

    /**
     * Runs supervised mining algorithm.
     */
    protected abstract void runAlgorithm() throws MiningException;

    /**
     * Returns root group which allows to travers the complete
     * statistics tree.
     */
    protected abstract Group getRootGroup();

    /**
     * Creates an instance of the statistics settings class that is required
     * to run the algorithm. The mining settings are assigned through the
     * setMiningSettings method.
     *
     * @return new instance of the statistics settings class of the algorithm
     */
    public MiningSettings createMiningSettings() {

      return new StatisticsSettings();
    }

}

⌨️ 快捷键说明

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