public class ExampleBuilder extends Object
Check https://github.com/JohnLangford/vowpal_wabbit/wiki/Input-format for format documentation.
Modifier and Type | Class and Description |
---|---|
static class |
ExampleBuilder.NamespaceBuilder
Builder for namespace.
|
Modifier and Type | Method and Description |
---|---|
ExampleBuilder |
binaryLabel(boolean binaryLabel)
This is convenient method to set label when you use logistic or hinge loss you.
|
static ExampleBuilder |
create()
Create method
|
static ExampleBuilder |
createAndDoNotCheckNamespace()
By default each namespace should start with unique character.
|
ExampleBuilder.NamespaceBuilder |
createNamespace(String namespace) |
ExampleBuilder |
exampleImportance(double exampleImportance)
Importance (importance weight) is a non-negative real number indicating the relative importance
|
ExampleBuilder |
exampleTag(String tag)
Tag is a string that serves as an identifier for the example.
|
double |
getLabelAsDouble()
Get example label
|
String |
getTag()
Get example tag
|
ExampleBuilder |
label(double label)
Label is the real number that we are trying to predict for this example.
|
ExampleBuilder |
omitLabel()
If the label is omitted, then no training will be performed with the corresponding example,
|
ExampleBuilder |
setLabelString(String label)
You can use it to pass labels for multi-class classification.
|
String |
toString()
Build vowpal wabbit example string
|
public static ExampleBuilder create()
public static ExampleBuilder createAndDoNotCheckNamespace()
If you want to have multiple namespaces starting with same character use this method.
public ExampleBuilder label(double label)
Important note: when using logistic or hinge loss, the labels need to be from the set {+1,-1}
label
- example numerical labelpublic ExampleBuilder binaryLabel(boolean binaryLabel)
This label will convert labels to be from the set {+1,-1}.
binaryLabel
- example binary labelpublic double getLabelAsDouble()
public String getTag()
public ExampleBuilder omitLabel()
although VW will still compute a prediction.
public ExampleBuilder setLabelString(@Nonnull String label)
label
- labelpublic ExampleBuilder exampleTag(@Nonnull String tag)
It is reported back when predictions are made. It doesn't have to be unique.
The default value if it is not provided is the empty string.
tag
- example tagpublic ExampleBuilder exampleImportance(double exampleImportance)
of this example over the others. Omitting this gives a default importance of 1 to the example.
Notice that you should pass -- invariant option in order to properly deal with example importance.
exampleImportance
- example importance. Must be not negativepublic ExampleBuilder.NamespaceBuilder createNamespace(@Nonnull String namespace)
Copyright © 2017. All rights reserved.