Java Reference
In-Depth Information
subsequent reference by name. See Chapter 8 for more details on
JDM persistence. We then create the object that contains the classifi-
cation settings, namely, the parameters that instruct the DME what
type of model to build. Initially, DMWhizz will rely on the DME to
decide the type of model to build, so we only need to specify the
target, in this case, response .
We then create a build task object, specifying the input build data,
the settings, and the name we want to give the resulting model. After
saving that object, we execute it and check the resulting status. Upon
success, we can retrieve the model if desired.
We can inspect the model that was produced to see which algo-
rithm the DME chose. In the variable algorithm , the value is the min-
ing algorithm “decisiontree,” meaning a decision tree, which
// Create the physical representation of the data
PhysicalDataSetFactory pdsFactory (PhysicalDataSetFactory)
dmeConn.getFactory (””);
PhysicalDataSet pd pdsFactory.create( ”CUSTOMER_BUILD”, true );
dmeConn.saveObject( ”customer_build”, pd, REPLACE);
// Create and save a settings object to be used for a classification model
ClassificationSettingsFactory csFactory (ClassificationSettingsFactory)
”javax.datamining.supervised.classification.ClassificationSettings” );
ClassificationSettings settings csFactory.create();
settings.setTargetAttributeName( ”RESPONSE” );
dmeConn.saveObject( ”response_settings”, settings, REPLACE);
// Create the build task and verify the task before execution
BuildTaskFactory btFactory (BuildTaskFactory)
dmeConn.getFactory( ”javax.datamining.task.BuildTask” );
BuildTask buildTask
btFactory.create( ”customer_build”, ”response_settings”, ”resp_model_1” );
dmeConn.saveObject( ”response_build_task”, buildTask, REPLACE );
// Execute the task and block until finished
ExecutionHandle handle dmeConn.execute( ”response_build_task” );
handle.waitForCompletion( Integer.MAX_VALUE ); // wait until done
// Access the model if model was successfully built
ExecutionStatus status handle.getLatestStatus();
if( ExecutionState.success.equals( status.getState() ) ) {
ClassificationModel model (ClassificationModel)
dmeConn.retrieveObject( ”resp_model_1”, NamedObject.model );
ClassificationSettings settings
(ClassificationSettings) model.getEffectiveSettings ();
MiningAlgorithm algorithm settings.getMiningAlgorithm();
Search WWH ::

Custom Search