Results 1 to 4 of 4

Thread: Neural networks in VBA

Threaded View

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2012
    Posts
    7

    Neural networks in VBA

    If you guys have some experience from Pytorch or other major deep learning frameworks, and have some time to spare, give my simple neural network project (maybe the first one in VBA?) a test run. Big plus if you can test it with OpenBLAS dll which you put inside the same folder as the Excel workbook and edit the dll path in BlasFunctions module -- OpenBLAS provides prebuilt binary packages here https://sourceforge.net/projects/ope...files/v0.3.27/:

    https://github.com/personalityson/VBANN

    Code:
    Option Explicit
    
    Const MODEL_NAME As String = "MyModel"
    
    Private m_oModel As Sequential
    
    Public Sub SetupAndTrain()
        Dim lBatchSize As Long
        Dim lNumEpochs As Long
        Dim oTrainingSet As DataLoader
        Dim oTestSet As DataLoader
        
        VerifyOpenBlasLibrary
        
        lBatchSize = 10
        lNumEpochs = 50
        
        Set oTrainingSet = DataLoader(ImportDatasetFromWorksheet("ConcreteTrain", 8, 1, True), lBatchSize)
        Set oTestSet = DataLoader(ImportDatasetFromWorksheet("ConcreteTest", 8, 1, True), lBatchSize)
        
        Set m_oModel = Sequential(L2Loss(), SGDM())
        m_oModel.Add FullyConnectedLayer(8, 200)
        m_oModel.Add LeakyReLULayer()
        m_oModel.Add FullyConnectedLayer(200, 100)
        m_oModel.Add LeakyReLULayer()
        m_oModel.Add FullyConnectedLayer(100, 50)
        m_oModel.Add LeakyReLULayer()
        m_oModel.Add FullyConnectedLayer(50, 1)
        m_oModel.Fit oTrainingSet, oTestSet, lNumEpochs
        Serialize MODEL_NAME, m_oModel
        
        Beep
    End Sub
    
    Public Sub ContinueTraining()
        Dim lBatchSize As Long
        Dim lNumEpochs As Long
        Dim oTrainingSet As DataLoader
        Dim oTestSet As DataLoader
    
        VerifyOpenBlasLibrary
        
        lBatchSize = 10
        lNumEpochs = 50
        
        Set oTrainingSet = DataLoader(ImportDatasetFromWorksheet("ConcreteTrain", 8, 1, True), lBatchSize)
        Set oTestSet = DataLoader(ImportDatasetFromWorksheet("ConcreteTest", 8, 1, True), lBatchSize)
        
        Set m_oModel = Unserialize(MODEL_NAME)
        m_oModel.Fit oTrainingSet, oTestSet, lNumEpochs
        Serialize MODEL_NAME, m_oModel
        
        Beep
    End Sub
    Thanks
    Last edited by drgs; Jul 30th, 2024 at 06:19 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width