Database Reference
In-Depth Information
// Put it all together:
agent.setAgentSettings(settings);
agent.setAgentEnvironmentInformation(env);
agent.verify();
// Apply and learn:
int indItem
¼
metaData.getAttributeIndex("itemID");
int indUnits
¼
metaData.getAttributeIndex("units");
while ( inputData.next() ) {
MiningVector mv
¼
inputData.read();
Category itemID
¼
mv.getValueCategory(indItem);
// Get recommended price:
double price
¼
agent.apply(mv);
// Recommend price for item ID, get units ordered (0 if no
order):
int unitsOrdered
¼
getResponse(itemID, price); // not
shown here
mv.setValue(indUnits, unitsOrdered);
// Learn from response (stateful):
agent.addData(mv);
agent.learn();
// Alternative - Learn from response (stateless):
// agent.learn(mv);
}
// Write to PMML:
FileWriter
¼
writer
new
FileWriter("data/pmml/
LinElastAgent.xml");
agent.writePmml(writer);
■
Finally, we notice that the
Agent
package provides a useful wrapper class
MiningModelAgent
, which extends
Agent
, in order to use data mining models/
algorithms as described in Sect.
12.1.3
inside the agent framework. This is of
particular interest for updateable mining models such as na¨ve Bayes or adaptive
decision trees. At this, to
MiningModelAgent
,a
MiningModel
and a suitable
MiningAlgorithm
can be assigned and can then be used as an agent.
12.2.2 The Reinforcement Learning Package
In XELOPES, the reinforcement learning package is implemented as subpackage
RL of the
Agent
package (previous section). The RL package in turn contains the
following subpackages: