With the introduction of Cognalysis MultiRate Version 5, users now have the ability to automatically create a DLL to assist in more easily implementing MultiRate models in other applications.

Starting with a fully-optimized model, simply select File…Create API in MultiRate, and the software will create four files for you:

  1. {model name}_COM.dll — the COM DLL file
  2. {model name}_COM.txt — the COM code underlying the compiled COM DLL
  3. {model name}_NET.dll — the DotNET DLL file
  4. {model name}_NET.txt — the DotNET code underlying the compiled .NET DLL

Program Specific Tutorials:

The below code shows how to use a MultiRate DLL in Python.

## MultiRate DLL Wrapper Code
#############################
# import 3rd party package
import clr
from datetime import datetime

# Update this value
path = r"G:\Tools\Cognalysis Software\MultiRate\Testing\Kristan Testing\Testfolder\wage_kEuro_1_NET.dll"

# Insert path to NET DLL
clr.AddReference(path)
import clr

# Import model name. Convention is Model_*name of multirate model
# Update this value
oMod = clr.Model_wage_kEuro_1()

def prediction(*args):
    final = oMod.Predict(*args)
    return [final[i] for i in range(len(final))]
    # ls[0]  = predicted value
    # ls[1] = base factors
    # ls[2-end] = factors for each variable
    # Note: ls[0] = product(ls[1:])

def ticks(dt):
    # Input Type: datetime object. 
    # Output Type: float
    return (dt - datetime(1, 1, 1)).total_seconds() * 10000000

# Input: All arguments for DLL in proper order.
##  Note: for a date field, the DLL requires the net defined Ticks. Use Ticks helper function.
# Output: Result list
joined_date = ticks(datetime(2018, 7, 16))
prediction_list = prediction(34, 0, "Right", 0, 4, 0, joined_date, 0, 26.9,0, True)
print(prediction_list)

To download files referenced in this tutorial, visit https://github/Cognalysis-Support/MultiRate-DLL

If you need help getting R integrated with Microsoft Excel, see our page with full instructions and downloads for Installing BERT2 to Integrate R and Excel.