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


Java SparseFormatDataRowReader.FORMAT_YX属性代码示例

本文整理汇总了Java中com.rapidminer.example.table.SparseFormatDataRowReader.FORMAT_YX属性的典型用法代码示例。如果您正苦于以下问题:Java SparseFormatDataRowReader.FORMAT_YX属性的具体用法?Java SparseFormatDataRowReader.FORMAT_YX怎么用?Java SparseFormatDataRowReader.FORMAT_YX使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.rapidminer.example.table.SparseFormatDataRowReader的用法示例。


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

示例1: toSparseString

/**
 * Returns regular and some special attributes (label, id, and example weight) in sparse format.
 * 
 * @param format
 *            one of the formats specified in {@link SparseFormatDataRowReader}
 */
public String toSparseString(int format, int fractionDigits, boolean quoteNominal) {
	StringBuffer str = new StringBuffer();
	// label
	Attribute labelAttribute = getAttributes().getSpecial(Attributes.LABEL_NAME);
	if ((format == SparseFormatDataRowReader.FORMAT_YX) && (labelAttribute != null)) {
		str.append(getValueAsString(labelAttribute, fractionDigits, quoteNominal) + " ");
	}

	// id
	Attribute idAttribute = getAttributes().getSpecial(Attributes.ID_NAME);
	if (idAttribute != null) {
		str.append("id:" + getValueAsString(idAttribute, fractionDigits, quoteNominal) + " ");
	}

	// weight
	Attribute weightAttribute = getAttributes().getSpecial(Attributes.WEIGHT_NAME);
	if (weightAttribute != null) {
		str.append("w:" + getValueAsString(weightAttribute, fractionDigits, quoteNominal) + " ");
	}

	// batch
	Attribute batchAttribute = getAttributes().getSpecial(Attributes.BATCH_NAME);
	if (batchAttribute != null) {
		str.append("b:" + getValueAsString(batchAttribute, fractionDigits, quoteNominal) + " ");
	}

	// attributes
	str.append(getAttributesAsSparseString(SEPARATOR, SPARSE_SEPARATOR, fractionDigits, quoteNominal) + " ");

	// label (format xy & prefix)
	if ((format == SparseFormatDataRowReader.FORMAT_PREFIX) && (labelAttribute != null)) {
		str.append("l:" + getValueAsString(labelAttribute, fractionDigits, quoteNominal));
	}
	if ((format == SparseFormatDataRowReader.FORMAT_XY) && (labelAttribute != null)) {
		str.append(getValueAsString(labelAttribute, fractionDigits, quoteNominal));
	}
	return str.toString();
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:44,代码来源:Example.java

示例2: toSparseString

/**
 * Returns regular and some special attributes (label, id, and example
 * weight) in sparse format.
 * 
 * @param format
 *            one of the formats specified in
 *            {@link SparseFormatDataRowReader}
 */
public String toSparseString(int format, int fractionDigits, boolean quoteNominal) {
	StringBuffer str = new StringBuffer();
	// label
	Attribute labelAttribute = getAttributes().getSpecial(Attributes.LABEL_NAME);
	if ((format == SparseFormatDataRowReader.FORMAT_YX) && (labelAttribute != null)) {
		str.append(getValueAsString(labelAttribute, fractionDigits, quoteNominal) + " ");
	}
	
	// id
	Attribute idAttribute = getAttributes().getSpecial(Attributes.ID_NAME);
	if (idAttribute != null) {
		str.append("id:" + getValueAsString(idAttribute, fractionDigits, quoteNominal) + " ");
	}
	
	// weight
	Attribute weightAttribute = getAttributes().getSpecial(Attributes.WEIGHT_NAME);
	if (weightAttribute != null) {
		str.append("w:" + getValueAsString(weightAttribute, fractionDigits, quoteNominal) + " ");
	}
	
	// batch
	Attribute batchAttribute = getAttributes().getSpecial(Attributes.BATCH_NAME);
	if (batchAttribute != null) {
		str.append("b:" + getValueAsString(batchAttribute, fractionDigits, quoteNominal) + " ");
	}
	
	// attributes
	str.append(getAttributesAsSparseString(SEPARATOR, SPARSE_SEPARATOR, fractionDigits, quoteNominal) + " ");
	
	// label (format xy & prefix)
	if ((format == SparseFormatDataRowReader.FORMAT_PREFIX) && (labelAttribute != null)) {
		str.append("l:" + getValueAsString(labelAttribute, fractionDigits, quoteNominal));
	}
	if ((format == SparseFormatDataRowReader.FORMAT_XY) && (labelAttribute != null)) {
		str.append(getValueAsString(labelAttribute, fractionDigits, quoteNominal));
	}
	return str.toString();
}
 
开发者ID:rapidminer,项目名称:rapidminer-5,代码行数:46,代码来源:Example.java


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