How would I randomly generate equations of n variables?

2 vues (au cours des 30 derniers jours)
Roman B
Roman B le 12 Sep 2019
Commenté : Roman B le 12 Sep 2019
Trying to make a program that brute forces equation generation for a dataset, but I can't seem to figure out how to generate a starting population of equations. Furthermore what do you think would be the best way to add and remove random mathmatical operators? I have some ideas in mind for it but I can't pin down a way that would be both be effiecient and effective.
  2 commentaires
James Tursa
James Tursa le 12 Sep 2019
Modifié(e) : James Tursa le 12 Sep 2019
This question is way too generic. We need specifics. E.g., What exactly is in the dataset? What types of equations? What does "add and remove random mathmatical operators" mean? Can you provide a small example that will help guide us?
Roman B
Roman B le 12 Sep 2019
Yessir I sure can. The data set right now is just a random matrix I set up that creates inputs for the equation and then solves it to get an answer. This is supposed to be a test training set.
ProblemSet = zeros(10000,4);
for y = 1:10000
for x = 1:4
if x ~= 4
ProblemSet(y,x)= randi(100);
else
ProblemSet(y,x) = (ProblemSet(y,1)^2)+(2*ProblemSet(y,2))-((ProblemSet(y,3))*3);
end
end
end
%Creates a Random problem set based on the equation x^2 + 2y - 3z
The overall idea here being creating a guided genetic algorithmn that acts as a general equation solver for large datasets but that aren't quite large enough for an effective neural network. What I mean by mathmatical operators are addition signs, subtraction signs, division signs, even parathenses. I just need a way to actually add them to an equation pseudo randomly to allow "mutation". Right now my main idea is to create a cell array, then convert the string of the equation back and forth, eg cell->string->equation then after solving, mutation and getting the error ofthe answer from the true answer it would convert back the other way.

Connectez-vous pour commenter.

Réponses (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by