Answers.Body: <p>What you have is an instance of a <em>local search</em> or <em>black-box optimization</em> problem.</p>
  <p>There are many AI algorithms to do this, though as commenters have noted, with only 10 binary variables, you're happier to just look at all <span class="math-container">$2^{10}$</span> of them.</p>
  <p>If you had, say, 60, then looking at them all is no longer a good idea (<span class="math-container">$2^{60}$</span> is very large).</p>
  <p>The simplest BBO technique is called hill climbing. It looks like this:</p>
  <ol>
  <li>Pick a random subset of the variables to be true.</li>
  <li>For each variable, determine the effect of flipping that variable from true to false in the current assignment.</li>
  <li>Select the 'flip' that leads to the largest value of your function.</li>
  <li>If the 'flip' has a larger value of your function than the current assignment, GOTO 2.</li>
  <li>Otherwise, return the current assignment.</li>
  </ol>
  <p>This amounts to: 'Pick an assignment at random, then keep making small changes that improve it until you can't anymore. Claim that this is the best solution.'</p>
  <p>Clearly, this algorithm will not recover the globally best solution with certainty, but you could run it many times, and eventually, it will find it with high probability.</p>
  <p>A <em>complete</em> algorithm, that will always uncover the global optimum, is <a href="https://en.wikipedia.org/wiki/Simulated_annealing" rel="nofollow noreferrer">simulated annealing</a>. This algorithm has a <em>temperature</em> parameter, usually denoted T, which changes according to a <em>temperature schedule</em>. If you start T large 'enough', and decrease it slowly 'enough', then it will find the global optimum. Unfortunately, 'enough' depends a lot on the shape of the function you are optimizing, which you generally cannot observe. There are some common guesses for T, like multiplying it by, e.g. 0.9999 at each step in the search, that seem to work okay in practice.</p>
  <p>Both of these algorithms are widely available in packages.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-03-07T16:07:21.947Z
Answers.LastActivityDate: 2021-03-28T01:27:04.743Z
Answers.LastEditDate: 2021-03-28T01:27:04.743Z
Answers.UserDisplayName: John Doucette
Body: <p>I have 10 variables as like below</p>
  <blockquote>
  <p><span class="math-container">$V_1=1$</span>, <span class="math-container">$V_2=2$</span>, <span class="math-container">$V_3=3$</span>, <span class="math-container">$V_4=4$</span>, <span class="math-container">$V_5=5$</span>, <span class="math-container">$V_6=6$</span>, <span class="math-container">$V_7=7$</span>, <span class="math-container">$V_8=8$</span>, <span class="math-container">$V_9=9$</span> and <span class="math-container">$V_{10}=10$</span></p>
  </blockquote>
  <p><em><strong>Note: Each variable can have any value</strong></em></p>
  <p>Now I want to select the best 3 variables combination as like below</p>
  <blockquote>
  <p><span class="math-container">$V_1V_3V_4$</span> or <span class="math-container">$V_{10}V_1V_7$</span> or <span class="math-container">$V_5V_3V_9$</span> etc.</p>
  </blockquote>
  <p>The best combination is nothing but the sum of the values of 3 variables in the combination.</p>
  <p><em><strong>Example:</strong></em></p>
  <blockquote>
  <p>Combination 1(<span class="math-container">$V_1V_2V_3$</span>) : 1+2+3 <span class="math-container">$\Rightarrow$</span> <strong>6</strong></p>
  <p>Combination 2(<span class="math-container">$V_8V_9V_{10}$</span>) : 8+9+10 <span class="math-container">$\Rightarrow$</span> <strong>27</strong></p>
  </blockquote>
  <p>In the above example <strong>Combination 2(<span class="math-container">$V_8V_9V_{10}$</span>)</strong> has the highest sum value. So the <strong>Combination 2(<span class="math-container">$V_8V_9V_{10}$</span>)</strong> is the best combination here.</p>
  <p>Like this, if I have a large number of variables means which machine learning algorithm selects the best combination in all the sense.</p>
  <p>Suggest me the best machine learning algorithm for selecting the best variable combinations. Thanks in advance.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-03-06T15:58:35.093Z
Comments.Text: If you exactly know the rule to pick these 3, why using a machine learning approach? You could just find the 3 biggest values. Even if the rule was other one, if you know how to score these, you could just make all the combinations posible (which are 120), and find out the best one
Comments.UserDisplayName: freesoul
Tags: <machine-learning>
Title: What is the best machine learning algorithm to select best 3 variable combinations?
UserDisplayName: user1999109
ThreadText: # What is the best machine learning algorithm to select best 3 variable combinations?
  
  (Asked by: username_0 on 2019-03-06)
  
  I have 10 variables as like below
  
  > $V\_1=1$, $V\_2=2$, $V\_3=3$, $V\_4=4$, $V\_5=5$, $V\_6=6$, $V\_7=7$, $V\_8=8$, $V\_9=9$ and $V\_{10}=10$
  
  ***Note: Each variable can have any value***
  
  Now I want to select the best 3 variables combination as like below
  
  > $V\_1V\_3V\_4$ or $V\_{10}V\_1V\_7$ or $V\_5V\_3V\_9$ etc.
  
  The best combination is nothing but the sum of the values of 3 variables in the combination.
  
  ***Example:***
  
  > Combination 1($V\_1V\_2V\_3$) : 1+2+3 $\Rightarrow$ **6**
  >
  > Combination 2($V\_8V\_9V\_{10}$) : 8+9+10 $\Rightarrow$ **27**
  
  In the above example **Combination 2($V\_8V\_9V\_{10}$)** has the highest sum value. So the **Combination 2($V\_8V\_9V\_{10}$)** is the best combination here.
  
  Like this, if I have a large number of variables means which machine learning algorithm selects the best combination in all the sense.
  
  Suggest me the best machine learning algorithm for selecting the best variable combinations. Thanks in advance.
  
  **Tags:** machine-learning
  > **Comments:**
  > **username_1**: If you exactly know the rule to pick these 3, why using a machine learning approach? You could just find the 3 biggest values. Even if the rule was other one, if you know how to score these, you could just make all the combinations posible (which are 120), and find out the best one  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2019-03-07. Score: 1
  
  What you have is an instance of a *local search* or *black-box optimization* problem.
  
  There are many AI algorithms to do this, though as commenters have noted, with only 10 binary variables, you're happier to just look at all $2^{10}$ of them.
  
  If you had, say, 60, then looking at them all is no longer a good idea ($2^{60}$ is very large).
  
  The simplest BBO technique is called hill climbing. It looks like this:
  
  1. Pick a random subset of the variables to be true.
  2. For each variable, determine the effect of flipping that variable from true to false in the current assignment.
  3. Select the 'flip' that leads to the largest value of your function.
  4. If the 'flip' has a larger value of your function than the current assignment, GOTO 2.
  5. Otherwise, return the current assignment.
  
  This amounts to: 'Pick an assignment at random, then keep making small changes that improve it until you can't anymore. Claim that this is the best solution.'
  
  Clearly, this algorithm will not recover the globally best solution with certainty, but you could run it many times, and eventually, it will find it with high probability.
  
  A *complete* algorithm, that will always uncover the global optimum, is [simulated annealing](https://en.wikipedia.org/wiki/Simulated_annealing). This algorithm has a *temperature* parameter, usually denoted T, which changes according to a *temperature schedule*. If you start T large 'enough', and decrease it slowly 'enough', then it will find the global optimum. Unfortunately, 'enough' depends a lot on the shape of the function you are optimizing, which you generally cannot observe. There are some common guesses for T, like multiplying it by, e.g. 0.9999 at each step in the search, that seem to work okay in practice.
  
  Both of these algorithms are widely available in packages.
  
  
  ---
  
  