Udostępnij za pośrednictwem


Aktualizacja (clsMiningModel)

Ostrzeżenie

  Ta funkcja zostanie usunięta z następnej wersji programu Microsoft SQL Server. Nie należy stosować tej funkcji w nowych projektach oraz jak najszybciej należy zmodyfikować aplikacje, w których obecnie jest używana ta funkcja.

The Update method of an object of ClassType clsMiningModel saves the mining model along with its Columns collection to the repository.

Składnia

object.Update

Parametry

  • object
    model wyszukiwania Aktualizację obiektu.

Uwagi

Górnictwo modeli SubClassType sbclsOlap, Update Metoda sprawdza, czy Columns Kolekcja jest pusta.Jeśli tak jest, metoda automatycznie wypełni Columns kolekcja oparty na strukturze moduł źródłowy przed zapisaniem do repozytorium.

Domyślnie tylko Column obiekt, który odpowiada CaseLevel Właściwość model wyszukiwania jest włączone; CaseLevel jest taki sam jak poziom obiektu z SourceCube z model wyszukiwania, i zapewnia przypadkach dla modelu.Użytkownicy mogą wybrać i włączyć innych kolumn, ustawiając IsDisabled Właściwość Column obiektów na False.

Przykłady

Tworzenie modelu OLAP górnictwo

Poniższy przykład tworzy model wyszukiwania OLAP bez jawnego przypisywania żadnych kolumn w modelu.Update metoda automatycznie utworzy strukturę kolekcja Columns oparte na moduł źródłowydla architektury i ustawia ich IsDisabled Właściwości True.W przykładzie następnie włącza niektóre kolumna i sprawia, że UnitSales kolumna przewidywalny.

Public Sub CreateOlapMiningModel_2()
'------------------------------------------------------------------------
' Declarations - Identify all of the variables that will be needed to
' create the data mining model.
'------------------------------------------------------------------------
    Dim dsoSvr As New DSO.Server
    Dim dsoDmm As DSO.MiningModel
    Dim dsoColumn As DSO.Column
    Dim dsoRole As DSO.Role
    Dim dsoNestedCol As DSO.Column

'------------------------------------------------------------------------
' Before the model is created, check for a previous incarnation of it.
' If it exists, delete it. Then create a new one.
' Give the new model a new data source, and give it a role.
' Then describe the model for browsing of the schema, and declare the
' algorithm that will be used to predict with.
' Lastly, set up the OLAP properties that will be needed by the model.
'------------------------------------------------------------------------
    dsoSvr.Connect "LocalHost"
    Set dsoDb = dsoSvr.MDStores("Foodmart 2000")
    
    If Not dsoDb.MiningModels("CustSales_Olap2") Is Nothing Then
        dsoDb.MiningModels.Remove "CustSales_Olap2"
    End If
    
    Set dsoDmm = dsoDb.MiningModels.AddNew("CustSales_Olap2", sbclsOlap)
    


    'Create a new mining model role called All Users.
    Set dsoRole = dsoDmm.Roles.AddNew("All Users")

    
    dsoDmm.Description = "Analyzes the purchasing behavior of customers"
    dsoDmm.MiningAlgorithm = "Microsoft_Decision_Trees"
    dsoDmm.SourceCube = "Sales"
    dsoDmm.CaseDimension = "Customers"
    dsoDmm.CaseLevel = "Name"
    dsoDmm.TrainingQuery = "" 'Let DSO figure out the training query.
    
'------------------------------------------------------------------------
' In the next step, the Update method checks to see whether there are any
' columns in the columns collection. In this case, because there aren't
' any, the update method will automatically add columns based on the
' structure of the Sales cube.
'------------------------------------------------------------------------
    dsoDmm.Update 'Let DSO automatically populate the Columns collection.
    
    'Enable the Products dimension.
    'Set dsoColumn = dsoDmm.Columns("Products")
    'dsoColumn.IsDisabled = False

    'Make the Unit Sales measure predictable.
    Set dsoColumn = dsoDmm.Columns("Unit Sales")
    'Enable the column.
    dsoColumn.IsDisabled = False
    'Make the column predictable.
    dsoColumn.IsPredictable = True

    ' Set the last updated date to today's date.
    dsoDmm.LastUpdated = Now
    ' Save the model's metadata.
    dsoDmm.Update
'------------------------------------------------------------------------
' Lock the cube, process it, and then unlock it.
' Note: During processing a number of events will be fired. These events
' are trapped by the database object's ReportAfter, Report Before,
' ReportProgress, and ReportError events.
'------------------------------------------------------------------------
    'Because the model is about to be processed, it must be locked.
    dsoDmm.LockObject olapLockProcess, "Processing the data mining model in sample code"
    'Process the model.
    dsoDmm.Process processFull
    'Unlock the model.
    dsoDmm.UnlockObject
End Sub