2
$\begingroup$

Consider the following combination of Manipulate and learned PredictorFunction:

trainingset = {1 -> 1.3, 2 -> 2.4, 3 -> 4.4, 4 -> 5.1, 6 -> 7.3};
predictorFunction = Predict[trainingset];
Manipulate[predictorFunction[x], {x, 1, 6}]

It works great in the notebook.

enter image description here

But when I CloudDeploy it sadly does not work :(

CloudDeploy[
 trainingset = {1 -> 1.3, 2 -> 2.4, 3 -> 4.4, 4 -> 5.1, 6 -> 7.3};
 predictorFunction = Predict[trainingset];
 Manipulate[predictorFunction[x], {x, 1, 6}]
  , Permissions -> "Public"
]

Question

How do I convert a learned PredictorFunction into an equivalent function that works when CloudDeploy-ed

$\endgroup$
1
  • $\begingroup$ This works for me on M12.2. Which version of M are you using to deploy the object to cloud? When I try to interact with your deployed object I see this error towards the end of error messages: "Message[LibraryFunction::notfound, \ "/home/conor/mathematica/SystemFiles/Links/DAALLink/\ LibraryResources/Linux-x86-64/DAALLink.so"]". $\endgroup$
    – dsingh
    Commented Feb 19, 2021 at 22:39

1 Answer 1

2
$\begingroup$

Apparently InterpolationFunctions are Manipulate-able in a CloudDeploy.

Thus one work-around is to sample some data from the PredictorFunction and then use Interpolation to approximate the PredictorFunction with an InterpolationFunction.

CloudDeploy[
 trainingset = {1 -> 1.3, 2 -> 2.4, 3 -> 4.4, 4 -> 5.1, 6 -> 7.3};
 predictorFunction = Predict[trainingset];
 interpolationFunction = Interpolation@Table[{x, predictorFunction[x]}, {x, 1, 6}];
 
 Manipulate[interpolationFunction[x], {x, 1, 6}]

  , Permissions -> "Public"]

https://www.wolframcloud.com/obj/7513658e-ef9e-4c2d-a0d6-369ac2d043d7

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.