2
$\begingroup$

I am not a data scientist but am trying to implement a recommender system for my company. My application runs on PHP but I will use Python to process the data.

My company is an online school, with 40 online courses as of now. I have a CSV file with around 30k users preferences and it looks like this:

Dataframe

0 means that user is not subscribed (I consider here that they have no interest), while 1 means subscribed (interested).

My idea is to compare one single user array such as [0,1,0,0,0,1,1...] with all this data and return a grade for each course with the probability of interest for this user.

I was thinking of using a Multinomial Logistic Regression, but as far as I know (and I do not know much) it would return me a binary result, right?

What classification model would you recommend me to use? Ideally, my result should be something like:

[0.95, 0.1, 0.54, 0.3, 0.87...]

Cheers!

$\endgroup$
4
  • 1
    $\begingroup$ Formulate the problem as a Collaborative filtering task. $\endgroup$ May 21, 2018 at 14:52
  • $\begingroup$ Thanks @FadiBakoura, will research on this and let you know. $\endgroup$
    – grpaiva
    May 21, 2018 at 18:03
  • $\begingroup$ Can you include more information about the user? (sex, age ...) An user single with 18 years old may like a course that another 50 years old do not like ... $\endgroup$
    – Intruso
    Aug 20, 2018 at 13:50
  • $\begingroup$ Seems like a prediction problem, not one of classification, so a neural network? Have you tried loading this data into Orange3? Seems you could test out your models pretty quickly. Orange3 uses Scikit, so once you find your workflow, you can use Python. By the way, if it is a neural network solution, TensorFlow has PHP bindings, so you could do the whole thing in PHP. Both may save you time. $\endgroup$
    – davmor
    Nov 18, 2018 at 11:10

2 Answers 2

1
$\begingroup$

It would be useful to frame your problem as a recommender systems problem. Given a matrix of users and items, which item would be best for a given user?

The important constraints are that dataset has only user behavioral information (no item information) and binary / boolean values.

There are many recommender systems algorithms. One of the most common groups are collaborative filtering algorithms.

Python's Surprise package has implementations of many collaborative filtering algorithms.

$\endgroup$
0
$\begingroup$

Without more information about your dataset, it's impossible to recommend one particular classifier over another.

If you want your classifier to return a vector of probabilities, then if you're using the sklearn library, you could use the predict_proba method.

Here's an example:

from sklearn.datasets import load_digits
digits = load_digits(2)
from sklearn.linear_model import LogisticRegression
preds = LogisticRegression().fit(digits.data, digits.target).predict_proba(digits.data)
print([i[1] for i in preds]) 
$\endgroup$
2
  • $\begingroup$ Thanks for your answer @Lupacante! What I don't get here is that when I print digits.data.shape and digits.target.shape I get: (360, 64) and (360,). Shouldn't the target shape be something like(64,)? My dataset's shape looks like this: (27920, 46) and (46,). I'm getting an error: ValueError: Found input variables with inconsistent numbers of samples: [27920, 46] $\endgroup$
    – grpaiva
    May 21, 2018 at 18:02
  • $\begingroup$ The predictors and target from the training set should have the same number of rows. The first number in the tuple returned by shape gives you the number of rows, so (360, 64) and (360,) is exactly what we'd expect. $\endgroup$ May 22, 2018 at 8:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.