actionml / universal-recommender

Highly configurable recommender based on PredictionIO and Mahout's Correlated Cross-Occurrence algorithm
http://actionml.com/universal-recommender
Apache License 2.0
669 stars 172 forks source link

Set bias = 1 in query will affect the score? #34

Closed ykyuen closed 7 years ago

ykyuen commented 7 years ago

According to the documentation about bias.

Bias = 1: no effect

but when i play with the handmade demo. i found that actually setting bias = 1 will affect the score of the items. For example...

Query 1:

curl -H "Content-Type: application/json" -d '
{
    "user": "u-3",
    "fields": [{
        "name": "categories",
        "values": ["Tablets"],
        "bias": 1
    }, {
        "name": "countries",
        "values": ["Estados Unidos Mexicanos"],
        "bias": 5
    }]
}' http://localhost:8000/queries.json

Result 1:

{
    "itemScores": [{
        "item": "Iphone 4",
        "score": 0.869194746017456
    }, {
        "item": "Nexus",
        "score": 0.2377699315547943
    }, {
        "item": "Iphone 5",
        "score": 0.0
    }, {
        "item": "Galaxy",
        "score": 0.0
    }]
}

Query 2 (Remove the bias = 1 in query 1):

curl -H "Content-Type: application/json" -d '
{
    "user": "u-3",
    "fields": [{
        "name": "countries",
        "values": ["Estados Unidos Mexicanos"],
        "bias": 5
    }]
}' http://pio-prediction-server:8000/queries.json

Result 2:

{
    "itemScores": [{
        "item": "Iphone 4",
        "score": 1.0098044872283936
    }, {
        "item": "Nexus",
        "score": 0.07427313178777695
    }, {
        "item": "Iphone 5",
        "score": 0.0
    }, {
        "item": "Galaxy",
        "score": 0.0
    }]
}

So setting bias = 1 should have influence on the prediction result?

pferrel commented 7 years ago

Note that below you removed the categories from the query. This does have an effect. “No effect" means that it will not change ranking, where a non-1 value will change ranking. Removing a portion of the query will just about always have an effect.

Standard Disclaimer: Be very careful with filters and boosts. You can easily ruin your results by applying business rules that seem to make sense but do not have a good effect on results. We always run without business rules and compare results to seemingly useful rules. The business rules are very dangerous because you can force biases into the results and forced biases are human based not machine learning based. A good case for rules is “in-stock”:[“true”] In this case you would never want to show a result that was not “in-stock” Other rules can be much more dangerous because what you think is obvious may not be so test with and without rules like that.

BTW the support group for the UR is here: https://groups.google.com/forum/?pli=1#!forum/actionml-user https://groups.google.com/forum/?pli=1#!forum/actionml-user

On Sep 11, 2017, at 8:48 PM, Yuen Ying Kit notifications@github.com wrote:

According to the documentation http://actionml.com/docs/ur_config#bias about bias.

Bias = 1: no effect

but when i play with the handmade demo. i found that actually setting bias = 1 will affect the score of the items. For example...

Query 1:

curl -H "Content-Type: application/json" -d ' { "user": "u-3", "fields": [{ "name": "categories", "values": ["Tablets"], "bias": 1 }, { "name": "countries", "values": ["Estados Unidos Mexicanos"], "bias": 5 }] }' http://localhost:8000/queries.json Result 1:

{ "itemScores": [{ "item": "Iphone 4", "score": 0.869194746017456 }, { "item": "Nexus", "score": 0.2377699315547943 }, { "item": "Iphone 5", "score": 0.0 }, { "item": "Galaxy", "score": 0.0 }] } Query 2 (Remove the bias = 1 in query 1):

curl -H "Content-Type: application/json" -d ' { "user": "u-3", "fields": [{ "name": "countries", "values": ["Estados Unidos Mexicanos"], "bias": 5 }] }' http://pio-prediction-server:8000/queries.json Result 2:

{ "itemScores": [{ "item": "Iphone 4", "score": 1.0098044872283936 }, { "item": "Nexus", "score": 0.07427313178777695 }, { "item": "Iphone 5", "score": 0.0 }, { "item": "Galaxy", "score": 0.0 }] } So setting bias = 1 should have influence on the prediction result?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/actionml/universal-recommender/issues/34, or mute the thread https://github.com/notifications/unsubscribe-auth/AAT8S4luX3ubhqNVRCS7uwTDlmUBAccZks5shf7_gaJpZM4PUENt.

ykyuen commented 7 years ago

got it. thx~ =)