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

📄 lookupservice.java

📁 一个数据挖掘软件ALPHAMINERR的整个过程的JAVA版源代码
💻 JAVA
📖 第 1 页 / 共 4 页
字号:
/*
 *    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.1
  */

package com.prudsys.pdm.Adapters.ServiceAPI;

import java.io.*;
import java.util.*;

import com.prudsys.pdm.Core.*;
import com.prudsys.pdm.Models.AssociationRules.AssociationRulesSettings;
import com.prudsys.pdm.Models.Sequential.SequentialSettings;
import com.prudsys.pdm.Models.CustomerSeq.CustomerSequentialSettings;
import com.prudsys.pdm.Models.Supervised.SupervisedMiningSettings;
import com.prudsys.pdm.Models.Classification.ClassificationSettings;
import com.prudsys.pdm.Models.Classification.DecisionTree.DecisionTreeSettings;
import com.prudsys.pdm.Models.Regression.RegressionSettings;
import com.prudsys.pdm.Models.Regression.SparseGrids.SparseGridsSettings;
import com.prudsys.pdm.Models.Regression.SVM.SupportVectorSettings;
import com.prudsys.pdm.Models.TimeSeriesPredict.TimeSeriesMiningSettings;
import com.prudsys.pdm.Models.Statistics.StatisticsSettings;
import com.prudsys.pdm.Models.Clustering.ClusteringSettings;
import com.prudsys.pdm.Models.Clustering.CDBased.CDBasedClusteringSettings;
import com.prudsys.pdm.Models.Clustering.Hierarchical.HierarchicalClusteringSettings;
import com.prudsys.pdm.Models.Clustering.Partitioning.PartitioningClusteringSettings;
import com.prudsys.pdm.Models.Regression.NeuralNetwork.NeuralNetworkSettings;


/**
 * Automatically detects algorithm ressources.
 */
public class LookupService {

  /**
   * Empty constructor.
   */
  public LookupService() {
  }

  /**
   * Returns representation of a mining settings instance in terms of an array
   * of service algorithm parameters.
   *
   * @param settings instance of mining settings
   * @return representation as array of algorithm parameters
   * @throws MiningException unknown class of mining settings
   */
  public static ServiceAlgorithmParameter[] buildAlgorithmParamFromMiningSettings(MiningSettings settings)
    throws MiningException {

    Vector<ServiceAlgorithmParameter[]> sapVec = new Vector<ServiceAlgorithmParameter[]>();

    if ( settings instanceof AssociationRulesSettings )
    {
      ServiceAlgorithmParameter[] sap = null;
      int npar = 4;
      sap = new ServiceAlgorithmParameter[npar];
      for (int i = 0; i < npar; i++) {
        sap[i] = new ServiceAlgorithmParameter();
        sap[i].setValue("");
        sap[i].setDomain(0);
        sap[i].setID("");
        sap[i].setChildIDs("");
      };

      sap[0].setName("minimumSupport");
      sap[0].setType("double");
      sap[0].setDescription("minimum support");
      sap[0].setStatus(0);

      sap[1].setName("minimumConfidence");
      sap[1].setType("double");
      sap[1].setDescription("minimum confidence");
      sap[1].setStatus(0);

      sap[2].setName("itemIdName");
      sap[2].setType("java.lang.String");
      sap[2].setDescription("name of item ID attribute");
      sap[2].setStatus(1);

      sap[3].setName("transactionIdName");
      sap[3].setType("java.lang.String");
      sap[3].setDescription("name of transaction ID attribute");
      sap[3].setStatus(1);

      sapVec.addElement(sap);
    }
    if ( settings instanceof SequentialSettings )
    {
      ServiceAlgorithmParameter[] sap = null;
      int npar = 6;
      sap = new ServiceAlgorithmParameter[npar];
      for (int i = 0; i < npar; i++) {
        sap[i] = new ServiceAlgorithmParameter();
        sap[i].setValue("");
        sap[i].setDomain(0);
        sap[i].setID("");
        sap[i].setChildIDs("");
      };

      sap[0].setName("minimumSupport");
      sap[0].setType("double");
      sap[0].setDescription("minimum support");
      sap[0].setStatus(0);

      sap[1].setName("generateRules");
      sap[1].setType("double");
      sap[1].setValue("false");
      sap[1].setDescription("generate rules from sequences");
      sap[1].setStatus(0);

      sap[2].setName("minimumConfidence");
      sap[2].setType("double");
      sap[2].setDescription("minimum confidence");
      sap[2].setStatus(0);

      sap[3].setName("itemIdName");
      sap[3].setType("java.lang.String");
      sap[3].setDescription("name of item ID attribute");
      sap[3].setStatus(1);

      sap[4].setName("transactionIdName");
      sap[4].setType("java.lang.String");
      sap[4].setDescription("name of transaction ID attribute");
      sap[4].setStatus(1);

      sap[5].setName("itemIndexName");
      sap[5].setType("java.lang.String");
      sap[5].setDescription("name of item index attribute");
      sap[5].setStatus(1);

      sapVec.addElement(sap);
    }
    if ( settings instanceof CustomerSequentialSettings )
    {
      ServiceAlgorithmParameter[] sap = null;
      int npar = 6;
      sap = new ServiceAlgorithmParameter[npar];
      for (int i = 0; i < npar; i++) {
        sap[i] = new ServiceAlgorithmParameter();
        sap[i].setValue("");
        sap[i].setDomain(0);
        sap[i].setID("");
        sap[i].setChildIDs("");
      };

      sap[0].setName("minimumSupport");
      sap[0].setType("double");
      sap[0].setDescription("minimum support");
      sap[0].setStatus(0);

      sap[1].setName("generateRules");
      sap[1].setType("boolean");
      sap[1].setValue("false");
      sap[1].setDescription("generate rules from customer sequences");
      sap[1].setStatus(0);

      sap[2].setName("minimumConfidence");
      sap[2].setType("double");
      sap[2].setDescription("minimum confidence");
      sap[2].setStatus(0);

      sap[3].setName("itemIdName");
      sap[3].setType("java.lang.String");
      sap[3].setDescription("name of item ID attribute");
      sap[3].setStatus(1);

      sap[4].setName("transactionPositionName");
      sap[4].setType("java.lang.String");
      sap[4].setDescription("name of transaction position attribute");
      sap[4].setStatus(1);

      sap[5].setName("customerIdName");
      sap[5].setType("java.lang.String");
      sap[5].setDescription("name of customer ID attribute");
      sap[5].setStatus(1);

      sapVec.addElement(sap);
    }
    if ( settings instanceof SupervisedMiningSettings )
    {
      ServiceAlgorithmParameter[] sap = null;
      int npar = 4;
      sap = new ServiceAlgorithmParameter[npar];
      for (int i = 0; i < npar; i++) {
        sap[i] = new ServiceAlgorithmParameter();
        sap[i].setValue("");
        sap[i].setDomain(0);
        sap[i].setID("");
        sap[i].setChildIDs("");
      };

      sap[0].setName("confidenceAttributeName");
      sap[0].setType("java.lang.String");
      sap[0].setDescription("name of confidence attribute for prediction");
      sap[0].setStatus(0);

      sap[1].setName("predictedAttributeName");
      sap[1].setType("java.lang.String");
      sap[1].setDescription("attribute name for output of predicted values");
      sap[1].setStatus(0);

      sap[2].setName("costFunction");
      sap[2].setType("java.lang.String");
      sap[2].setDescription("type of cost function");
      sap[2].setStatus(0);

      sap[3].setName("targetName");
      sap[3].setType("java.lang.String");
      sap[3].setDescription("name of target attribute");
      sap[3].setStatus(1);

      sapVec.addElement(sap);
    }
    if ( settings instanceof ClassificationSettings )
    {
      ServiceAlgorithmParameter[] sap = null;
      int npar = 1;
      sap = new ServiceAlgorithmParameter[npar];
      for (int i = 0; i < npar; i++) {
        sap[i] = new ServiceAlgorithmParameter();
        sap[i].setValue("");
        sap[i].setDomain(0);
        sap[i].setID("");
        sap[i].setChildIDs("");
      };

      sap[0].setName("costMatrix");
      sap[0].setType("com.prudsys.pdm.Models.Classification.CostMatrix");
      sap[0].setDescription("cost matrix object");
      sap[0].setStatus(0);

      sapVec.addElement(sap);
    }
    if ( settings instanceof DecisionTreeSettings )
    {
      ServiceAlgorithmParameter[] sap = null;
      int npar = 6;
      sap = new ServiceAlgorithmParameter[npar];
      for (int i = 0; i < npar; i++) {
        sap[i] = new ServiceAlgorithmParameter();
        sap[i].setValue("");
        sap[i].setDomain(0);
        sap[i].setID("");
        sap[i].setChildIDs("");
      };

      sap[0].setName("maxSurrogates");
      sap[0].setType("int");
      sap[0].setValue("0");
      sap[0].setDescription("maximum number of surrogate splits");
      sap[0].setStatus(0);

      sap[1].setName("maxDepth");
      sap[1].setType("int");
      sap[1].setValue("Integer.MAX_VALUE");
      sap[1].setDescription("maximum depth of tree");
      sap[1].setStatus(0);

      sap[2].setName("maxSplits");
      sap[2].setType("int");
      sap[2].setValue("Integer.MAX_VALUE");
      sap[2].setDescription("maximum number of splits in node");
      sap[2].setStatus(0);

      sap[3].setName("minNodeSize");
      sap[3].setType("double");
      sap[3].setValue("0");
      sap[3].setDescription("minimum number vectors per split (count/%)");
      sap[3].setStatus(0);

      sap[4].setName("minNodeSizeUnit");
      sap[4].setType("int");
      sap[4].setValue("1");
      sap[4].setDescription("unit in minimum node size (count/%)");
      sap[4].setStatus(0);

      sap[5].setName("minDecreaseInImpurity");
      sap[5].setType("double");
      sap[5].setValue("0");
      sap[5].setDescription("minimum decrease in impurite for node splitting");
      sap[5].setStatus(0);

      sapVec.addElement(sap);
    }
    if ( settings instanceof RegressionSettings )
    {
      ServiceAlgorithmParameter[] sap = null;
      int npar = 0;
      sap = new ServiceAlgorithmParameter[npar];
      for (int i = 0; i < npar; i++) {
        sap[i] = new ServiceAlgorithmParameter();
        sap[i].setValue("");
        sap[i].setDomain(0);
        sap[i].setID("");
        sap[i].setChildIDs("");
      };

      sapVec.addElement(sap);
    }
    if ( settings instanceof SparseGridsSettings )
    {
      ServiceAlgorithmParameter[] sap = null;
      int npar = 6;
      sap = new ServiceAlgorithmParameter[npar];
      for (int i = 0; i < npar; i++) {
        sap[i] = new ServiceAlgorithmParameter();
        sap[i].setValue("");
        sap[i].setDomain(0);
        sap[i].setID("");
        sap[i].setChildIDs("");
      };

      sap[0].setName("sgType");
      sap[0].setType("int");
      sap[0].setValue("0");
      sap[0].setDescription("type of Sparse Grids (tensor product/simplicial)");
      sap[0].setStatus(0);

      sap[1].setName("basisDegree");
      sap[1].setType("int");
      sap[1].setValue("1");
      sap[1].setDescription("polynomial degree of basis function");
      sap[1].setStatus(0);

      sap[2].setName("waveletBasis");
      sap[2].setType("boolean");
      sap[2].setValue("false");
      sap[2].setDescription("is basis an orthogonal wavelet basis");
      sap[2].setStatus(0);

      sap[3].setName("coarseGrid");
      sap[3].setType("boolean");
      sap[3].setValue("false");
      sap[3].setDescription("included coarse grid");
      sap[3].setStatus(0);

      sap[4].setName("level");
      sap[4].setType("int");

⌨️ 快捷键说明

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