本文整理汇总了C#中cs_unittest.VowpalWabbitExampleValidator类的典型用法代码示例。如果您正苦于以下问题:C# VowpalWabbitExampleValidator类的具体用法?C# VowpalWabbitExampleValidator怎么用?C# VowpalWabbitExampleValidator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
VowpalWabbitExampleValidator类属于cs_unittest命名空间,在下文中一共展示了VowpalWabbitExampleValidator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestNumericUInt64OverflowArray
public void TestNumericUInt64OverflowArray()
{
using (var vw = new VowpalWabbitExampleValidator<NumericExampleUInt64Array>(string.Empty))
{
vw.Validate("| 0:1.844674E+19", new NumericExampleUInt64Array() { Value = new[] { UInt64.MaxValue } });
}
}
示例2: 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"
});
}
}
示例3: TestNumericUInt64Overflow
public void TestNumericUInt64Overflow()
{
using (var vw = new VowpalWabbitExampleValidator<NumericExampleUInt64>(string.Empty))
{
vw.Validate("| Value:1.844674E+19", new NumericExampleUInt64() { Value = UInt64.MaxValue});
}
}
示例4: Test87
public void Test87()
{
using (var vw = new VowpalWabbit<DataString, DataStringADF>("--cb_adf --rank_all"))
using (var vwSharedValidation = new VowpalWabbitExampleValidator<DataString>("--cb_adf --rank_all"))
using (var vwADFValidation = new VowpalWabbitExampleValidator<DataStringADF>("--cb_adf --rank_all"))
{
var sampleData = CreateSampleCbAdfData();
var example = sampleData[0];
Validate(vwSharedValidation, vwADFValidation, example);
var result = vw.LearnAndPredict(example, example.ActionDependentFeatures, example.SelectedActionIndex, example.Label);
ReferenceEquals(example.ActionDependentFeatures[0], result[0]);
ReferenceEquals(example.ActionDependentFeatures[1], result[1]);
ReferenceEquals(example.ActionDependentFeatures[2], result[2]);
example = sampleData[1];
Validate(vwSharedValidation, vwADFValidation, example);
result = vw.LearnAndPredict(example, example.ActionDependentFeatures, example.SelectedActionIndex, example.Label);
ReferenceEquals(example.ActionDependentFeatures[0], result[1]);
ReferenceEquals(example.ActionDependentFeatures[1], result[0]);
example = sampleData[2];
Validate(vwSharedValidation, vwADFValidation, example);
result = vw.Predict(example, example.ActionDependentFeatures);
ReferenceEquals(example.ActionDependentFeatures[0], result[1]);
ReferenceEquals(example.ActionDependentFeatures[1], result[0]);
}
}
示例5: TestStringSplit
public void TestStringSplit()
{
using (var vw = new VowpalWabbitExampleValidator<ExampleStringSplit>(string.Empty))
{
vw.Validate("| New York State", new ExampleStringSplit() { Value = "New York State" });
}
}
示例6: 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 });
}
}
示例7: TestStringFeatureGroup
public void TestStringFeatureGroup()
{
using (var vw = new VowpalWabbitExampleValidator<ExampleString2>(string.Empty))
{
vw.Validate("|a London", new ExampleString2() { Location = "London" });
}
}
示例8: 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" });
}
}
示例9: 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 } });
}
}
示例10: 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 } });
}
}
示例11: 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);
}
}
示例12: 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 = "" });
}
}
示例13: 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 });
}
}
示例14: 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"
});
}
}
示例15: 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
}
});
}
}