📄 miningattribute.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.Core;
/**
* An attribute (aka field or variable). It carries the following specifications:
* <ul>
* <li> valid values
* <li> ordering
* <li> taxonomy
* <li> normalization
* </ul>
*
* From CWM Data Mining. <p>
*
* Superclass:
* <ul>
* <li> Attribute
* </ul>
*
* In addition, functionality from PMML was added.
* It corresponds to the PMML element DataField.
*
* PMML attributes added:
* <ul>
* <li> <i>dataType</i>: data type of mining attribute.
* </ul>
*
* @see com.prudsys.pdm.Adapters.PmmlVersion20.DataField
*/
public abstract class MiningAttribute extends com.prudsys.pdm.Cwm.Core.Attribute implements PmmlPresentable, MiningMatrixElement, Cloneable
{
// -----------------------------------------------------------------------
// Constants of data types
// -----------------------------------------------------------------------
/** Undefined. */
public static final int UNDEFINED = -1;
/** Default value (depends on the attribute type). */
public static final int DEFAULT = 0;
// -----------------------------------------------------------------------
// Variables declarations
// -----------------------------------------------------------------------
/** Name of the attribute. Now inherited from ModelElement. */
// protected String name;
/** The data type (integer, string, time, ...) of the attribute. */
protected int dataType = DEFAULT;
/** Reference to meta data it belongs to. Not further used. */
protected MiningDataSpecification dataSpecification = null;
/** Reference to the attribute usage relations it appears. Not further used. */
protected AttributeUsageRelation attributeUsage[] = null;
// -----------------------------------------------------------------------
// Getter and setter methods
// -----------------------------------------------------------------------
/**
* Returns the data type of the attribute (int, string, time, ...).
*
* @return data type of mining attribute
*/
public int getDataType() {
return dataType;
}
/**
* Sets data type of the attribute (int, string, time, ...).
*
* @param dataType new data type of the attribute
*/
public void setDataType(int dataType) {
this.dataType = dataType;
}
// -----------------------------------------------------------------------
// Methods of PMML handling
// -----------------------------------------------------------------------
/**
* Creates PMML element DataField from attribute.
*
* @return PMML element DataField
* @throws MiningException if can't create pmml representation for this attribute
* @see com.prudsys.pdm.Adapters.PmmlVersion20.DataField
*/
public abstract Object createPmmlObject() throws MiningException;
/**
* Reads PMML element DataField to create attribute.
*
* @param pmmlObject PMML element DataField
* @throws MiningException if can't restore attribute from the pmml
* @see com.prudsys.pdm.Adapters.PmmlVersion20.DataField
*/
public abstract void parsePmmlObject( Object pmmlObject ) throws MiningException;
// -----------------------------------------------------------------------
// Other export methods
// -----------------------------------------------------------------------
/**
* Returns a description of the attribute in ARFF format
* of WEKA library.
*
* @return String attribute's presentation in the arff format
*/
public abstract String createArffDescription();
// -----------------------------------------------------------------------
// java.lang.Object methods
// -----------------------------------------------------------------------
/**
* Clones this object. Not supported, must be overriden by
* the extending classes.
*
* @return copy of this object
* @throws CloneNotSupportedException clone not supported
*/
public Object clone() throws CloneNotSupportedException {
return super.clone();
}
/**
* Returns string representation of attribute. Is just the name.
*
* @return string representation of attribute
*/
public String toString()
{
return getName();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -