1
$\begingroup$

I have developed a Machine Learning algorithm that uses 4 chemical descriptors to calculate a chosen chemical property. I would like to create an interactive app on Mathematica (using the manipulate function) to make predictions of the chosen property by inserting values of the 4 descriptors. Currently, I am able to perform this on my notebook using the following code:

pred2o = Predict[trainingSet1, Method -> "NeuralNetwork"]
pred2o[{20, 146, 2.5, 0.55}]
73.3435
pred2o[{100, 100, 100, 0}]
672.989

I would like to be able to convert this same idea into an app that can be accessed outside of this notebook where you can insert chosen values for each of these descriptors and automatically retrieve the predicted value using the developed machine learning algorithm. If possible, I was thinking of having a text box for each descriptor where you can type a numerical value for each, and once you do that the predicted value is shown. For context, the descriptors are Atom Count, Molecular Mass, Radius of Gyration, and Plane of Best Fit Distance, respectively. The output value is Molecular Surface Area. My plan is to have each text box labeled accordingly so that it clear what each text box represents.

I have looked through the Manipulate documentation and have not viewed it being applied to Machine Learning, so if anyone can provide me with the code to do this it would be greatly appreciated.

$\endgroup$
11
  • $\begingroup$ please post trainingSet1 $\endgroup$ Commented Feb 12, 2021 at 21:17
  • $\begingroup$ @ConorCosnett added! If you would like any more information, please let me know. The full code is quite long and may have code that is not directly related to this inquiry. However, it may help if you had access to it so you can assist with this task. Please let me know if you would need that and I can send you it through a less public means. Thanks! $\endgroup$
    – Nawn
    Commented Feb 12, 2021 at 21:57
  • $\begingroup$ The code you posted does not work as bioData is undefined. trainingSet1 is a function of bioData. So I still do not have access to trainingSet1. $\endgroup$ Commented Feb 12, 2021 at 22:09
  • $\begingroup$ @ConorCosnett Oh, I see. The bioData also includes variables that would be undefined so the best option would be to send you the entire notebook. If you can provide me a way to send you the notebook link privately, let me know (if there is a way to private message through this platform that would be great). $\endgroup$
    – Nawn
    Commented Feb 12, 2021 at 22:12
  • $\begingroup$ There is no private messenger service that I know of. Maybe you could copy and paste a sample of trainingSet1? $\endgroup$ Commented Feb 12, 2021 at 22:15

1 Answer 1

2
$\begingroup$

Is this what you had in mind?

idea 1

Manipulate[
 pred2o[{atomCount, molecularMass, radiusOfGyration, 
   planeOfBestFitDistance} ], {atomCount, 20}, {molecularMass, 
  146}, {radiusOfGyration, 2.5}, {planeOfBestFitDistance, 0.55}, 
 ControlType -> InputField]

enter image description here

idea 2

Manipulate[
 
 pred2o[
  {atomCount, molecularMass, radiusOfGyration, planeOfBestFitDistance}]
 
 , {{atomCount, 20}, 2, 120, 1}
 , {{molecularMass, 146}, 26.038`, 822.942`}
 , {{radiusOfGyration, 2.5}, 0.22462`, 10.7024`}
 , {{planeOfBestFitDistance, 0.55}, 0.`, 1.22643`}]

enter image description here

Adding a label to denote the output

Manipulate[
 
 "Molecular Surface Area = " <> ToString[pred2o[
    {atomCount, molecularMass, radiusOfGyration, 
     planeOfBestFitDistance}] ]
 
 , {{atomCount, 20}, 2, 120, 1}
 , {{molecularMass, 146}, 26.038`, 822.942`}
 , {{radiusOfGyration, 2.5}, 0.22462`, 10.7024`}
 , {{planeOfBestFitDistance, 0.55}, 0.`, 1.22643`}]

enter image description here

$\endgroup$
1
  • $\begingroup$ Thank you so much! This was exactly what I was looking for. I really appreciate that you provided multiple options for me to choose from. Is it possible to make this app available for use to people who do not have Mathematica? Is there is a way to export the app in this interactive form for public use? Thank you again! $\endgroup$
    – Nawn
    Commented Feb 12, 2021 at 23:35

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.