For a long time Bayes Server has supported reading data from Excel and writing data to Excel, but you can also call Bayes Server directly from Excel functions. The examples below make use of the Bayes Server .NET API and Excel-DNA.
To create Excel functions that call Bayes Server use the steps below to create and build a new C# project:
Install-Package Excel-DNA
C:\Program Files\Bayes Server\Bayes Server x.x\API\NET 4.0\
)BayesServerInferenceFunctions.cs
and copy the code from the Inference example into the editor..xll
files in the project output folder..xll
fileOne the above steps have been completed a function called PredictVariable
will be available in Excel.
Note that the
PredictVariable
function takes a 2-D array of values (columns of data) and expects a header with variable names. Using an array function allows us to perform 1000s of predictions while only loading the network once.
You can download BayesExcel.xlsx for example usage.