本文整理汇总了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();
}
示例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();
}