本文整理汇总了C#中cs_unittest.VowpalWabbitExampleValidator.Validate方法的典型用法代码示例。如果您正苦于以下问题:C# VowpalWabbitExampleValidator.Validate方法的具体用法?C# VowpalWabbitExampleValidator.Validate怎么用?C# VowpalWabbitExampleValidator.Validate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cs_unittest.VowpalWabbitExampleValidator
的用法示例。
在下文中一共展示了VowpalWabbitExampleValidator.Validate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestJsonDirect
public void TestJsonDirect()
{
using (var vw = new VowpalWabbitExampleValidator<JsonContext>(new VowpalWabbitSettings(featureDiscovery:VowpalWabbitFeatureDiscovery.Json)))
{
vw.Validate("| Clicks:5 |a Bar:1 Age25_old |b Marker", new JsonContext()
{
Ns1 = new Namespace1
{
Foo = 1,
Age = "25 old",
DontConsider = "XXX"
},
Ns2 = new Namespace2
{
FeatureA = true
},
Clicks = 5
});
vw.Validate("| Clicks:5 |a Bar:1", new JsonContext() {
Ns1 = new Namespace1
{
Foo = 1,
DontConsider = "XXX"
},
Clicks = 5,
IgnoreMe = "true"
});
}
}
示例2: TestStringEscape
public void TestStringEscape()
{
using (var vw = new VowpalWabbitExampleValidator<ExampleStringEscape>(string.Empty))
{
vw.Validate("| New_York_State", new ExampleStringEscape() { Value = "New York State" });
vw.Validate("| new_York_state", new ExampleStringEscape() { Value = "new York state" });
}
}
示例3: TestNumericInt64OverflowArray
public void TestNumericInt64OverflowArray()
{
using (var vw = new VowpalWabbitExampleValidator<NumericExampleInt64Array>(string.Empty))
{
vw.Validate("| 0:9.22337203685477580700E+018", new NumericExampleInt64Array() { Value = new [] { Int64.MaxValue } });
vw.Validate("| 0:-9.22337203685477580700E+018", new NumericExampleInt64Array() { Value = new[] { Int64.MinValue } });
}
}
示例4: TestNumericDoubleOverflowArray
public void TestNumericDoubleOverflowArray()
{
using (var vw = new VowpalWabbitExampleValidator<NumericExampleDoubleArray>(string.Empty))
{
vw.Validate("| 0:1.79769313486231570000E+308", new NumericExampleDoubleArray() { Value = new [] { double.MaxValue } });
vw.Validate("| 0:-1.79769313486231570000E+308", new NumericExampleDoubleArray() { Value = new [] { double.MinValue } });
}
}
示例5: TestString
public void TestString()
{
using (var vw = new VowpalWabbitExampleValidator<ExampleString>(string.Empty))
{
vw.Validate("|abc London", new ExampleString() { Location = "London" });
vw.Validate("", new ExampleString() { });
vw.Validate("", new ExampleString() { Location = "" });
}
}
示例6: TestEnumerize
public void TestEnumerize()
{
using(var vw = new VowpalWabbitExampleValidator<ExampleEnum>(string.Empty))
{
vw.Validate("| AgeEnumerize25", new ExampleEnum() { AgeEnumerize = 25 });
vw.Validate("| AgeEnumerize0 AgeNumeric:25", new ExampleEnum() { AgeNumeric = 25 });
vw.Validate("| AgeEnumerize0 AgeNumeric:23 AgeEnumChild", new ExampleEnum() { AgeNumeric = 23, AgeEnum = Age.Child });
}
}
示例7: TestStringFeatureGroup
public void TestStringFeatureGroup()
{
using (var vw = new VowpalWabbitExampleValidator<ExampleString2>(string.Empty))
{
vw.Validate("|a London", new ExampleString2() { Location = "London" });
}
}
示例8: TestExpansion
public void TestExpansion()
{
using (var vw = new VowpalWabbitExampleValidator<ExpansionContext>(string.Empty))
{
vw.Validate("| 3:.1 4:.2 5:.3", new ExpansionContext() { Features = new[] { .1f, .2f, .3f }, Offset = 3 });
}
}
示例9: TestNumericUInt64OverflowArray
public void TestNumericUInt64OverflowArray()
{
using (var vw = new VowpalWabbitExampleValidator<NumericExampleUInt64Array>(string.Empty))
{
vw.Validate("| 0:1.844674E+19", new NumericExampleUInt64Array() { Value = new[] { UInt64.MaxValue } });
}
}
示例10: TestStringSplit
public void TestStringSplit()
{
using (var vw = new VowpalWabbitExampleValidator<ExampleStringSplit>(string.Empty))
{
vw.Validate("| New York State", new ExampleStringSplit() { Value = "New York State" });
}
}
示例11: TestNumericUInt64Overflow
public void TestNumericUInt64Overflow()
{
using (var vw = new VowpalWabbitExampleValidator<NumericExampleUInt64>(string.Empty))
{
vw.Validate("| Value:1.844674E+19", new NumericExampleUInt64() { Value = UInt64.MaxValue});
}
}
示例12: Validate
private void Validate(VowpalWabbitExampleValidator<DataString> vwSharedValidation, VowpalWabbitExampleValidator<DataStringADF> vwADFValidation, DataString example)
{
vwSharedValidation.Validate(example.Line, example, SharedLabel.Instance);
for (int i = 0; i < example.ActionDependentFeatures.Count; i++)
{
var adf = example.ActionDependentFeatures[i];
vwADFValidation.Validate(adf.Line, adf, i == example.SelectedActionIndex ? example.Label : null);
}
}
示例13: TestJsonDirectWithLabel
public void TestJsonDirectWithLabel()
{
using (var vw = new VowpalWabbitExampleValidator<JsonContext>(new VowpalWabbitSettings(featureDiscovery: VowpalWabbitFeatureDiscovery.Json)))
{
vw.Validate("13 | Clicks:5 MoreClicks:3", new JsonContext()
{
Label = new SimpleLabel { Label = 13 },
Clicks = 5,
MoreClicks = 3,
IgnoreMe2 = "YYY"
});
}
}
示例14: TestJsonOptIn
public void TestJsonOptIn()
{
using (var vw = new VowpalWabbitExampleValidator<JsonContextOptIn>(new VowpalWabbitSettings(featureDiscovery: VowpalWabbitFeatureDiscovery.Json)))
{
vw.Validate("| Clicked |Ns2 Marker", new JsonContextOptIn()
{
Clicked = true,
IgnoredNamespace = new Namespace1 { Foo = 3 },
Ns2 = new Namespace2
{
FeatureA = true
}
});
}
}
示例15: TestStringNamespace
public void TestStringNamespace()
{
try
{
using (var vw = new VowpalWabbitExampleValidator<ExampleString3>(string.Empty))
{
vw.Validate("|bc London", new ExampleString3() { Location = "London" });
}
Assert.Fail("Expected ArgumentException");
}
catch (ArgumentException)
{
}
}