-
Notifications
You must be signed in to change notification settings - Fork 21
commit to Universal recommender #13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,6 +28,7 @@ import io.prediction.controller.{EngineFactory, Engine} | |
|
|
||
| /** The Query spec with optional values. The only hard rule is that there must be either a user or | ||
| * an item id. All other values are optional. */ | ||
|
|
||
| case class Query( | ||
| user: Option[String] = None, // must be a user or item id | ||
| userBias: Option[Float] = None, // default: whatever is in algorithm params or 1 | ||
|
|
@@ -36,12 +37,17 @@ case class Query( | |
| fields: Option[List[Field]] = None, // default: whatever is in algorithm params or None | ||
| currentDate: Option[String] = None, // if used will override dateRange filter, currentDate must lie between the item's | ||
| // expireDateName value and availableDateName value, all are ISO 8601 dates | ||
| dateRange: Option[DateRange] = None, // optional before and after filter applied to a date field | ||
| blacklistItems: Option[List[String]] = None, // default: whatever is in algorithm params or None | ||
| dateRange: Option[DateRange] = None, // default: whatever is in algorithm params or None | ||
| returnSelf: Option[Boolean] = None,// means for an item query should the item itself be returned, defaults | ||
| // to what is in the algorithm params or false | ||
| num: Option[Int] = None, // default: whatever is in algorithm params, which itself has a default--probably 20 | ||
| eventNames: Option[List[String]]) // names used to ID all user actions | ||
| eventNames: Option[List[String]], // names used to ID all user actions | ||
| /** following variable defines features - must include particular items, price range, blacklist items,blacklistCategories respectively ***/ | ||
| includeItems: Option[List[String]] = None, | ||
| priceRange: Option[PriceRange] = None,// optional before and after filter applied to a date field | ||
| blacklistItems: Option[List[String]] = None, | ||
| blacklistCategory: Option[List[String]] = None, | ||
| blacklistBrand: Option[List[String]] = None) | ||
| extends Serializable | ||
|
|
||
| /** Used to specify how Fields are represented in engine.json */ | ||
|
|
@@ -59,16 +65,41 @@ case class DateRange( | |
| after: Option[String]) // both empty should be ignored | ||
| extends Serializable | ||
|
|
||
|
|
||
| /********************************************************************************************************/ | ||
| // This is for price range filter | ||
| case class PriceRange( | ||
| name: String, // name of item property for the date comparison | ||
| lessthan: Option[String], // empty strings means no filter | ||
| greaterthan: Option[String]) // both empty should be ignored | ||
| extends Serializable | ||
| /*********************************************************************************************************/ | ||
|
|
||
| /** results of a MMRAlgoritm.predict */ | ||
| case class PredictedResult( | ||
| itemScores: Array[ItemScore]) | ||
| itemScores: Array[ItemScore], | ||
| includeItems : Array[IncludeItem]) | ||
| extends Serializable | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is not correct indentation by the Scala style guide. http://docs.scala-lang.org/style/indentation.html#methods_with_numerous_arguments
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. will update indentation |
||
|
|
||
| case class ItemScore( | ||
| item: String, // item id | ||
| score: Double )// used to rank, original score returned from teh search engine | ||
| item: String, // item id | ||
| score: Double, | ||
| price: AnyRef, | ||
| productPictureUrl: AnyRef, | ||
| productTitle: AnyRef, | ||
| pageUrl:AnyRef | ||
| ) //used to rank, original score returned from teh search engine | ||
| extends Serializable | ||
|
|
||
| case class IncludeItem( | ||
| item: String, // item id | ||
| score: Double, | ||
| price: AnyRef, | ||
| productPictureUrl: AnyRef, | ||
| productTitle: AnyRef, | ||
| pageUrl:AnyRef | ||
| ) extends Serializable | ||
|
|
||
| object RecommendationEngine extends EngineFactory { | ||
| def apply() = { | ||
| new Engine( | ||
|
|
@@ -77,4 +108,4 @@ object RecommendationEngine extends EngineFactory { | |
| Map("ur" -> classOf[URAlgorithm]), // IMPORTANT: "ur" must be the "name" of the parameter set in engine.json | ||
| classOf[Serving]) | ||
| } | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to be able to specify a filter like we do with properties, which include the property name so they can be used for any property not just Category or Brand. I suggest an addition to the field definition, perhaps a bias enumeration, like
the type and value would not be used together.
by default the type is None, which means current behavior.
This will allow any number of fields to be set for any named property. Likewise this could be put in the engine.json for global application or into the query.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Pat
Just read your suggestions. Will work on it.
Once completed will send you PR