Chapter 1. Manual Scoring Card Building Guide

This tutorial describes the manual scoring card building process using AdvancedMiner's Scoring card module.

Before building a scoring card it is required to have a table with the appropriate data avialable in the database. Moreover, it is assumed that the user is familiar with the QuickStart tutorial.

The presented example is based on the 'german_credit' dataset. All the quoted names are example names of the created objects.

During manual scoring card building process, the following MR objects are used:

Figure 1.1. Schema of the manual scoring card building process

Schema of the manual scoring card building process

The manual scoring card building task consists of two parts: scoring card structure building and assigning points to attribute levels.

If all the required objects were set up correctly, then after executing 'ScoringCardBuildTask' a new scoring card should appear in the MR repository. However, the card requires some additional settings connected with the target and manual assignment of points. (A yellow badge attached to the model icon indicates that the model is incomplete.) To finish the card building process it is necessary to perform the following additional steps:

After having successfully set all the required parameters the user can browse the card details by double-clicking the model icon (see the movie). The Figure below shows the content of the MR repository and the model created as the result of carrying out the steps described above.

Figure 1.2. The result of ScoringCardBuildTask

The result of ScoringCardBuildTask

The last action to be taken is to assign points to the attribute levels and optionally edit the levels (see the movie).

The steps described above can be also executed in a script.

Note

The script below contains only the card structure building process - it is recommended to assign points and edit levels using the card view.

Example 1.1. Manual scoring card building process


#                              MANUALL SCORING CARD BUILDING PROCESS  

# 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 -->> ScoringCardSettings()
#        -- we define that we are going to prepare scoring card
MFS = ScoringCardSettings()

# step 2a -- MiningFunctionSettings: add logicalData
#         -- we define the logical structure of the building data
MFS.setLogicalData(LogicalData(PD))

# step 2b -- MiningFunctionSettings -> attributeUsageSet: set target attribute
#         -- we choose the 'Class' attribute as the target
MFS.getAttributeUsageSet().getAttribute('Class').usage = UsageOption.target

# steps 2,2a,2b -- save MiningFunctionSettings into MR
save('ScoringCardSettings',MFS)

# step 3 -- create MiningBuildTask
#        -- we define the action we are going to do: model (card) building
MBT = MiningBuildTask()

# step 3a -- MiningBuildTask: add buildData
#         -- we choose the data for model building
MBT.setBuildDataName('german_credit_pd')

# step 3b -- MiningBuildTask: add functionSettings
#         -- we add the settings for scoring card building
MBT.setFunctionSettingsName('ScoringCardSettings')

# step 3c -- MiningBuildTask: add model 
#         -- we set the name of the output scoring card
MBT.setModelName('CARD')

# steps 3,3a,3b,3c -- save MiningBuildTask into MR
save('ScoringCardBuildTask',MBT)

# step 4 -- execute task
execute('ScoringCardBuildTask')

# step 5 -- CARD: setting the target properties
#        -- we load the model 'CARD' for further editing
M = load('CARD')

# step 5a -- properties: we define the target
#         -- we define the 'Class' attribute as the target
M.setTargetAttributeName('Class')

# step 5b -- properties: set positive and negative target values
#         -- we set the value 'bad' as the positive target category and the value 'good' as
#            the negative target category
M.setPositiveTargetValue('bad')
M.setNegativeTargetValue('good')

# step 5c -- properties: set the type of the target variable
#         -- we set the type 'string' for the target variable 
M.setTargetAttributeDataType(AttributeDataType.stringType)

# steps 5,5a,5b,5c -- save changes done to the scoring card
save('CARD' , M)


print "Done..."

Output:

Done...