Not signed in (Sign In)

Vanilla 1.1.9 is a product of Lussumo. More Information: Documentation, Community Support.

    •  
      CommentAuthorTheDudeFromCI (Advanced Member)
    • CommentTimeFeb 15th 2015
     
    Hey, I'm currently working on a side project during my spare time. (Outside of CI.)
    It's basically an AI. Well, it's going good so far, which is nice. ^^ However, I have a quick question, which would help me out a lot. The result doesn't have to be perfect, but the better the result is, the fast the AI will learn. So any tips would be awesome. Thanks.

    So here's the problem:
    I'm thinking of a number between say, 1 and 1 million.
    You have to guess it, or as close to it as possible. I gave you a list of numbers, and a score for each representing how close they are it to. The higher the number, the closer it is.

    Num:
    2342 - 234
    953123 - 34908
    123 - 23
    Etc.

    The score for these numbers are not exact, just rough estimates, and the number I'm thinking of could possibly be already on that list.


    So what would be the best way to go about guessing this number or as close to it as possible. Currently I'm using a simple method, which just returns the value with the highest score. Though it works after enough steps, I was hoping to make this a little faster and more accurate. Thanks again.-----------------
    Orange is my favorite number.
    •  
      CommentAuthorMathdude314 (Advanced Member)
    • CommentTimeFeb 15th 2015
     
    Binary search? You know, you guess the middle?-----------------
    If less people are active, that will only make for even less activity. Start making those designs!
    Currently working on a one-round no-elimination quick RP game...
    •  
      CommentAuthorTheDudeFromCI (Advanced Member)
    • CommentTimeFeb 15th 2015 edited
     
    Won't work. There's no way to tell if the number is higher or lower. All you get is a non-linear score. And you only get one guess.-----------------
    Orange is my favorite number.
    •  
      CommentAuthorMathdude314 (Advanced Member)
    • CommentTimeFeb 15th 2015
     
    How does the score work?-----------------
    If less people are active, that will only make for even less activity. Start making those designs!
    Currently working on a one-round no-elimination quick RP game...
    •  
      CommentAuthorBioManiac R2 (Moderator)
    • CommentTimeFeb 15th 2015
     
    uhm... since you made the scoring method ( i think?) then you can easily determine the number based on how the score system works?

    except the scoring system makes no sense at all to me... it needs to have a max number (such as 100) to tell you that you got a perfect/near perfect score

    otherwise i have no idea...
    •  
      CommentAuthorTheDudeFromCI (Advanced Member)
    • CommentTimeFeb 15th 2015 edited
     
    Ok, this is a learning algorithm. In a nutshell, a learning algorithm is a random number generator, trying to find a specific one. Yes, there exists ways to just get the number by using the score and all that. But that wouldn't really teach it anything, it would just already know. Which is not the objective here.

    Basically what happens is this: the computer guesses a random number, and gives it to you. Then you give it a score, (with no min or max value), explaining how close the computer was. Then the computer guesses again. And again, and again, etc. Trying to get closer to that number. It's called a hill climbing algorithm. Now, in actual learning algorithms, you're not actually guessing a number, per-say. What you're doing is generating a series of numbers, and "testing" them to see how well they function in the environment, with the given task.

    The scoring for these tests are seemingly random, and non-linear. But they do have inclines, and declines, so it is possible to learn in.-----------------
    Orange is my favorite number.
    •  
      CommentAuthorBioManiac R2 (Moderator)
    • CommentTimeFeb 16th 2015
     
    okay, i think i understand... except where you said: "And you only get one guess"

    if it's a learning algorithm, then why does it only get one guess? wouldn't it be to continue to try and guess closer but sometimes make mistakes and have to go the other direction?
    •  
      CommentAuthorTheDudeFromCI (Advanced Member)
    • CommentTimeFeb 16th 2015
     
    I meant one guess per step.

    Anyway, I found a lot of problems with this current learning style, such as a very poor efficiency and everything else. So go ahead and ignore this thread.-----------------
    Orange is my favorite number.
    •  
      CommentAuthorVanderwaal
    • CommentTimeFeb 16th 2015 edited
     
    Even though you believe we should ignore it, I still want to suggest a strategy. I'm not sure I understood you correctly, but here's an example to show what my strategy is. It's inspired by the higher lower game:

    The number I pick is 316.094. I write this down on a piece of paper, so the computer doesn't know it.
    The computer starts in the middle with 500,000. Since it's pretty far, but not too far you give this number a score of 25.000.
    Now the computer picks a higher (or lower, it doesn't really matter) number. 750.000. It's way further from your number, so you give it a 55.000.

    Now it's time for some math. There are two options. Either the number is below the 500.000 or it's above the 500.000.
    If it's below the 500.000 the score can be calculated in this way:
    A raise in guess of 250.000 increases the score by 30.000. Therefore a raise in score of 1 raises the guess by about 250.0000/30.000 = 25/3 = 8.33 (rounded and I'm going to call this number the slope from now on) This means that the number is probably near the 500.000-25.000*8.33 = 291.667.
    The other option is that the number is in between the 500.000 and the 750.000, but closer to the 500.000. However, there are fewer numbers in this range, so it's not going to guess this.

    So, the third guess is 291.667 and it's already pretty close. Nevertheless, it's a bit too low, so you give it a score of 3.000.
    The computer will now look at the last two number - score combinations.
    750.000 -> 55.000 and 291.667 -> 3.000.
    Now the computer has a problem: the number could be slightly higher or lower. This will get chosen at random. I'll go with higher in this example.
    That means that the gap of 750.000 - 291.667 = 458.333 will give a total score of 55.000 + 3.000 = 58.000. Therefore a raise in score of 1 will result in a raise in guess of 458.333 / 58.000 = 7,90 (rounded). The next guess will be 291.667 + 7,90 (use the not-rounded number in the calculation) * 3.000 = 315.374, which gets a score of 150.

    Very close already.
    Let's look at the last two numbers again.
    291.667 -> 3.000 and 315.374 -> 150
    The computer has to make the decision if the number is in between 291.667 and 315.374, but way closer to 315.374 or if it's slightly higher. For this example it'll go with slightly lower.
    315.374 - 291.667 = 23.707 for a score of 3.000 + 150 = 3.150. The slope is 23.707 / 3.150 = 7.53 (rounded). The next guess will be 315.374 - 7.53 * 150 = 314.245 which gets a score of 300.

    Oops, the score went up. Therefore the number wasn't slightly smaller than 315.374, but slightly bigger.
    Take the last two numbers: 315.374 -> 150 and 314.245 -> 300.
    Calculate the slope, this time aiming at a number slightly higher than 315.374.
    (315.374 - 314.245) / (300 - 150) = 7.53 (rounded)
    Now make the new guess. 315.374 + 7.53*150 = 316.503.

    To recap: start with 500.000 and 750.000.
    After that, figure out if the number should be below 500.000, in between 500.000 and 750.000 or above 750.000. This probably requires some guessing.
    If the new score is the best so far, you're heading in the right direction. Calculate the slope again with the last two numbers and make a new guess that's either slightly higher or lower than your best score so far.
    If the new score is worse than a previous score, your higher or lower guess was wrong. Calculate the slope with the last two numbers and try again, but this time with the other higher/lower choice.
    •  
      CommentAuthorTheDudeFromCI (Advanced Member)
    • CommentTimeFeb 17th 2015
     
    Thank you Vanderwaal. That sounds like it would work pretty well. As long we have a minimum, and maximum score value (This would be something like 0-1 in most machine learning algorithms.), then the computer could find a fairly accurate guess of what the number is. As long as the scoring system isn't written like "sin(x)/([e*x]/200)", It'll work perfectly. Thanks.-----------------
    Orange is my favorite number.