This tutorial shows how to carry ou a typical classification model testing process in AdvancedMiner. All quoted names are example names of created objects.
To test a model, it is necessary to:
Assumption: in the following example, it is assumed that user has only a single model object in the MR repositiory, which was built during a certain model building process.
During the model testing process, the following MR objects are used:
The model testing task consists of the following steps:
If all the required objects were set up correctly, then after executing ClassificationTestTask a test results object should appear in the MR repository. The user can browse test results by expanding object icon and double-clicking contrained results ( see the movie ). The particular set of available statistics and evaluation measures depends on the model type. The Figure below shows the content of the MR repository and example test results created after carrying out previously described steps.
The steps described above can be also executed in a script.
Example 6.1. ModelTesting
# MODEL TESTING PROCESS
# -- we assume that a model named 'MODEL' has already been build and it exists in the repository
# step 1 -- create and save PhysicalData in MR
# -- we choose the building data: 'german_credit'
PD = PhysicalData('german_credit')
save('german_credit_pd',PD)
# step 2 -- create MiningFunctionSettings -->> ClassificationFunctionSettings
# -- we define that we are going to test a classification model
CTT = ClassificationTestTask()
# step 2a -- ClassificationTestTask: add model
# -- we choose the model that we want to test
CTT.setModelName('MODEL')
# step 2b -- ClassificationTestTask: add testData
# -- we choose the data for model testing
CTT.setTestDataName('german_credit_pd')
# step 2c -- ClassificationTestTask: add testResult
# -- we set the object name of the obtained testing results
CTT.setTestResultName('TestResults')
# step 2d -- ClassificationTestTask - properties: set target attribute
# -- we define the 'Class' attribute as the target
CTT.setTarget('Class')
# step 2e -- ClassificationTestTask - properties: set positive target value
# -- we set the value 'bad' as the positive target category
CTT.setPositiveTargetValue('bad')
# steps 2,2a,2b,2c,2d,2e -- save ClassificationTestTask in MR
save('TestTask',CTT)
# step 3 -- execute task
execute('TestTask')
print "Done..."
Output:
Done...