/* Copyright (c) by respective owners including Yahoo!, Microsoft, and individual contributors. All rights reserved. Released under a BSD (revised) license as described in the file LICENSE. */ #pragma once #include using namespace System; using namespace System::Collections::Generic; using namespace System::IO; using namespace System::Threading::Tasks; using namespace VW::Serializer; namespace VW { ref class VowpalWabbit; ref class VowpalWabbitModel; ref class VowpalWabbitSettings; public enum class VowpalWabbitExampleDistribution { /// /// Statistically safer option. /// UniformRandom = 0, /// /// Better runtime performance. /// RoundRobin = 1 }; public interface class ITypeInspector { public: Schema^ CreateSchema(VowpalWabbitSettings^ settings, Type^ type); }; /// /// Settings for wrapper. /// /// Constructor with optional arguments was dropped as it broke version remapping (signature changed with the introduction of new options). public ref class VowpalWabbitSettings : public ICloneable { public: VowpalWabbitSettings() { Arguments = String::Empty; ExampleCountPerRun = 1000; MaxExampleCacheSize = UINT32_MAX; MaxExampleQueueLengthPerInstance = UINT32_MAX; EnableExampleCaching = false; // default to the statistically more safe option ExampleDistribution = VowpalWabbitExampleDistribution::UniformRandom; EnableStringExampleGeneration = false; EnableStringFloatCompact = false; PropertyConfiguration = ::PropertyConfiguration::Default; EnableThreadSafeExamplePooling = false; MaxExamples = INT32_MAX; Verbose = false; } VowpalWabbitSettings(String^ arguments) : VowpalWabbitSettings() { if (arguments != nullptr) Arguments = arguments; } /// /// Command line arguments. /// property String^ Arguments; /// /// Model used for initialization. /// property Stream^ ModelStream; /// /// Shared native vowpwal wabbit data structure. /// property VowpalWabbitModel^ Model; property ParallelOptions^ ParallelOptions; /// /// Set to true to disable example caching when used with a serializer. Defaults to true. /// property bool EnableExampleCaching; /// /// Maximum number of serialized examples cached. Defaults to UINT32_MAX. /// property uint32_t MaxExampleCacheSize; /// /// Maximum number of examples accepted by VowpalWabbitManager until Learn/Predict/... start to block. Defaults to UINT32_MAX. /// property uint32_t MaxExampleQueueLengthPerInstance; property uint32_t Node; property VowpalWabbit^ Root; property VowpalWabbitExampleDistribution ExampleDistribution; /// /// In multi-threaded mode, this is the number of examples processed per run. /// After ecah run the models are synchronized. /// Defaults to 1000. /// property uint32_t ExampleCountPerRun; /// /// Enable Vowpal Wabbit native string generation. /// property bool EnableStringExampleGeneration; /// /// Enable compact float serialization for Vowpal Wabbit native string generation. /// property bool EnableStringFloatCompact; property VW::Serializer::Schema^ Schema; property VW::Serializer::Schema^ ActionDependentSchema; property List^ CustomFeaturizer; property ITypeInspector^ TypeInspector; property PropertyConfiguration^ PropertyConfiguration; property bool EnableThreadSafeExamplePooling; property int MaxExamples; property bool Verbose; /// /// Action invoked for each trace message. /// /// /// The trace listener obeys the Verbose property, which defaults to false. /// property Action^ TraceListener; virtual Object^ Clone() { return MemberwiseClone(); } }; }