# Machine learning: Updating weights from true labeled data

Definition of the problem:

• I am having some data with lets say 2 features but there not labeled.
• I manually create weights and label the data with a score
• I present the data to a user with order and the user gives his own score to some of the data.
• By the feedback of the user I want to update the weights, assign the new scores and give back the list in the new order.
• This should continue everytime the user give new labels

In a point of view is a pairwise online learning to rank problem.

A simple Illustration:

Assuming I am having the following data which are not labeled:

import numpy as np
X = np.array([[-1, -1], [-2, -1], [1, 1], [2, 1]])


I create manually weights and label the data (which doesnt mean that this weights are the 'correct' so we aren't sure that the labels are the correct one). With the mannually create weights the labels are the following:

Y = np.array([1, 1, 2, 2])


And I am training a SGD stochastic gradient descent algorithm using sklearn ,with ‘hinge’ loss which give linear SVM (used for 'learning to rank'):

from sklearn import linear_model
clf = linear_model.SGDClassifier()
clf.fit(X, Y)


After a period I am getting the correct labels of some of the previous data(name it true_data and use partial_fit to fit it in the previous model:

x_true_data = np.array([[-1,-1]])
y_true_data = np.array([1])
clf.partial_fit(x_new,y_new)


This update the weights. Some concerns that I have gennerally:

• is there a way to 'reward' the previous algorithm if it predicted correctly the result or do the opposite if not of the true_data? Something similar as adaboost works.
• How reliable this algorithm would be if the true_data data is not many ( between 5-20)
• Can i adjust the learning rate in order to give higher 'value' to the true_data?
• Which parameters of SGD should I consider in such a problem?
• Is there another way to think the problem? Should I consider other algorithms except SVM?

Some links that I fould usefull but didnt clear my mind if I sould continue in this path:

How to update an SVM model with new data

log.regression vs SGDClassifier

Any feedback is welcome.

• Once users start interacting and providing you scores, would a straightforward re-training be sufficient in your case? Especially since your initial weights are completely random. Over time you would end up with a labelled data set which you would model using standard procedures. – Arun Jose Aug 18 '16 at 6:39
• Having 5000 data and only 5 data points are true labeled by a user isn't it hard to train an algorithm? (The initial weights have some logic, there arent complitelly random.) – Mpizos Dimitris Aug 18 '16 at 7:02
• That statement gives a lot more context to your original question. I also seriously doubt there would be any fool-proof method if you end up with only 5-20 true points in a sample of 5000. – Arun Jose Aug 18 '16 at 8:07