Leveraging the Wolfram Cloud to Deploy Tools in Excel

Andrew Yule, Pontem Analytics

(RowDefault[, (Spacer1), , (Spacer1), ])  #WolframTechConf

What kind of technology are companies using today?

Two ends of the spectrum:

SlideView[{Show[,ImageSize->600],Show[,ImageSize->350]},ImageSize->Automatic]

Delivering high-tech in a user friendly platform

Meeting companies where they are by delivering the latest in technology, but through a platform that nearly everyone will be familiar with.

Negatives of Excel:

Poor modeling capabilities (physics-based or data-driven)

Error prone (date entry etc.)

Limited flexibility

Positives of Excel:

Readily available at most companies

Data can be easily displayed and manipulated

Basic user interfaces, graphics, visualizations are easily created

End users have a platform that they can extend themselves

High-level workflow

Show[,ImageSize->1000]

What are the benefits?

“Math” is handled by Wolfram

Calculation logic is made separate from the user interaction

Protects your IP

Enables deployment to other platforms

Can be updated behind the scenes without updates to front end

Refresher on the Wolfram Cloud

SlideView[{Show[,ImageSize->700],Show[,ImageSize->700],Show[,ImageSize->700]}]

Why is the Wolfram Cloud so powerful?

Just like the Wolfram Language, everything is a symbolic object → creating, deploying, and manipulating expressions is easy

CloudDeploy[Manipulate[Plot[Sin[x(1+a x)],{x,0,6}],{a,0,2}],"WTC2024/SimpleManipulate"]

DeleteObject[%]

CopyFile[localFile,CloudObject["WTC2024/cloudFile"]]

Deploying API’s

A simple example:

Build out your function

xPlusTwo=APIFunction[{"x"->"Number"},Function[#x+2]]

xPlusTwo[<|"x"->2|>]

Deploy the API directly to the cloud

xPlusTwoAPI=CloudDeploy[xPlusTwo,"WTC2024/xPlusTwo",Permissions->"Public"]

Call the API

URLBuild[xPlusTwoAPI,<|"x"->2|>]

URLExecute[xPlusTwoAPI,<|"x"->2|>]

A more complicated example:

Create some random data

SeedRandom[1234];
xData=Range[20];
yData={Range[20]+RandomReal[{0,2},20],Range[20]+RandomReal[{0,8},20]};

Grid[{{
	ListPlot[Transpose[{xData,yData[[1]]}],],
	ListPlot[Transpose[{xData,yData[[2]]}],]
}}]

Build and train a neural network to predict our two dimensional outputs

net=NetChain[{2,Ramp,2}]

trainingData=Rule@@@Thread[{xData,Thread[yData]}]

netTrained=NetTrain[net,trainingData]

Grid[{{
	Show[
		ListPlot[Transpose[{xData,yData[[1]]}],],
		Plot[netTrained[x][[1]],{x,1,20},PlotStyle->Black]
	],
	Show[
	ListPlot[Transpose[{xData,yData[[2]]}],],
	Plot[netTrained[x][[2]],{x,1,20},PlotStyle->Black]
	]
}}]

Deploy the API directly to the cloud

mlModel=APIFunction[{"x"->"Number"},Function[netTrained[#x]],"JSON"]

mlModel[<|"x"->2|>]

mlModelAPI=CloudDeploy[mlModel,"WTC2024/mlModel",Permissions->"Public"]

Call the API

URLBuild[mlModelAPI,<|"x"->2|>]

URLExecute[mlModelAPI,<|"x"->2|>]

Calling API’s (from Excel)

Grid[{{Show[,ImageSize->250],Show[,ImageSize->200]},{Show[,ImageSize->250],Show[,ImageSize->200]}},Alignment->Center,Spacings->{4,1}]

A simple example:

A more complicated example:

Putting it all together

SlideView[{Show[,ImageSize->300],Show[,ImageSize->600]},ImageSize->Automatic]

A real-world example

www.pontemanalytics.com

SlideView[{Show[,ImageSize->900],Show[,ImageSize->900],Show[,ImageSize->900],Show[,ImageSize->900],Show[,ImageSize->900],Show[,ImageSize->900]},ImageSize->Automatic]

Recapping

Excel is still an important tool used throughout industries

The Wolfram Cloud is an amazing platform for easily deploying complex technologies

Combining these two can enable modern tech to be embedded in a user friendly tool