|< Day Day Up >|
Closed Loop Processing
Successful data-mining involves testing the predictions against additional datasets. It can also involve evaluating the success of predictions through various means. A table named ProductAvailabilityTracking is utilized for our simulation of purchases made at SavingsMart. This table indicates missed sales opportunities for each store. Initially we attempted to apply the predictions made by the mining model once and then utilize the same predictions for the next six months.
Closed loop processing involves an iterative process of reevaluation in which the mining model is refreshed with new data and therefore new predictions may be made. The new predictions are then written back to the database in an effort to attain better results.
The LoadSampleData project for Chapter 6 has a button named Simulate Closed Loop Process. This button initiates the SimulateDailyProcessing routine, as follows:
' We will loop through a process for a half a year, ' but will only refresh the mining model and apply the ' results once every 14 days instead of once a day ' since refreshing the data takes a long time. Dim i As Int16, j As Int16 = 0 Dim dDate As DateTime = "01/01/2002" For i = 0 To 182 GeneratePurchases(dDate) dDate = dDate.AddDays(1) j += 1 If j = 13 Then j = 0 ProcessMiningModel(dDate) PopulateShipmentSchedulesTable(True) ApplyShipmentSchedules() End If Next
The closed loop process generates purchases for fourteen days and then initiates a refresh of the Analyze Shipments mining model. Refreshing the Analyze Shipment model is accomplished by calling the ProcessMiningModel routine and may result in the prediction of new values for the ShipmentSchedules table. The code for this routine is as follows:
Dim oServer As New DSO.Server Dim oDatabase As New DSO.Database Dim oModels As DSO.OlapCollection Dim oModel As DSO.MiningModel 'Connect to the Analysis Server Try oServer.Name = sAS oServer.Connect() Catch ex As Exception MessageBox.Show("Connection to the Analysis Server failed") Exit Sub End Try 'Open the database and set reference to the mining model Try oDatabase = oServer.MDStores.Item(sASDB) oModels = oDatabase.MiningModels() oModel = oModels.Item(sModel) Catch ex As Exception MessageBox.Show("Unable to open the database and mining model") Exit Sub End Try 'Update the mining model Try oModel.LastUpdated = sDate oModel.Update() Catch ex As Exception MessageBox.Show("Unable to update the mining model") Exit Sub End Try 'Refresh the mining model Try oModel.LockObject(OlapLockTypes.olapLockProcess, "Training _ the Shipments mining model") oModel.Process(ProcessTypes.processRefreshData) oModel.UnlockObject() Catch ex As Exception MessageBox.Show("Unable to refresh the mining model") Exit Sub End Try
Closed loop processing is the best method for dealing with real-world situations. After all, many factors go into customer buying habits. What was true at the beginning of the year, may not hold true at the end. Closed loop processing allows you to continually reevaluate the data to ensure that predictions have not changed.
|< Day Day Up >|