当前位置: 首页>>代码示例>>Java>>正文


Java NumericalAttribute类代码示例

本文整理汇总了Java中com.rapidminer.example.table.NumericalAttribute的典型用法代码示例。如果您正苦于以下问题:Java NumericalAttribute类的具体用法?Java NumericalAttribute怎么用?Java NumericalAttribute使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


NumericalAttribute类属于com.rapidminer.example.table包,在下文中一共展示了NumericalAttribute类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getValueWithCorrectClass

import com.rapidminer.example.table.NumericalAttribute; //导入依赖的package包/类
private Object getValueWithCorrectClass(Example example, Attribute attribute) {
	try {
		double value = example.getValue(attribute);
		if (Double.isNaN(value)) {
			return "?";
		}
		if (Ontology.ATTRIBUTE_VALUE_TYPE.isA(attribute.getValueType(), Ontology.DATE_TIME)) {
			// simply return date, format is evaluated directly in jtable, see todo above
			return new Date((long) value);
		} else if (attribute.isNumerical()) {
			return Double.valueOf(example.getValue(attribute));
		} else {
			return example.getValueAsString(attribute, NumericalAttribute.DEFAULT_NUMBER_OF_DIGITS, false);
		}
	} catch (Throwable e) {
		LogService.getRoot().log(Level.WARNING,
				"com.rapidminer.gui.viewer.DataViewerTableModel.showing_correct_value_error", e.getMessage());
		return "Error";
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:21,代码来源:DataViewerTableModel.java

示例2: write

import com.rapidminer.example.table.NumericalAttribute; //导入依赖的package包/类
@Override
public ExampleSet write(ExampleSet ioobject) throws OperatorException {
	boolean zipped = getParameterAsBoolean(PARAMETER_ZIPPED);
	File dataFile = getParameterAsFile(PARAMETER_EXAMPLE_SET_FILE, true);
	if (zipped) {
		dataFile = new File(dataFile.getAbsolutePath() + ".gz");
	}
	boolean quoteNominal = getParameterAsBoolean(PARAMETER_QUOTE_NOMINAL_VALUES);
	int fractionDigits = getParameterAsInt(PARAMETER_FRACTION_DIGITS);
	if (fractionDigits < 0) {
		fractionDigits = NumericalAttribute.UNLIMITED_NUMBER_OF_DIGITS;
	}

	Charset encoding = Encoding.getEncoding(this);

	writeSpecialFormat(ioobject, dataFile, fractionDigits, getParameterAsBoolean(PARAMETER_ADD_NEW_LINE), quoteNominal,
			zipped, shouldAppend(dataFile), encoding);
	return ioobject;
}
 
开发者ID:rapidminer,项目名称:rapidminer-studio,代码行数:20,代码来源:SpecialFormatExampleSetWriter.java

示例3: write

import com.rapidminer.example.table.NumericalAttribute; //导入依赖的package包/类
@Override
public ExampleSet write(ExampleSet ioobject) throws OperatorException {
    boolean zipped = getParameterAsBoolean(PARAMETER_ZIPPED);
    File dataFile = getParameterAsFile(PARAMETER_EXAMPLE_SET_FILE, true);
    if (zipped) {
        dataFile = new File(dataFile.getAbsolutePath() + ".gz");
    }
    boolean quoteNominal = getParameterAsBoolean(PARAMETER_QUOTE_NOMINAL_VALUES);
    int fractionDigits = getParameterAsInt(PARAMETER_FRACTION_DIGITS);
    if (fractionDigits < 0)
        fractionDigits = NumericalAttribute.UNLIMITED_NUMBER_OF_DIGITS;

    Charset encoding = Encoding.getEncoding(this);

    writeSpecialFormat(ioobject, dataFile, fractionDigits, getParameterAsBoolean(PARAMETER_ADD_NEW_LINE), quoteNominal, zipped, shouldAppend(dataFile), encoding);
    return ioobject;
}
 
开发者ID:rapidminer,项目名称:rapidminer-5,代码行数:18,代码来源:SpecialFormatExampleSetWriter.java

示例4: getValueWithCorrectClass

import com.rapidminer.example.table.NumericalAttribute; //导入依赖的package包/类
private Object getValueWithCorrectClass(Example example, Attribute attribute) {
	// TODO consolidate value string formatting which is spread widely among this model, the DataViewerTable, and a ColoredTableCellRenderer
    try {
    	double value = example.getValue(attribute);
		if (Double.isNaN(value)) {
			return "?";
		}
    	if (Ontology.ATTRIBUTE_VALUE_TYPE.isA(attribute.getValueType(), Ontology.DATE_TIME)) {
    		// simply return date, format is evaluated directly in jtable, see todo above
    		return new Date((long) value);
    	} else if (attribute.isNumerical()) {
            return Double.valueOf(example.getValue(attribute));
    	} else {
            return example.getValueAsString(attribute, NumericalAttribute.DEFAULT_NUMBER_OF_DIGITS, false);
    	}
    } catch (Throwable e) {
        //LogService.getGlobal().logWarning("Cannot show correct value: " + e.getMessage());
        LogService.getRoot().log(Level.WARNING, "com.rapidminer.gui.viewer.DataViewerTableModel.showing_correct_value_error", e.getMessage());           
        return "Error";
    }
}
 
开发者ID:rapidminer,项目名称:rapidminer-5,代码行数:22,代码来源:DataViewerTableModel.java

示例5: XMLSerialization

import com.rapidminer.example.table.NumericalAttribute; //导入依赖的package包/类
private XMLSerialization(ClassLoader classLoader) {
	try {
		Class<?> xStreamClass = Class.forName("com.thoughtworks.xstream.XStream");
		Class generalDriverClass = Class.forName("com.thoughtworks.xstream.io.HierarchicalStreamDriver");
		Constructor constructor = xStreamClass.getConstructor(new Class[] { generalDriverClass });
		Class driverClass = Class.forName("com.thoughtworks.xstream.io.xml.XppDriver");
		xStream = (com.thoughtworks.xstream.XStream) constructor.newInstance(driverClass.newInstance());
		xStream.setMode(com.thoughtworks.xstream.XStream.ID_REFERENCES);

		// define default aliases here
		addAlias("IOContainer", IOContainer.class);
		addAlias("PolynominalAttribute", PolynominalAttribute.class);
		addAlias("BinominalAttribute", BinominalAttribute.class);
		addAlias("NumericalAttribute", NumericalAttribute.class);

		addAlias("PolynominalMapping", PolynominalMapping.class);
		addAlias("BinominalMapping", BinominalMapping.class);

		addAlias("NumericalStatistics", NumericalStatistics.class);
		addAlias("WeightedNumericalStatistics", WeightedNumericalStatistics.class);
		addAlias("NominalStatistics", NominalStatistics.class);
		addAlias("UnknownStatistics", UnknownStatistics.class);

		addAlias("SimpleAttributes", SimpleAttributes.class);
		addAlias("AttributeRole", AttributeRole.class);

		xStream.setClassLoader(classLoader);

		defineXMLAliasPairs();
	} catch (Throwable e) {
		// TODO: Why are we catching Throwables?
		// LogService.getRoot().log(Level.WARNING,
		// "Cannot initialize XML serialization. Probably the libraries 'xstream.jar' and 'xpp.jar' were not provided. XML serialization will not work!",
		// e);
		LogService.getRoot().log(
				Level.WARNING,
				I18N.getMessage(LogService.getRoot().getResourceBundle(),
						"com.rapidminer.tools.XMLSerialization.writing_initializing_xml_serialization_error", e), e);
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:41,代码来源:XMLSerialization.java

示例6: write

import com.rapidminer.example.table.NumericalAttribute; //导入依赖的package包/类
@Override
public ExampleSet write(ExampleSet eSet) throws OperatorException {
	boolean zipped = getParameterAsBoolean(PARAMETER_ZIPPED);
	File dataFile = getParameterAsFile(PARAMETER_EXAMPLE_SET_FILE, true);
	if (zipped) {
		dataFile = new File(dataFile.getAbsolutePath() + ".gz");
	}
	File attFile = getParameterAsFile(PARAMETER_ATTRIBUTE_DESCRIPTION_FILE, true);

	boolean append = shouldAppend(dataFile);
	Charset encoding = Encoding.getEncoding(this);

	try {
		// write example set
		int format = getParameterAsInt(PARAMETER_FORMAT);
		getLogger().info("Writing example set in format '" + FORMAT_NAMES[format] + "'.");
		if (format == DENSE_FORMAT) { // dense
			eSet.writeDataFile(dataFile, NumericalAttribute.UNLIMITED_NUMBER_OF_DIGITS, true, zipped, append, encoding);
			if (attFile != null) {
				eSet.writeAttributeFile(attFile, dataFile, encoding);
			}
		} else { // sparse
			eSet.writeSparseDataFile(dataFile, format - 1, NumericalAttribute.UNLIMITED_NUMBER_OF_DIGITS, true, zipped,
					append, encoding);
			if (attFile != null) {
				eSet.writeSparseAttributeFile(attFile, dataFile, format - 1, encoding);
			}
		}
	} catch (IOException e) {
		throw new UserError(this, e, 303, new Object[] { dataFile + " / " + attFile, e.getMessage() });
	}

	return eSet;
}
 
开发者ID:rapidminer,项目名称:rapidminer-studio,代码行数:35,代码来源:ExampleSetWriter.java

示例7: XMLSerialization

import com.rapidminer.example.table.NumericalAttribute; //导入依赖的package包/类
private XMLSerialization(ClassLoader classLoader) {
	try {
		Class<?> xStreamClass = Class.forName("com.thoughtworks.xstream.XStream");
		Class<?> generalDriverClass = Class.forName("com.thoughtworks.xstream.io.HierarchicalStreamDriver");
		Constructor<?> constructor = xStreamClass.getConstructor(generalDriverClass);
		Class<?> driverClass = Class.forName("com.thoughtworks.xstream.io.xml.XppDriver");
		xStream = (com.thoughtworks.xstream.XStream) constructor.newInstance(driverClass.newInstance());
		xStream.setMode(com.thoughtworks.xstream.XStream.ID_REFERENCES);

		// define default aliases here
		addAlias("IOContainer", IOContainer.class);
		addAlias("PolynominalAttribute", PolynominalAttribute.class);
		addAlias("BinominalAttribute", BinominalAttribute.class);
		addAlias("NumericalAttribute", NumericalAttribute.class);

		addAlias("PolynominalMapping", PolynominalMapping.class);
		addAlias("BinominalMapping", BinominalMapping.class);

		addAlias("NumericalStatistics", NumericalStatistics.class);
		addAlias("WeightedNumericalStatistics", WeightedNumericalStatistics.class);
		addAlias("NominalStatistics", NominalStatistics.class);
		addAlias("UnknownStatistics", UnknownStatistics.class);

		addAlias("SimpleAttributes", SimpleAttributes.class);
		addAlias("AttributeRole", AttributeRole.class);

		xStream.setClassLoader(classLoader);

		defineXMLAliasPairs();
	} catch (Throwable e) {
		// TODO: Why are we catching Throwables?
		LogService.getRoot().log(Level.WARNING, I18N.getMessage(LogService.getRoot().getResourceBundle(),
						"com.rapidminer.tools.XMLSerialization.writing_initializing_xml_serialization_error", e), e);
	}
}
 
开发者ID:rapidminer,项目名称:rapidminer-studio,代码行数:36,代码来源:XMLSerialization.java

示例8: write

import com.rapidminer.example.table.NumericalAttribute; //导入依赖的package包/类
@Override
public ExampleSet write(ExampleSet eSet) throws OperatorException {		
	boolean zipped = getParameterAsBoolean(PARAMETER_ZIPPED);
	File dataFile = getParameterAsFile(PARAMETER_EXAMPLE_SET_FILE, true);
	if (zipped) {
		dataFile = new File(dataFile.getAbsolutePath() + ".gz");
	}
	File attFile = getParameterAsFile(PARAMETER_ATTRIBUTE_DESCRIPTION_FILE, true);

	boolean append = shouldAppend(dataFile);
	Charset encoding = Encoding.getEncoding(this);

	try {
		// write example set
		int format = getParameterAsInt(PARAMETER_FORMAT);
		getLogger().info("Writing example set in format '" + FORMAT_NAMES[format] + "'.");
		if (format == DENSE_FORMAT) { // dense
			eSet.writeDataFile(dataFile, NumericalAttribute.UNLIMITED_NUMBER_OF_DIGITS, true, zipped, append, encoding);
			if (attFile != null) {
				eSet.writeAttributeFile(attFile, dataFile, encoding);
			}
		} else { // sparse
			eSet.writeSparseDataFile(dataFile, format - 1, NumericalAttribute.UNLIMITED_NUMBER_OF_DIGITS, true, zipped, append, encoding);
			if (attFile != null)
				eSet.writeSparseAttributeFile(attFile, dataFile, format - 1, encoding);
		}
	} catch (IOException e) {
		throw new UserError(this, e, 303, new Object[] { dataFile + " / " + attFile, e.getMessage() });
	}

	return eSet;
}
 
开发者ID:rapidminer,项目名称:rapidminer-5,代码行数:33,代码来源:ExampleSetWriter.java

示例9: XMLSerialization

import com.rapidminer.example.table.NumericalAttribute; //导入依赖的package包/类
private XMLSerialization(ClassLoader classLoader) {
    try {
        Class<?> xStreamClass = Class.forName("com.thoughtworks.xstream.XStream");
        Class generalDriverClass = Class.forName("com.thoughtworks.xstream.io.HierarchicalStreamDriver");
        Constructor constructor = xStreamClass.getConstructor(new Class[] { generalDriverClass });
        Class driverClass = Class.forName("com.thoughtworks.xstream.io.xml.XppDriver");
        xStream = (com.thoughtworks.xstream.XStream)constructor.newInstance(driverClass.newInstance());
        xStream.setMode(com.thoughtworks.xstream.XStream.ID_REFERENCES);

        // define default aliases here
        addAlias("IOContainer", IOContainer.class);
        addAlias("PolynominalAttribute", PolynominalAttribute.class);
        addAlias("BinominalAttribute", BinominalAttribute.class);
        addAlias("NumericalAttribute", NumericalAttribute.class);

        addAlias("PolynominalMapping", PolynominalMapping.class);
        addAlias("BinominalMapping", BinominalMapping.class);

        addAlias("NumericalStatistics", NumericalStatistics.class);
        addAlias("WeightedNumericalStatistics", WeightedNumericalStatistics.class);
        addAlias("NominalStatistics", NominalStatistics.class);
        addAlias("UnknownStatistics", UnknownStatistics.class);

        addAlias("SimpleAttributes", SimpleAttributes.class);
        addAlias("AttributeRole", AttributeRole.class);

        xStream.setClassLoader(classLoader);


        defineXMLAliasPairs();
    } catch (Throwable e) {
        // TODO: Why are we catching Throwables?
        //LogService.getRoot().log(Level.WARNING, "Cannot initialize XML serialization. Probably the libraries 'xstream.jar' and 'xpp.jar' were not provided. XML serialization will not work!", e);
    	LogService.getRoot().log(Level.WARNING,
    			I18N.getMessage(LogService.getRoot().getResourceBundle(),
    					"com.rapidminer.tools.XMLSerialization.writing_initializing_xml_serialization_error", 
    					e),
    					e);
    }
}
 
开发者ID:rapidminer,项目名称:rapidminer-5,代码行数:41,代码来源:XMLSerialization.java

示例10: toString

import com.rapidminer.example.table.NumericalAttribute; //导入依赖的package包/类
/**
 * Returns a dense string representation with all possible fraction digits. Nominal values will
 * be quoted with double quotes.
 */
@Override
public String toString() {
	return toDenseString(NumericalAttribute.UNLIMITED_NUMBER_OF_DIGITS, true);
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:9,代码来源:Example.java

示例11: makeNumericalAttribute

import com.rapidminer.example.table.NumericalAttribute; //导入依赖的package包/类
@Override
public IAttribute makeNumericalAttribute(String label) {
    return new NumericalAttribute(label);
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:5,代码来源:MidasFrontendFactory.java

示例12: toString

import com.rapidminer.example.table.NumericalAttribute; //导入依赖的package包/类
/** Returns a dense string representation with all possible fraction digits.
    *  Nominal values will be quoted with double quotes.
    */
   @Override
public String toString() {
   	return toDenseString(NumericalAttribute.UNLIMITED_NUMBER_OF_DIGITS, true);
   }
 
开发者ID:rapidminer,项目名称:rapidminer-5,代码行数:8,代码来源:Example.java

示例13: getValueAsString

import com.rapidminer.example.table.NumericalAttribute; //导入依赖的package包/类
/**
 * <p>
 * Returns the value of this attribute as string representation, i.e. the number as string for
 * numerical attributes and the correctly mapped categorical value for nominal values. The used
 * number of fraction digits is unlimited (see
 * {@link NumericalAttribute#DEFAULT_NUMBER_OF_DIGITS} ). Nominal values containing whitespaces
 * will not be quoted.
 * </p>
 * 
 * <p>
 * Please note that this method should not be used in order to get the nominal values, please
 * use {@link #getNominalValue(Attribute)} instead.
 * </p>
 */
public String getValueAsString(Attribute attribute) {
	return getValueAsString(attribute, NumericalAttribute.UNLIMITED_NUMBER_OF_DIGITS, false);
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:18,代码来源:Example.java

示例14: getValueAsString

import com.rapidminer.example.table.NumericalAttribute; //导入依赖的package包/类
/**
 * <p>Returns the value of this attribute as string representation, i.e. the
 * number as string for numerical attributes and the correctly mapped
 * categorical value for nominal values. The used number of fraction 
 * digits is unlimited
 * (see {@link NumericalAttribute#DEFAULT_NUMBER_OF_DIGITS}).
 * Nominal values containing whitespaces will not be quoted.</p>
    * 
    * <p>Please note that this method should not be used in order to get the 
    * nominal values, please use 
    * {@link #getNominalValue(Attribute)} instead.</p>
 */
public String getValueAsString(Attribute attribute) {
	return getValueAsString(attribute, NumericalAttribute.UNLIMITED_NUMBER_OF_DIGITS, false);
}
 
开发者ID:rapidminer,项目名称:rapidminer-5,代码行数:16,代码来源:Example.java


注:本文中的com.rapidminer.example.table.NumericalAttribute类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。