AMuHb Lab

Sorry my Russian (или горите в аду).

  • Useless Buttons

  • RSS Mei Mei

    • test
      test Filed under: Uncategorized
      Axarova
  • RSS jujav4ik

    • Desktop wars: Are you serious?
      They still exist! No, really! KDE vs. Gnome vs. XFCE vs. blah-blah-blah Recent experience of switching among desktop environments proved one little thing to me.  Do you all know how easy is to change your desktop background? – Well, switching … Continue reading →
      andreyv
    • KDE 4.7.x: I’m staying
      It’s been more then few weeks of “KDE experiment” I got myself into. The fact that KDE has become my default desktop environment is a bit shocking for me as well, as I’ve been a big fan of Gnome. Recent upgrade … Continue reading →
      andreyv
  • RSS Heo

Archive for the ‘Brainsnack.’ Category

Sigmoid function

Posted by amuhb on December 3, 2009

Googled it out lately:

class Calc {

public static double sigmoid(double x) {

return (1/( 1 + Math.pow(Math.E,(-1*x))))

}

}

For example, let’s say you have 18 and 8. You subtract 8 from 18 and get ten and pass it to the Sigmoid function. You’re returned with 0.9999546021312976. If you had a difference of 0 though, you would get .50 and if you had a negative difference, like -18, get a really tiny number that’s bigger than 0. So in short, the Sigmoid function is easy and quite interesting.

I just passed my E = X1W2 + X2W2 + … + X3W3 + W0 there.

Here is the original source, Thanks to the author.

Disclaimer: I really dont know, will it work or not. I made a class, which – yes, produces something. The question is – will it work in a neural network.

Posted in Genetic Algorithms., My programs, Parts of Code | Tagged: , , , | 2 Comments »

Neural network I

Posted by amuhb on December 2, 2009

Input: X;

Weight: W;

Activation: A;

A = X1W1 + X2W2 + X3W3 + … + XnWn.

If (A >= someThreshold) { //Output 1 }

Else { //Nothing }

someThreshold - simple step, any valid curve function, etc.

Posted in Brainsnack., Self-reminder Goodies | Tagged: | 1 Comment »

И тут многое стало намного понятней

Posted by amuhb on December 2, 2009

Scary way:

Easy way:

double activation = 0;

for (int i=0;  i<n;  i++)

{ activation += x[i] * w[i]; }

Posted in Brainsnack., Parts of Code | Tagged: , , | Leave a Comment »

Genetic Algorithm overview (bullet-point style)

Posted by amuhb on December 2, 2009

Genetic Algorithms is a part of the evolutionary computing.


  • A set of given problem solutions (chromosomes, containers of certain data) form a population;
  • According to their ‘fitness’, certain best chromosomes are taken from the population to produce an offspring, which would form a second generation of population (involving Crossover, Mutation, and Elitism);
  • Elitism – copying a few ‘best’ chromosomes into the next generation of population. Crucial for transforming information about best option found so far to the next generation, and eventually – find the best possible solution to a given problem.

Read the rest of this entry »

Posted in Genetic Algorithms. | Tagged: , | Leave a Comment »

Генетический алгоритм (тривиальный)

Posted by amuhb on November 19, 2009

# include <iostream>
# include <algorithm>
# include <numeric>

int main()
{

using namespace std;
srand((unsigned)time(NULL));
const int N = 1000;
int a[N];

//заполняем нулями
fill(a, a+N, 0);
for (;;)
{

//мутация в случайную сторону каждого элемента:
for (int i = 0; i < N; ++i)

if (rand()%2 == 1)

a[i] += 1;

else

a[i] -= 1;

//теперь выбираем лучших, отсортировав по возрастанию…
sort(a, a+N);
//… и тогда лучшие окажутся во второй половине массива.
//скопируем лучших в первую половину, куда они оставили потомство, а первые умерли:

copy(a+N/2, a+N, a /*куда*/);
//теперь посмотрим на среднее состояние популяции. Как видим, оно всё лучше и лучше.

cout << accumulate(a, a+N, 0) / N << endl;

}

}

Posted in Genetic Algorithms. | Tagged: , | 2 Comments »

Backward chaining

Posted by amuhb on November 18, 2009

Backward chaining (or backward reasoning) is an inference method used in automated theorem provers, proof assistants and other artificial intelligence applications.

suppose that the goal is to conclude the color of my pet Fritz, given that he croaks and eats flies, and that the rule base contains the following four rules:

  1. If X croaks and eats flies – Then X is a frog
  2. If X chirps and sings – Then X is a canary
  3. If X is a frog – Then X is green
  4. If X is a canary – Then X is yellow

This rule base would be searched and the third and fourth rules would be selected, because their consequents (Then Fritz is green, Then Fritz is yellow) match the goal (to determine Fritz’s color). It is not yet known that Fritz is a frog, so both the antecedents (If Fritz is a frog, If Fritz is a canary) are added to the goal list. The rule base is again searched and this time the first two rules are selected, because their consequents (Then X is a frog, Then X is a canary) match the new goals that were just added to the list. The antecedent (If Fritz croaks and eats flies) is known to be true and therefore it can be concluded that Fritz is a frog, and not a canary. The goal of determining Fritz’s color is now achieved (Fritz is green if he is a frog, and yellow if he is a canary, but he is a frog since he croaks and eats flies; therefore, Fritz is green).

The opposite of forward chaining is forward chaining.

View full Wikipedia article.

Posted in Brainsnack. | Tagged: , , | 1 Comment »

Forward chaining

Posted by amuhb on November 18, 2009

Forward chaining is one of the two main methods of reasoning when using inference rules (in artificial intelligence).

suppose that the goal is to conclude the color of a pet named Fritz, given that he croaks and eats flies, and that the rule base contains the following four rules:

  1. If X croaks and eats flies – Then X is a frog
  2. If X chirps and sings – Then X is a canary
  3. If X is a frog – Then X is green
  4. If X is a canary – Then X is yellow

This rule base would be searched and the first rule would be selected, because its antecedent (If Fritz croaks and eats flies) matches our data. Now the consequents (Then X is a frog) is added to the data. The rule base is again searched and this time the third rule is selected, because its antecedent (If Fritz is a frog) matches our data that was just confirmed. Now the new consequent (Then Fritz is green) is added to our data. Nothing more can be inferred from this information, but we have now accomplished our goal of determining the color of Fritz.

The opposite of forward chaining is backward chaining.

View full Wikipedia article.

Posted in Brainsnack. | Tagged: , , | 1 Comment »

Дуализм человеческого мышления.

Posted by amuhb on November 18, 2009

Человеческое сознание использует два механизма мышления. Один из них позволяет работать с абстрактными цепочками символов, с текстами и т.п. Этот механизм мышления обычно называют символическим, алгебраическим или логическим. Второй механизм мышления обеспечивает работу с чувственными образами и представлениями об этих образах. Его называют образным, геометрическим, интуитивным и т.п. Физиологически логическое мышление связано с левым полушарием человеческого мозга, а образное мышление – с правым полушарием.

Каждое из полушарий человеческого мозга является самостоятельной системой восприятия внешнего мира, переработки информации о нем и планирования поведения в этом мире. Левое полушарие представляет собой как бы большую и мощную ЭВМ, имеющую дело со знаками и процедурами их обработки.

Read the rest of this entry »

Posted in Brainsnack. | Tagged: , , | Leave a Comment »

More about Fuzzy Logic

Posted by amuhb on November 15, 2009

At the heart of Fuzzy Logic lies the concept of a linguistic variable. The values of the linguistic variable are words rather than numbers. Similar to expert systems, fuzzy systems use IF-THEN rules to incorporate human knowledge, but these rules are fuzzy, such as:

IF speed is high, THEN stoppingDistance is long;

IF speed is low, THEN stoppingDistance is short;

Posted in Brainsnack. | Tagged: | Leave a Comment »

Summary of four basic kinds of an agent program

Posted by amuhb on November 10, 2009

  • Simple reflex agents;
    • Actions selected on the basis of the current percept, the percept history is ignored;
    • Closely related to the condition-action rule:
      • if something then do-something;
    • Stable only if an environment is fully observable;
    • A certain degree of randomization may be useful in some cases (during the then part).
  • Model-based reflex agents;
    • coming soon;
  • Goal-based agents;
    • coming soon;
  • Utility-based agents;
    • coming soon.

Posted in Brainsnack. | Leave a Comment »

 
Follow

Get every new post delivered to your Inbox.