Message Boards Message Boards

Manipulate function on Wolfram cloud?

Posted 3 years ago

I was able to create an interactive app on Mathematica using the Manipulate function. The code uses 4 chemical descriptors (Atom Count, Molecular Mass, Radius of Gyration, and Plane of Best Fit Distance) to calculate the property Molecular Surface Area. This app makes it so you can type values for each descriptor in a text box to receive the predicted Molecular Surface Area made through the machine learning algorithm. Find the described app attached below:

Framed[Manipulate[
  ToString[pred2o[{atomCount, molecularMass, radiusOfGyration, 
     planeOfBestFitDistance}]], 
  Style["Biomolecules Molecular Surface Area Calculator", 14, Bold, 
   Orange], 
  Delimiter, {{atomCount, 20, "Atom Count"}, 2, 
   120}, {{molecularMass, 146, "Molecular Mass"}, 26.038`, 
   822.942`}, {{radiusOfGyration, 2.5, "Radius of Gyration"}, 
   0.22462`, 
   10.7024`}, {{planeOfBestFitDistance, 0.55, 
    "Plane of Best Fit Distance"}, 0.`, 1.22643`}, 
  ControlType -> InputField, SaveDefinitions -> True, 
  ControlPlacement -> Left, Paneled -> False], FrameMargins ->
  5, Background -> Lighter[Gray, 0.9]]

The issue with this is that this code is only interactive when I run it on my notebook with the defined variables for everything. I am looking for a way to make this app useable on the Wolfram Cloud using the CloudDeploy function. I am unsure how to do this and I believe it does not work because the predictor function is not defined in the line of code (https://www.wolframcloud.com/obj/98a3405b-5ec1-48bd-9377-101c7ed8c756). I am unsure how to fix this so if anyone can assist with this, please let me know. I have attached the code for the predictor function and a sample of the training set.

pred2o = Predict[trainingSet1, Method -> "NeuralNetwork"]

 RandomSample[trainingSet1, 100]

{{12, 90.078, 1.72086, 0.539065} -> 
  43.8223, {13, 102.089, 1.82591, 0.277664} -> 
  49.7005, {18, 158.156, 2.36301, 0.00656653} -> 
  77.9486, {22, 179.175, 3.05232, 0.207595} -> 
  87.9828, {9, 68.079, 1.24345, 6.15254*10^-6} -> 
  35.5382, {14, 144.557, 2.21042, 0.004465} -> 
  64.5213, {13, 107.112, 1.94565, 0.} -> 
  54.2024, {17, 119.12, 1.80421, 0.69778} -> 
  60.0127, {17, 115.132, 1.85582, 0.653248} -> 
  60.4883, {24, 163.173, 2.3256, 0.583238} -> 
  82.9543, {17, 154.121, 2.32394, 0.184238} -> 
  71.0304, {6, 32.046, 0.844511, 0.133453} -> 
  18.8763, {24, 180.156, 2.37098, 0.570255} -> 
  85.9358, {10, 45.085, 1.21897, 0.448595} -> 
  30.395, {24, 189.167, 2.58245, 0.636218} -> 
  90.2379, {36, 292.244, 3.47294, 0.643209} -> 
  136.193, {14, 75.111, 1.53807, 0.613078} -> 
  44.4508, {81, 430.717, 6.23901, 1.3141} -> 
  263.062, {13, 59.112, 1.39674, 0.455956} -> 
  39.5699, {6, 151.445, 1.72414, 0.485684} -> 
  51.89, {14, 105.093, 1.74882, 0.566047} -> 
  50.8378, {44, 289.375, 3.52825, 0.979408} -> 
  157.664, {12, 177.985, 1.90689, 0.291135} -> 
  60.6087, {19, 152.149, 2.34252, 0.623164} -> 
  75.3244, {18, 170.12, 2.51102, 0.0000122499} -> 
  75.9113, {25, 180.203, 3.04403, 0.43964} -> 
  93.9366, {18, 162.144, 2.48769, 0.00896652} -> 
  76.3901, {14, 101.105, 1.75255, 0.568423} -> 
  51.2848, {5, 50.488, 0.881537, 0.374175} -> 
  23.2574, {10, 166.958, 1.87532, 0.373616} -> 
  52.7555, {77, 352.691, 8.17532, 0.803205} -> 
  234.556, {26, 136.238, 2.03793, 0.927795} -> 
  85.802, {9, 72.063, 1.49294, 0.200127} -> 
  35.4121, {12, 108.096, 1.91132, 0.0102298} -> 
  52.1219, {18, 153.137, 2.56686, 0.0970625} -> 
  73.165, {2, 36.461, 0.22462, 0.} -> 
  14.6684, {18, 158.156, 2.31903, 0.0085187} -> 
  77.9486, {19, 100.161, 2.21958, 0.657915} -> 
  61.6149, {8, 202.295, 2.05308, 0.704135} -> 
  68.0255, {16, 150.086, 2.13492, 0.480362} -> 
  64.1106, {13, 89.094, 1.68584, 0.524367} -> 
  46.035, {20, 172.136, 2.44211, 0.554346} -> 
  79.439, {11, 104.061, 1.83936, 0.548303} -> 
  45.1739, {17, 120.151, 2.23457, 0.488148} -> 
  65.5626, {3, 159.598, 0.717656, 0.} -> 
  27.6623, {24, 180.156, 2.38545, 0.772518} -> 
  85.9896, {25, 224.215, 2.85806, 0.00722886} -> 
  108.656, {19, 100.161, 1.80031, 0.551476} -> 
  61.2987, {21, 180.159, 2.53815, 0.129147} -> 
  86.0835, {20, 151.165, 2.56574, 0.336103} -> 
  77.4564, {51, 394.423, 4.15369, 1.4234} -> 
  199.434, {22, 180.206, 2.58304, 0.00633686} -> 
  93.2489, {18, 136.15, 2.27859, 0.107163} -> 
  70.6761, {15, 109.132, 1.9157, 0.0000129952} -> 
  57.3979, {8, 98.96, 1.62459, 0.55533} -> 
  41.3306, {18, 114.144, 1.79659, 0.652405} -> 
  62.8829, {21, 102.177, 2.61269, 0.639866} -> 
  65.1145, {18, 174.108, 2.44665, 0.802221} -> 
  75.4315, {16, 151.121, 2.55011, 0.0000111583} -> 
  69.6357, {24, 216.192, 2.76533, 0.178155} -> 
  101.274, {39, 204.357, 2.37581, 1.06834} -> 
  127.861, {27, 130.231, 2.49139, 0.61067} -> 
  83.4642, {26, 136.238, 2.03518, 0.913078} -> 
  85.802, {16, 151.121, 2.46993, 0.0000171118} -> 
  69.6357, {19, 117.148, 1.95205, 0.746883} -> 
  64.1521, {3, 47.013, 0.943783, 0.} -> 
  16.8173, {26, 136.238, 1.96175, 1.01964} -> 
  85.802, {19, 182.135, 2.5852, 0.16067} -> 
  81.5321, {17, 98.145, 2.03365, 0.753554} -> 
  58.0856, {10, 80.09, 1.45254, 0.0000103963} -> 
  41.4906, {17, 132.119, 2.0623, 0.690504} -> 
  63.1898, {3, 76.145, 1.45959, 0.} -> 
  29.4568, {8, 76.12, 1.4044, 0.224596} -> 
  35.7216, {18, 182.088, 3.17497, 0.513109} -> 
  74.221, {120, 822.942, 6.24888, 1.22643} -> 
  425.227, {14, 88.106, 1.66312, 0.457276} -> 
  48.1163, {5, 119.378, 1.59512, 0.541139} -> 
  41.054, {83, 380.745, 7.46525, 0.895042} -> 
  252.906, {40, 198.35, 4.62975, 0.682173} -> 
  125.809, {15, 120.173, 2.25627, 0.487776} -> 
  58.2394, {27, 152.237, 2.05504, 0.976105} -> 
  90.5993, {18, 88.15, 2.00891, 0.606598} -> 
  55.9396, {20, 182.178, 2.45032, 0.00434234} -> 
  87.5266, {3, 44.013, 1.03749, 0.} -> 
  17.0828, {16, 73.139, 1.93961, 0.510306} -> 
  48.7448, {28, 211.217, 2.77995, 0.689018} -> 
  105.416, {13, 89.094, 1.90534, 0.37946} -> 
  45.8024, {17, 132.115, 2.30198, 0.564266} -> 
  63.7563, {21, 150.177, 2.34568, 0.711208} -> 
  79.6184, {26, 136.238, 2.19494, 0.917594} -> 
  86.1182, {4, 17.031, 0.423646, 0.147798} -> 
  11.8933, {18, 148.114, 2.20563, 0.766148} -> 
  68.4045, {23, 161.204, 2.60003, 0.470284} -> 
  86.4457, {2, 74.551, 0.499402, 0.} -> 
  62.4441, {32, 202.25, 4.20041, 0.661061} -> 
  109.398, {10, 58.08, 1.26959, 0.425255} -> 
  34.0067, {26, 114.232, 2.99515, 0.656924} -> 
  78.5833, {96, 536.888, 8.59934, 1.14864} -> 
  326.053, {53, 314.469, 4.06562, 0.953441} -> 
  182.431, {15, 74.123, 1.65402, 0.624087} -> 46.7647}
POSTED BY: N Ibrahim
5 Replies
Posted 3 years ago

I suggest saving the training data to your cloud account and training the model in the cloud using that data. That will ensure there is no version mismatch.

I would also report the issue to Wolfram Support.

POSTED BY: Rohit Namjoshi
Posted 3 years ago

Oh, by any chance do you know how I can fix this error by changing something in the code. I was unaware of this issue; can you run the code on your end and see if the Wolfram Cloud app works?

The last resort I want to take is to update the software because that will cause me to have to rerun the entire code which will be time-consuming and change the results I currently have. Thank you!

POSTED BY: N Ibrahim
Posted 3 years ago

I see this

enter image description here

POSTED BY: Rohit Namjoshi
Posted 3 years ago

Yes, I am still having an issue using it on Wolfram Cloud. I receive the following image:

The red portion is supposed to be where the Molecular Surface Area is

The red portion is supposed to be where the Molecular Surface Area is. If you are able to help me to get this to work, I would greatly appreciate it.

POSTED BY: N Ibrahim
Posted 3 years ago

You have to specify SaveDefinitions -> True to Manipulate so it includes the definitions of any functions used.

Framed[Manipulate[
  pred2o[{atomCount, molecularMass, radiusOfGyration, planeOfBestFitDistance}], 
  Style["Biomolecules Molecular Surface Area Calculator", 14, Bold, Orange], 
  Delimiter, {{atomCount, 20, "Atom Count"}, 2, 
   120}, {{molecularMass, 146, "Molecular Mass"}, 26.038`, 
   822.942`}, {{radiusOfGyration, 2.5, "Radius of Gyration"}, 
   0.22462`, 
   10.7024`}, {{planeOfBestFitDistance, 0.55, 
    "Plane of Best Fit Distance"}, 0.`, 1.22643`}, 
  ControlType -> InputField, SaveDefinitions -> True, 
  ControlPlacement -> Left, Paneled -> False, 
  SaveDefinitions -> True], FrameMargins -> 5, 
 Background -> Lighter[Gray, 0.9]]

I trained pred2o using the data you provided. The function is available in the cloud deploy but fails to run

NetGraph::nnincmpb Attempting to interpret a network that was produced using version 12.2.13 of the Neural Networks paclet in version 12.2.11. This can cause some issues.

You might run into the same issue.

POSTED BY: Rohit Namjoshi
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract