Text selection / personalisation for different users - machine-learning

I have the following scenario:
There are a list of headings:
Best Holiday Destination for you
Choose us for your next vacation
Don't miss out on this offer
What I want to achieve is, display the best heading for the right user through a ML model?
One approach is to show all these headings to different users through maybe an A/B/C test and see the statistics and feed the data into the model and optimise it for a certain goal? e.g click through rate, etc
Is there any other way to do something like this?

Do you want to use your own code, or is it fine for you to use an external tool?
If it's fine, I can suggest twik personalization tool.
If you want to use your own code, you need to start with the A/B/C testing, but you need to collect more info about each user (i.e., age group, location, interests & socioeconomic status), not only the text click-through rate. This way, your code will be able to know better to which audience presents each variant.

Related

MLlib Item Based Collaborative Filtering with No Ratings

I am building a recommender system from query logs. For each query log I have data for what links were clicked by user. Users do not provide any ratings for the links they visit.
I am trying to create a recommendation system that will suggest "If you have clicked this one, try this one which another similar user has tried". I am exploring Apache Spark - MLLib to use collaborative filtering for the purpose. Unfortunately the ALS algorithm takes "ratings" data.
Here is one of the solutions I got online:
"For each page we want recommendations for, we search for all the users who have viewed that page. Then, for each of those users, we look up all other pages they have viewed. We then count the number of users which have viewed each page in this data set, and use those with the highest count as our recommendations."
The user suggests that this approach is slow.
I was wondering if there is a good way to 'fake' the ranking data, or is there a popular open source implementation which does not requires the ranking data?
ratings could be counts as well in the case of implicit feedback. Ex (user1, url1, 1/0), 1/0 clicked or not.
Now you are asking a different question, anyways, there is a difference between sparse matrixes and dense matrixes. You do not need to add any 0, thats the idea of the ratings, you have those which you have a click, for example (u1,url1,1) and if this is the only url the user 1 clicked thats it, you do not need to add the ceros for those he has not clicked yet. The model knows this is the input data format being used.
I hope it helps.

Using md-select and md-autocomplete together

I'm trying to allow the users of my app to choose a single item in a big select (~2500 possibilities). So, as I already implemented md-chips with md-autocomplete in another app, I thought that all I had to do was to the same with a md-select. To my surprise, I didn't find a way to do that.
So basically I have 3 choices :
use md-chips but I can't limit them to one chip, I can show an error if two or more are chosen, but that's a rather weird UX to let the user choose two things and then alert them they can't.
use md-select, but from what I gathered, I can't use md-autocomplete, so choosing between 2500 objects is tedious
use md-autocomplete, but (not sure :) there's no ng-model, and worst my user can write about anything while I just want them to select one item
I'm sure I missed something in the docs, I just can't find a way to allow my users to select one and only one item with autocomplete.
Anyone ?

What is a good approach to allow users subscribe to keywords

I have a rails application using Rails 4, PostgreSQL and hosted on Heroku.
The application revolves around the following models: User and Article.
A user can create articles. An article contains a title, description, location (latitude, longitude) and an image.
I would like to add a notification system that works as follows:
A user can set-up a list of keywords that they wish to subscribe to.
The user gets a notification if an article containing one of their keywords is added (in the title, but perhaps in description in time).
What is the best approach to implement this in a scalable way?
In its simplest form, I could create a model called Keyword that stores what keywords a user wants to be notified for.
Then in the create action for article, check to see if the title (or description) contains any of the saved keywords.
This sounds good but will probably fall over once any reasonable amount of users are added.
Obviously, a background task would do the trick but it still sounds wrong to do a basic string contains directly on the database.
Perhaps I could tokenize the title and description into an index and use a background process to handle the heavy lifting? I heard Postgres has some built in text search - could this work?
Could I use a Heroku add-on like Solr or Redis to handle all this or is it overkill? (Not having to pay for an add-on is an advantage).
Perhaps someone has a better implementation for the same functionality.
I know I can implement it quickly, I just want to be sure it implementation is up to scratch.
Thanks,
Brian
I have faced a similar problem. The slowest thing is to do a case insensitive search. What I would suggest to you is the following approach: let TID be the id of the row in which you store the title; then create a table which has one row for every word in your title in lowercase, with the corresponding TID. Than what you need is a join between the word and the keywords of the given user. You can speed up this query with hash indexes.
In my case, no one of the postgres text function was usable because they all have poor performance.
PS we implemented a full text search over about 60000 documents, so your case might be a bit different.

Creating meaningful user stories

We are trying to use BDD to create a web service to supply data to a web page and then save the user's changes.
The story I have so far goes
Given I want the data for order number 1234
When I load the data
Then I have the data for order number 1234
What am I missing in my approach?
Are user stories not appropriate for this kind of task?
How do I go about formulating meaningful user stories?
[Update]
As a customer
I want to see my order
So that I can check it is what I expect
Given I have entered the order number
When I Click GO
Then I should see my order displayed on the screen
Here's how I'd write what you have so far:
Feature:
As a customer
I want to be able to view and change my orders
So that I can check that they're being processed as I expect and deal with them if they're not
Scenario:
Given I am a customer
And I have an order
When I go to the order
Then I should see the order
(I indented the way my tools seem to want me indent Cucumber, which is what I use, but that's not important.)
Here are at least some of the reasons why I'd rewrite it that way:
It is usual for several Scenarios that have to do with the same product feature (order management in this case) to be in the same Feature file, so the Feature section should have a broader scope than a single Scenario. Maybe this Feature should even include placing orders in the first place.
Givens are things that are true before the time period that the scenario is about, like the existence of the customer and the order. Actions during the scenario belong in Whens.
It's good to avoid UI detail like "click" and specific button names and "displayed on the screen". The scenario should focus on behavior. The When I go to the order step can encapsulate the details of going to the screen where you enter the number, entering the number, and clicking the button.
Likewise, all of the checks for different fields of the order that should be visible can be encapsulated in Then I should see the order.
I said "the order" rather than "my order" because And I have an order establishes that there's a single order with a special relationship with the scenario, and it's good to establish a language across all your scenarios that makes that relationship clear -- I always use "the" in that case. (This is a very small point.)
With those stylistic points taken care of, this is an OK scenario and I've certainly written many similar ones. To get to your real question, however:
Where Specflow-type tools really shine is when you use them to describe as complete a use case/user story as you can. For example:
Scenario:
Given I am a customer
And there is a product
When I go to the product page
Then I should see the product
When I add the product to my cart
And I check out
Then I should see that the order has been placed
And I should receive an order confirmation email
When I go to my orders
Then I should see the order listed
When I go to the order
Then I should see the order
When I cancel the order
Then I should see that the order has been cancelled
And I should receive an order cancellation email
When I go to my orders
Then I should not see the order listed
This is more valuable as an acceptance test, because it captures more requirements, and it's more powerful as an integration test, because it exercises more of the system, and fakes less of it. (In the short scenario we had to create an order artificially. Here we're doing it through the system.)

What is the best way to add a list of 'skills' to a user model in rails?

On my User's edit page I want users to be able to select from checkboxes what programming languages they know. I will give them about 15 to choose from. I then want to store these results in the User model to be accessed/searched for later.
What is the best way to go about this?
You can apply a many to many associations for achieving so. If you Google or even search SO, you will get lots of examples.
However, you can simply achieve same thing using the following gem
https://github.com/mbleigh/acts-as-taggable-on
It appears it's example matches your requirements. In the examples, they described same (skills) thing. So, you will get it done easily.

Resources