📄 applicationattribute.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;
import java.util.StringTokenizer;
import java.util.Vector;
import com.prudsys.pdm.Adapters.PmmlVersion20.MiningField;
import com.prudsys.pdm.Models.Supervised.SupervisedMiningModel;
/**
* Attribute used when the model was generated. <p>
*
* From CWM Data Mining. <p>
*
* Superclasses:
* <ul>
* <li> Attribute
* </ul>
* Attributes:
* <ul>
* <li> <i>usageType</i>: Indicates whether attribute was actively used
* when the model was generated.<br>
* - type: AttributeUsage (active | inactive | supplementary)<br>
* - multiplicity: exactly one<br>
* <li> <i>attributeType</i>: Type of ApplicationAttribute.<br>
* - type: AttributeType (categorical | numeric)<br>
* - multiplicity: exactly one
* </ul>
*
* In addition, functionality from PMML was added.
* It corresponds to the PMML element MiningField.<p>
*
* PMML attributes added:
* <ul>
* <li> <i>name</i>: Attribute name.
* <li> <i>outliers</i>: Treatment of outliers (asIs | asMissingValues | asExtremeValues)
* <li> <i>lowValue</i>: used in conjunction with %outlierTreatmentMethod;
* "asExtremeValues" as values for records with outliers in this field if x < lowValue then x = lowValue
* <li> <i>highValue</i>: used in conjunction with %outlierTreatmentMethod;
* "asExtremeValues" as values for records with outliers in this field if x > highValue then x = highValue
* <li> <i>missingValueReplacement</i>: If this attribute is specified then a missing
* input value is automatically replaced by the given value.
* That is, the model itself works as if the given value was found in
* the original input.
* <li> <i>missingValueTreatment</i>: For model consumer field is 'for information only'.
* The consumer only looks at missingValueReplacement. If a value is present
* it replaces missing values. The missingValueTreatment attribute just
* indicates how the missingValueReplacement was derived, but places
* no behavioral requirement on the consumer.
* Types (asIs | asMean | asMode | asMedian | asValue).
* </ul>
*
* In addition, functionality from PMML was added.
* It corresponds to the PMML element MiningField.
*
* @see AttributeUsage
* @see AttributeType
* @see ApplicationInputSpecification
* @see com.prudsys.pdm.Adapters.PmmlVersion20.MiningField
*/
public class ApplicationAttribute extends com.prudsys.pdm.Cwm.Core.Attribute implements PmmlPresentable
{
// -----------------------------------------------------------------------
// Constants of outlier and missing value treatment
// -----------------------------------------------------------------------
public static final String OUTLIER_TREATMENT_METHOD_asIs = "asIs";
public static final String OUTLIER_TREATMENT_METHOD_asMissingValues = "asMissingValues";
public static final String OUTLIER_TREATMENT_METHOD_asExtremeValues = "asExtremeValues";
public static final String MISSING_VALUE_TREATMENT_METHOD_asIs = "asIs";
public static final String MISSING_VALUE_TREATMENT_METHOD_asMean = "asMean";
public static final String MISSING_VALUE_TREATMENT_METHOD_asMode = "asMode";
public static final String MISSING_VALUE_TREATMENT_METHOD_asMedian = "asMedian";
public static final String MISSING_VALUE_TREATMENT_METHOD_asValue = "asValue";
// -----------------------------------------------------------------------
// Variables declarations
// -----------------------------------------------------------------------
/** Name of application attribute. Now inherited from ModelElement. */
// private String name = "";
/**
* Indicates whether attribute was actively used when the model was generated.
*/
private AttributeUsage usageType;
/** Type of ApplicationAttribute. */
private AttributeType attributeType;
/** Reference to application input specification the attribute belongs to. */
private ApplicationInputSpecification inputSpec;
/** Reference to supervised mining model that uses the attribute. */
private SupervisedMiningModel supervisedMiningModel[];
/** Type out outlier treatment. */
private String outliers = OUTLIER_TREATMENT_METHOD_asIs;
/** Low value for extreme value replacement. */
private String lowValue = "";
/** High value for extreme value replacement. */
private String highValue = "";
/** Value for replacement of missing values. */
private String missingValueReplacement = "";
/** Type of treatment of missing values. */
private String missingValueTreatment = MISSING_VALUE_TREATMENT_METHOD_asIs;
/** Array of additional missing values. */
private String[] missingValues;
// -----------------------------------------------------------------------
// Constructor
// -----------------------------------------------------------------------
/**
* Empty constructor.
*/
public ApplicationAttribute()
{
}
// -----------------------------------------------------------------------
// Getter and setter methods
// -----------------------------------------------------------------------
/**
* Returns the attribute type (categorical, numeric).
*
* @return attribute type
*/
public AttributeType getAttributeType()
{
return attributeType;
}
/**
* Sets the attribute type.
*
* @param attributeType attribute type to set
*/
public void setAttributeType(AttributeType attributeType)
{
this.attributeType = attributeType;
}
/**
* Returns the application input specification where the
* attribute belongs to.
*
* @return application input specification of the attribute
*/
public ApplicationInputSpecification getInputSpec()
{
return inputSpec;
}
/**
* Sets the application input specification.
*
* @param inputSpec the new application input specification
*/
public void setInputSpec(ApplicationInputSpecification inputSpec)
{
this.inputSpec = inputSpec;
}
/**
* Returns the attribute usage type (active, inactive, supplementary).
*
* @return attribute usage type
*/
public AttributeUsage getUsageType()
{
return usageType;
}
/**
* Sets the attribute usage type.
*
* @param usageType the new attribute usage type
*/
public void setUsageType(AttributeUsage usageType)
{
this.usageType = usageType;
}
/**
* Get supervised mining methods using this attribute as
* target attribute.
*
* @return supervised mining models with this target attribute
*/
public SupervisedMiningModel[] getSupervisedMiningModel()
{
return supervisedMiningModel;
}
/**
* Set supervised mining methods using this as target attribute.
*
* @param supervisedMiningModel new supervised mining models with this target attribute
*/
public void setSupervisedMiningModel(SupervisedMiningModel[] supervisedMiningModel)
{
this.supervisedMiningModel = supervisedMiningModel;
}
/**
* Used in conjunction with outliers method "asExtremeValues" as
* values for records with outliers in this field
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -