A
A
Andrew Hecc2019-06-29 02:07:38
JavaScript
Andrew Hecc, 2019-06-29 02:07:38

How expedient is it to use a neural network to select an object from a collection of the same objects according to N parameters?

Goodnight!
I decided to play a little in test projects and try to solve the problem using a neural network.
I will say right away that yes, I understand that this problem can be solved simply algorithmically - by writing a script that will generally give the same result. But it's not so interesting + I want to learn some new technology :)
I want to teach the network to choose the optimal user for the task.
Since I usually work with JS, I will also implement it on it. Brain.js seemed to be the simplest and most accessible solution, which I used. If there are alternatives, I will gladly consider links to them.
I set myself a task like this:The network must choose from the collection of users the one that will best fit the task in 8 parameters.
The actual user looks like this:

const user = {
    // Данные юзера
    id: 1,
    name: 'Вася Пупкин',
    // Тип пользователя
    type: 'Content',
    // Категория его работы
    category: 'Games',
    // Основные направления по тегам
    tags: ['tag1', 'tag2'],
    // Количество всех заявок
    allApplications: 31,
    // Количество закрытых заявок
    doneApplications: 28,
    // В каких заявках уже участвует
    alreadyChoosen: [1,2,3],
    // Сообщил о конфликтах
    conflicts: [1,2],
    // Был снят с таких заявок
    fierd: [3],
}

Then I get an object to which, in fact, the network must select the performer. It will look like this:
const application = {
    // Данные заявки
    id: 1,
    name: 'И как ты до такого докатился?!',
    data: '...',
    // Собственно поля которые есть у каждого пользователя
    type: 'Content',
    category: 'Games',
    tags: ['tag1', 'tag2', 'tag3']
}

Accordingly, the next question is network training.
If I understand the mechanics of work correctly, then I need to make coefficients for each of the parameters and give the score in the form of the desired user as an output.
More or less like this:
const users = [...];
const applications = [...]
const trainingData = applications.map( application => {
    return {
        input: {
            users: users.map( user => ({
                // Каждый метод возвращает совпадение юзера по данному условию от 0 до 1
                type: getTypeCoefficient( user, application), 
                category: getCategoryCoefficient( user, application ),
                tags: getTagsCoefficient( user, application ),
                allApplications: getAppAppsCoefficient( user ),
                doneApplications: getDoneAppsCoefficient( user ),
                alreadyChoosen: isAlreadyChoosen( user, application),
                conflicts: isHaveConflicts( user, application),
                // Насколько вообще возможно объяснить сети, что если например пользователь сам себя удалил с заявки
                // что дальше все остальные пункты не особо имеют значения? Просто передавать только одно условие в 
                // инпут этого юзера?
                fired: isFired( user, application )
            }))
        },
        output: {
            // Допустим, что для обучения есть массив данных в которых уже выбран релевантный юзер
            [getValidUserForApplication( application )]: 1
        }
    }
});

net.train( trainingData );
// Пока не работает :)
net.run({
    users: [...users]
});

If this point succeeds, I also want to attach the database here so that the user himself can teach the network to choose the right performer. And see how well it will work when sampling, for example, in 1000 correct combinations?
Actually, how relevant is it to use neural networks for such tasks and am I moving in the right direction?)

Answer the question

In order to leave comments, you need to log in

3 answer(s)
R
Robur, 2019-06-29
@Robur

I want to

If you want, then the question of expediency is not worth it. If you want - do it, who will forbid you.
If the question is "in general" - it depends on the task. But in general, I would not make neural networks on js, unless you need to do it on the client for some reason.

R
rPman, 2019-06-29
@rPman

Solving problems with the help of a neural network is like flying to a neighboring bakery for bread through a neighboring country and it only makes sense if the bread you want to buy is not produced in your country.
Yes, a ready-made neural network is able to solve the most complex problems very efficiently and quickly, but the problem is in the network training process itself - it requires an incredibly large amount of computing resources. It is not advisable to use a processor (and even more so a virtual machine of the same javascript, which is many times slower) for this, you will look for a solution for too long. Therefore, when choosing a toolkit (programming language and library), check in advance for compatibility with your hardware.
The fact that the implementation of neural networks exists for processors and interpreted languages ​​​​only says that it can be justified to calculate the value of the finished network for solving the problem and it is possible to retrain the already finished network if it requires changing conditions. ps Google, for example, concocted a tensor processor
for himself, which for the tasks of learning neural networks, or rather for use in the tensorflow library, works an order of magnitude faster (more energy efficient) than a video card, .. i.e. it is logical to learn in advance on those libraries in order to minimize your costs in the future. True, Google is not going to sell its mega-hardware to the side, but it allows you to use them in the cloud (still very expensive when compared to the cost, but still cheaper than using a GPU, I haven’t personally tested it, but I heard it)

F
fsfdg, 2020-01-17
@fsfdg

Add required to form fields

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question