{"action":"created","issue":{"url":"https://api.github.com/repos/o19s/elasticsearch-learning-to-rank/issues/156","repository_url":"https://api.github.com/repos/o19s/elasticsearch-learning-to-rank","labels_url":"https://api.github.com/repos/o19s/elasticsearch-learning-to-rank/issues/156/labels{/name}","comments_url":"https://api.github.com/repos/o19s/elasticsearch-learning-to-rank/issues/156/comments","events_url":"https://api.github.com/repos/o19s/elasticsearch-learning-to-rank/issues/156/events","html_url":"https://github.com/o19s/elasticsearch-learning-to-rank/pull/156","id":323065753,"number":156,"title":"Selective features for models at query time","user":{"login":"umeshdangat","id":4211071,"avatar_url":"https://avatars1.githubusercontent.com/u/4211071?v=4","gravatar_id":"","url":"https://api.github.com/users/umeshdangat","html_url":"https://github.com/umeshdangat","followers_url":"https://api.github.com/users/umeshdangat/followers","following_url":"https://api.github.com/users/umeshdangat/following{/other_user}","gists_url":"https://api.github.com/users/umeshdangat/gists{/gist_id}","starred_url":"https://api.github.com/users/umeshdangat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/umeshdangat/subscriptions","organizations_url":"https://api.github.com/users/umeshdangat/orgs","repos_url":"https://api.github.com/users/umeshdangat/repos","events_url":"https://api.github.com/users/umeshdangat/events{/privacy}","received_events_url":"https://api.github.com/users/umeshdangat/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-05-15T04:51:11Z","updated_at":"2018-05-15T15:03:22Z","closed_at":null,"author_association":"NONE","pull_request":{"url":"https://api.github.com/repos/o19s/elasticsearch-learning-to-rank/pulls/156","html_url":"https://github.com/o19s/elasticsearch-learning-to-rank/pull/156","diff_url":"https://github.com/o19s/elasticsearch-learning-to-rank/pull/156.diff","patch_url":"https://github.com/o19s/elasticsearch-learning-to-rank/pull/156.patch"},"body":"Some Yelp search flows currently run linear models within a homegrown elasticsearch plugin. The entire model with features is shoved in as `params` to our plugin which `knows` how to extract features and score the individual components. I was investigating trying to use the LTR plugin for this purpose, since it also allows us to use other kinds of models (e.g. xgboost, ranklib) using the same framework and provides options of getting rid of some of our custom ser-de code. However there are some quirks we have before we could port our linear model to being used with LTR.\r\n\r\nIn our current approach, we train 'N' ~100s features for the model. Then at query time we only use a subset of these features and query elasticsearch using them.  While trying port to using LTR plugin, I realized we need to add some options to it like being able to pass selective features and then score only using them since we do not have all of them available at query time.\r\n\r\nMy current approach  tries to use the Lucene `MatchNoDocsQuery` query for such nonActive features and the scorer simply returns null for these in `RankerScorer`.  \r\n\r\nsltr query would look like below. We only specify the \r\n> params for active_features and\r\n> active_features\r\n\r\n```\r\n\"sltr\": {\r\n    \"model\": \"my_example_model\",\r\n     \"params\": { \"feature_two_brunch_query\", \"feature_two_brunch_language\", \"feature_two_brunch_clicks\", \"feature_two_brunch_impressions\"},\r\n     \"active_features\": {\"feature_two_brunch\": true}\r\n}\r\n\r\n```\r\nIf this approach makes sense I can write tests and add support in validation queries as well. Here are more detailed [gists](https://gist.github.com/umeshdangat/2524b9418065b2dbeeaf41cebd72d0ff)"},"comment":{"url":"https://api.github.com/repos/o19s/elasticsearch-learning-to-rank/issues/comments/389200273","html_url":"https://github.com/o19s/elasticsearch-learning-to-rank/pull/156#issuecomment-389200273","issue_url":"https://api.github.com/repos/o19s/elasticsearch-learning-to-rank/issues/156","id":389200273,"user":{"login":"umeshdangat","id":4211071,"avatar_url":"https://avatars1.githubusercontent.com/u/4211071?v=4","gravatar_id":"","url":"https://api.github.com/users/umeshdangat","html_url":"https://github.com/umeshdangat","followers_url":"https://api.github.com/users/umeshdangat/followers","following_url":"https://api.github.com/users/umeshdangat/following{/other_user}","gists_url":"https://api.github.com/users/umeshdangat/gists{/gist_id}","starred_url":"https://api.github.com/users/umeshdangat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/umeshdangat/subscriptions","organizations_url":"https://api.github.com/users/umeshdangat/orgs","repos_url":"https://api.github.com/users/umeshdangat/repos","events_url":"https://api.github.com/users/umeshdangat/events{/privacy}","received_events_url":"https://api.github.com/users/umeshdangat/received_events","type":"User","site_admin":false},"created_at":"2018-05-15T15:03:22Z","updated_at":"2018-05-15T15:03:22Z","author_association":"NONE","body":"@nomoa , please correct me if I misunderstood your comment about using `ignore_on_missing_param`. As far as I can tell `ignore_on_missing_param` would work well if all features had parameters. However some of our features don't take in any parameters. For those cases `queryParams` in the `Feature` will always be empty and `missingParams` will always be empty. So we cannot tell from `missingParams` if a feature is optional or not at query time. In my current code I maintain `Set<String> activeFeature` to decide if feature is active or not.\r\n\r\n```\r\n            if (!isActiveFeature(activeFeatures)) {\r\n                return new MatchNoDocsQuery(\"This query will not be used for scoring\");\r\n            }\r\n\r\n```"}}
{"actor":{"display_login":"umeshdangat"}}