Welcome to mirror list, hosted at ThFree Co, Russian Federation.

explore_interface.h « clr « explore - github.com/moses-smt/vowpal_wabbit.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 3212b4d88f267d091905ae0a6c790647cdf9d8ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#pragma once

using namespace System;
using namespace System::Collections::Generic;

/** \defgroup MultiWorldTestingCsharp
\brief C# implementation, for sample usage see: https://github.com/sidsen/vowpal_wabbit/blob/v0/cs_test/ExploreOnlySample.cs
*/

/*!
*  \addtogroup MultiWorldTestingCsharp
*  @{
*/

//! Interface for C# version of Multiworld Testing library.
//! For sample usage see: https://github.com/sidsen/vowpal_wabbit/blob/v0/cs_test/ExploreOnlySample.cs
namespace MultiWorldTesting {

/// <summary>
/// Represents a recorder that exposes a method to record exploration data based on generic contexts. 
/// </summary>
/// <typeparam name="Ctx">The Context type.</typeparam>
/// <remarks>
/// Exploration data is specified as a set of tuples <context, action, probability, key> as described below. An 
/// application passes an IRecorder object to the @MwtExplorer constructor. See 
/// @StringRecorder for a sample IRecorder object.
/// </remarks>
generic <class Ctx>
public interface class IRecorder
{
public:
	/// <summary>
	/// Records the exploration data associated with a given decision.
	/// </summary>
	/// <param name="context">A user-defined context for the decision.</param>
	/// <param name="action">Chosen by an exploration algorithm given context.</param>
	/// <param name="probability">The probability of the chosen action given context.</param>
	/// <param name="uniqueKey">A user-defined identifer for the decision.</param>
	virtual void Record(Ctx context, UInt32 action, float probability, String^ uniqueKey) = 0;
};

/// <summary>
/// Exposes a method for choosing an action given a generic context. IPolicy objects are 
/// passed to (and invoked by) exploration algorithms to specify the default policy behavior.
/// </summary>
/// <typeparam name="Ctx">The Context type.</typeparam>
generic <class Ctx>
public interface class IPolicy
{
public:
	/// <summary>
	/// Determines the action to take for a given context.
	/// </summary>
	/// <param name="context">A user-defined context for the decision.</param>
	/// <returns>Index of the action to take (1-based)</returns>
	virtual UInt32 ChooseAction(Ctx context) = 0;
};

/// <summary>
/// Exposes a method for specifying a score (weight) for each action given a generic context. 
/// </summary>
/// <typeparam name="Ctx">The Context type.</typeparam>
generic <class Ctx>
public interface class IScorer
{
public:
	/// <summary>
	/// Determines the score of each action for a given context.
	/// </summary>
	/// <param name="context">A user-defined context for the decision.</param>
	/// <returns>Vector of scores indexed by action (1-based).</returns>
	virtual List<float>^ ScoreActions(Ctx context) = 0;
};

generic <class Ctx>
public interface class IExplorer
{
};

public interface class IStringContext
{
public:
	virtual String^ ToString() = 0;
};

}

/*! @} End of Doxygen Groups*/