Database Reference
In-Depth Information
SarsaVector
, it requires a special action object
ComposedAction
to store
the actions. The reason is that we may have multiple recommendations as action.
ComposedAction
extends
Action
and has a dual function: it represents a unique,
composed action and at the same time stores all the single actions, i.e., the
recommended products. At this, each attribute of
ComposedAction
represents a
single recommendation. The index of
ComposedAction
stores the selected action,
i.e., the “recommendation” that actually has been accepted.
RecommVector
owns the method
public
RecommVector
toSelectedRecommVector()
throws
MiningException;
which transforms the recommendation vector into a new instance which only
contains the selected actions instead of all recommended ones, i.e., the new
recommendation vector stores the real transitions of the SARSA tuple as in
Fig.
3.7
.
Finally, we have the abstract class
RecommEnvironment
that extends
Environ-
ment
of the
RL
package and implements
StateBasedActionSet
, an interface
reflecting the isomorphism between states and actions (4.1). Further,
RecommEn-
vironment
contains methods for the mapping between states/actions and their
indexes and a special handling for absorbing states. Additionally,
RecommEn-
vironment
provides methods to access transition probabilities.
Example 12.23
We consider our small test shop of Example 5.4. To make the case
more realistic, we further assume that in the course of the sessions, recommenda-
tions are displayed. We select the DP Algorithm of Sect.
5.2
. In the following, we
describe an implementation of a simple recommendation engine by means of the
Recomm
package. We start with the overall execution method:
/** The environment object. */
protected RecommEngineEnvironment recoEnv
¼
null;
/** The recommendation agent. */
protected RecommAgent agent
¼
null;
/**
* Run the recommendation engine example.
*
* @throws MiningException error while example is running
*/
public void run() throws MiningException {
// Create recommendation environment:
recoEnv
¼
new RecommEngineEnvironment();
recoEnv.init(null);
// Create recommendation agent:
agent
¼
createDPRecommAgent();