Aracılığıyla paylaş


clsMiningModel

Not

  Bu özellik Microsoft SQL Server'ın bir sonraki sürümünde kaldırılacaktır. Yeni geliştirme işlerinde bu özelliği kullanmayın ve bu özelliği kullanmakta olan uygulamaları mümkün olduğunca erken bir zamanda değiştirin.

Objects of ClassType clsMiningModel contain the definitions for data mining models that are contained in the MiningModels collection of a clsServer object.Her modeli olarak adlandırılan koleksiyon içerir Columns veri madenciliği sütunlar koleksiyonu (yani, nesnelerin ClassType clsColumn) modeli. durum tablo tanımını karşılıkBu veri madenciliği sütunların her biri, kendi içerebilir koleksiyon sütunların veri madenciliği Columns koleksiyon.Bu tür sütunları iç içe sütun olarak adlandırılır.Ek olarak Columns koleksiyonu, araştırma modeli nesne başvuruları da içeren Roles, DataSources ve CustomProperties koleksiyonlar, hangi kullanılan aynı şekilde karşılıkları altında küp nesne.

Açıklamalar

Bir araştırma modeli nesnesini çağırarak oluşturduktan sonra AddNew yöntem sunucu nesnesinin MiningModels koleksiyon, araştırma modeli. yapısını tanımlamakBu ayarlayarak modelinin alt sınıfı türünü belirlemek için bu süreçte en önemli adım olduğu özellik için ya da sbclsOLAP veya sbclsRelational.Veri madenciliği modelleri whose SubClassType olan sbclsOLAP (yani, olap veri madenciliği modelleri) esas alan bir OLAP küp.Veri madenciliği modelleri whose SubClassType olan sbclsRelational (yani, ilişkisel veri madenciliği modelleri) esas alan bir tablo ilişkisel veritabanı.Modelin seçimi SubClassType modelin yapısının geri kalanını nasıl tanımlandığını belirler.Bundan sonra model tasarımı, model kullanan veri madenciliği algoritmasını ve modeli ile ilişkili roller gibi diğer öğeleri belirleyebilirsiniz.

olap veri madenciliği modelleri

durum için bir olap veri küme oluşturmak için araştırma modeli, küme CaseDimension özellik clsMiningModel nesne için bir boyut içinde bir küp; Bu otomatik olarak sağlar case düzey tanımlar durum anahtar olarak seçilen boyut en son etkin ve görünür düzeyinde araştırma modeli sütunlar.Daha sonra küme tek tek sütunlarda Columns topluluğu clsMiningModel boyutları, üyeler, üye özellikleri belirtmek için nesne ve önlemleri küpteki giriş ve öngörü bilgi. için kullanılacak

İlişkisel veri madenciliği modelleri

durum için ilişkisel bir veri küme oluşturmak için araştırma modeli, bir tablo veya görünümü ilişkisel bir veritabanında bulunan anahtar sütunları seçin ve sonra sütun nesneleri ekleme Columns koleksiyonu başvurmak için anahtar bu sütunlar.Sonra diğer sütunlara başvuru sütunları ekleyin tablo için Columns giriş ve predic sağlamak için toplama,tablo bilgi için veri madenciliği model.

Örnekler

A.olap madenciliği Model el ile oluşturma

Aşağıdaki örnekte satış küp temel alan bir araştırma modeli oluşturur FoodMart 2000 örnek veritabanı:

Public Sub CreateOlapMiningModel_1()
'------------------------------------------------------------------------
' Declarations - Identify all of the variables that will be needed to
' create the data mining model.
'------------------------------------------------------------------------
    Dim dsoSvr As New DSO.Server ' Server object
    Dim dsoDmm As DSO.MiningModel ' Note that because events are needed,
    ' this object is being invoked directly instead of through an MDStore interface..
    Dim dsoColumn As DSO.Column
    Dim dsoRole As DSO.Role
    Dim dsoNestedCol As DSO.Column
    Dim dsoCb As DSO.MDStore 
    Dim dsoDim As DSO.Dimension
    Dim dsoLvl As DSO.Level
    
'------------------------------------------------------------------------
' Connect to the server and walk through the schema for the cube that the
' data mining model will be based on. Save the references to the 
' subordinate objects that will be needed later in this example.
'------------------------------------------------------------------------
    'Connect to the server on this computer.
    dsoSvr.Connect "LocalHost"
    'Select the FoodMart database.
    Set dsoDb = dsoSvr.MDStores("Foodmart 2000")
    'Select the Sales cube.
    Set dsoCb = dsoDb.MDStores("Sales")
    'Select the Customers dimensions.
    Set dsoDim = dsoCb.Dimensions("Customers")
    'Select the Name level of the Customers dimension.
    Set dsoLvl = dsoDim.Levels("Name")
    
'------------------------------------------------------------------------
' 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 the schema, and declare the
' algorithm that will be used to predict with.
' Finally, set up the OLAP properties that will be needed by the model.
'------------------------------------------------------------------------
    'Check for the existence of the model on this computer.
    If Not dsoDb.MiningModels("CustSalesModel") Is Nothing Then
        'If this model exists, delete it.
        dsoDb.MiningModels.Remove "CustSalesModel"
    End If
    
    'Create a new mining model called CustSalesModel.
    Set dsoDmm = dsoDb.MiningModels.AddNew("CustSalesModel", sbclsOlap)
    
    'Designate FoodMart 2000 as the data source for this mining model.
    dsoDmm.DataSources.AddNew "Foodmart 2000"
    
    'Create a new mining model role called All Users.
    Set dsoRole = dsoDmm.Roles.AddNew("All Users")
    
    'Describe this new mining model.
    dsoDmm.Description = "Analyzes the purchasing behavior of customers"
    'use the Decision Trees algorithm in this model.
    dsoDmm.MiningAlgorithm = "Microsoft_Decision_Trees"
    'Declare that the Sales cube will be used as the source for this model.
    dsoDmm.SourceCube = "Sales"
    'Declare that the case dimension will be based on the Customers
    'dimension from the Sales cube.
    dsoDmm.CaseDimension = "Customers"
    'Use the Name level of the Customers dimension for cases.
    dsoDmm.CaseLevel = "Name"
    'Let DSO figure out the training query by leaving this property blank.
    dsoDmm.TrainingQuery = ""
    
'------------------------------------------------------------------------
' Add a new column, Customer Id, to the mining model 
' and relate this column to the Name level of the Customers dimension.
' Describe the level's type and make it a key for the model.
'------------------------------------------------------------------------
    'Add Customer Id as a new column in the model.
    Set dsoColumn = dsoDmm.Columns.AddNew("Customer Id")
    'Identify the level in Sales that this column is based on.
    Set dsoColumn.SourceOlapObject = dsoLvl
    'Identify the type of column this is.
    dsoColumn.DataType = adInteger ' This enumeration is from ADO.
    'Identify this column as a key.
    dsoColumn.IsKey = True
    
'------------------------------------------------------------------------
' Add a new column to the mining model called Gender and relate this
' column to the Gender member property of the Name level of the
' Customers dimension. Declare that the data in this column is
' statistically discrete.
'------------------------------------------------------------------------
    'Add another column to the model.
    Set dsoColumn = dsoDmm.Columns.AddNew("Gender")
    'Identify the member property of the Customers dimension
    'that this column is based on.
    'Set the column's description for browsers of the schema.
    dsoColumn.Description = "Based on the Gender member property " & _
      "of the Name level of the Customers dimension."
    Set dsoColumn.SourceOlapObject = dsoLvl.MemberProperties("Gender")
    'Identify its type.
    dsoColumn.DataType = adWChar
    'Make this column related to the Customer Id column.
    dsoColumn.RelatedColumn = "Customer Id"
    'Identify this column as one containing discrete data.
    dsoColumn.ContentType = "DISCRETE"
    
'------------------------------------------------------------------------
' Add a new column to the mining model called Unit Sales and relate
' this column to the Sales cube measure of the same name. Set the
' columns data type to Integer, and identify the data content in it as
' being continuous and logarithmically normalized. Finally, identify this
' column as being predictable.
'------------------------------------------------------------------------
    'Add another column to the model.
    Set dsoColumn = dsoDmm.Columns.AddNew("Unit Sales")
    'Identify this column as being based on the Unit Sales measure.
    Set dsoColumn.SourceOlapObject = dsoCb.Measures("Unit Sales")
    'Identify the column type.
    dsoColumn.DataType = adInteger
    'Identify this column's content as being continuous.
    dsoColumn.ContentType = "CONTINUOUS"
    'Identify the statistical distribution of this data.
    dsoColumn.Distribution = "LOG_NORMAL"
    'Identofy the column as being predictable.
    dsoColumn.IsPredictable = True
    
'------------------------------------------------------------------------
' Save the mining model and update its LastUpdated property.
'------------------------------------------------------------------------
    'Set the date of last update to today's date.
    dsoDmm.LastUpdated = Now
    'Save the model definition.
    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"
    'Fully process the model.
    dsoDmm.Process processFull
    'Unlock the model after processing is complete.
    dsoDmm.UnlockObject
End Sub

B.olap araştırma modeli otomatik olarak oluşturma

Aşağıdaki örnek, otomatik olarak oluşturur ve olap araştırma modeli göre Sales , küp FoodMart2000 Veritabanı:

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.
' Finally, set up the OLAP properties that the model will need.
'------------------------------------------------------------------------
    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.TrainingQuery = "" 'Let DSO figure out the training query.
    
'------------------------------------------------------------------------
' In this next step, the update method checks to see whether there are any
' columns in the columns collection. In this case, because there are not
' 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, ReportBefore,
' ReportProgress, and ReportError events.
'------------------------------------------------------------------------
    'Because the model is about to be processed, lock it.
    dsoDmm.LockObject olapLockProcess, "Processing the data mining model in sample code"
    'Process the model.
    dsoDmm.Process processFull
    'Unlock the model.
    dsoDmm.UnlockObject
End Sub

Ayrıca bkz.

Başvuru