Gender determination by navigation history, step 2

    Good afternoon.
    First link: guess the gender of the visitor.

    According to the history of navigation using js, you can determine the gender visit, this has already been written . In short - we create links using js and see what color they are, and from this we determine whether they are visited or not. Then we combine the received information with demographic data about the sites visited.

    But foreign determinants do not work very well with us, because Take into account sites popular in the USA.
    I collected information on Russian sites, rewrote scripts a bit.
    Practical application (ha, very important and useful): the site has a form where you need to indicate your gender. If a person has not indicated sex before, then using this technology, the site tries to guess it and substitute it.

    If someone wants to do it on their own, I upload the best practices : there is a django server application, a js file, a dump of the collected database. The license, if not specified elsewhere, is MIT. Without junga, everything can also be easily used.


    If you use django, then for the server side you can connect the demography application
    (we add everything to the INSTALLED_APPS as usual, use prepared urls if you wish). For testing, you may need the gender_test.html template somewhere, well, everything in urls.py is clear.
    Demographic data can be set using the command.
    manage.py loaddata <путь-к-файлу>/demography.json
    They can also be imported from a database dump (demography.sql) - if django is not used.

    If you are not using django, then the server part will need to be written by yourself. Everything is simple there: on a certain path, a page should be accessible, which through POST takes the “links” parameter, which contains the array serialized in json with the numbers of visited pages, and returns a json data dictionary (at least, I think, the probability that the visitor is a man).

    The probability is calculated by the formula x / (1 + x), where x = r1 * r2 * ... * rn, where r1, r2, etc. - male_ratio sites visited.

    In principle, it is easy to transfer logic to the client, eliminating the server part in general.

    The client part consists of 2 parts (all in one demography.js file).
    1. slightly simplified SocialHistory function from Aza Raskin (increased speed, everything is renamed to VisitHistory).
    2. mootools-class Demography for working with the dzhangovsky server part.
    I think everything is simple there, and whoever wants it can easily rewrite Demography to jQuery, etc., or make it work with another server part, or transfer all the logic to the client.

    An example of using Demography: PS there is a suspicion that something is not working in it. But I’ll probably fix it in the evening. UPD. The alarm seems to be false, and everything works. UPD2. Dear girls! I apologize if your gender is determined incorrectly. The fact is that, according to statistics, the bias towards the male side on near-computer sites is stronger than on pornographic sites, hence we get inconsistencies. For example, you went to the Habr - the probability that you are a man is already 88%. Do not be angry)

    //обработчик полученных данных
    var callback = function(response){
    alert(response.male); //выведет вероятность того, что посетитель - мужчина, в процентах
    }
    //создаем класс. В параметрах - адрес, куда слать запрос.
    var stats = new Demography('/gender/gender');

    //получаем информацию
    stats.get_gender_info(callback);






    Also popular now: