Mahout Boolean pref data model with multiple "purchases" - mahout

I want to obtain reccomendations on the most purchased item for an order with a specific item so for example if I have such table
user order items purchased
1 1 1,3
1 2 2,3
2 1 3
3 1 2,4
3 2 1,2,4
if I visit the page of item 2 I want item 4 as suggested product because it is present on the rows 2,4 and 5 while the item 3 is present only on row 2 (I am considering just orders with the item 2 in it) (note that the item 3 is the most purchased but I don't want it as suggested since I am looking at item 2). What kind of problem is this? Is it an item reccomender? Is it doable in Mahout or should I implement it by hand? Since it is not possible to model multiple preferences per same user and item, I have thought to convert the string user_order to userId.
Thanks very much

Yes this is a very simple recommender problem. I think you want to ignore 'order'. So your data is more like:
1,1
1,3
1,2
2,3
3,2
3,4
3,1

Related

Google Sheets: how to refer to a row with specific text

-I'm trying to create a google sheet that tracks progress of players in a team.
-Each season has its own tab.
-A tab that combines data from all sheets is needed.
-The players in the seasonal tabs are going to be in different order each season based on their performance, there are also going to be players coming and going so I can't know which row is going to include which player's data.
-The combined table needs to be able to refer to rows in other tabs where the player name is present, and count up total points for them.
Picture 1 is individual season table. Picture 2 is where I was stuck. Picture 3 is the desired output, which was achieved using the answer provided.
Example of desired output:
Player
Season 17
Season 18
Total
Player1
1800
880
1680
Player4
100
100
200
Player12
50
21
71
Player2
33
11
44
Player3
2
5
7
Player33
1
2
3
You can merge all the data in a new sheet by using the following formula:
={FILTER(Sheet1!$B$3:$P, len(Sheet1!$B$3:$P)),
FILTER(Sheet2!$B$3:$P, len(Sheet1!$B$3:$P)),
FILTER(SheetN!$B$3:$P, len(Sheet1!$B$3:$P))}`
You have to repeat the FILTER(...) part for each sheet.
In the new sheet, get the list of unique user names with =UNIQUE($A:$A), where A is the column with the player names. You can also use a list you already have instead.
You can then use =SUMIF($A:$A;P1;$B:$B) to compute the grand total for each player, where A is the column containing all the names, B the column containing all the total scores, and P the column containing the UNIQUE player names.
Alternatively, you can use =VLOOKUP(P1, SheetN!$B$3:$N$100, 13, FALSE) in the new sheet to read the total score of the player with the name in the cell P1.
I think that with more advanced magic you may be able to automatically gather the data from all the sheets, but in this case you have to manually type each heet name.

Filter based on Unique Values that only match certain criteria

This may be beyond my skill level in Google Sheets, and it's certainly straining my brain to think through, but I have two columns out a large spreadsheet (30000 lines or so) that I need to find matches between unique values on one list, and non-unique but specific values ONLY on another list. That is, I would need the following list to return only the values on the left that had a 3 in the right column every time that value appears on the left, not just for a specific instance.
"Unique" Identifier (can repeat)
Value
1
2
2
3
3
2
4
2
5
3
6
2
1
2
2
2
3
2
4
2
5
2
6
2
I have the following formula from another couple answers mocked up, but it doesn't get me all the way there:=UNIQUE(FILTER(A2:A,B2:B>0))
How can I get it to exclude the ones that have, for instance, both a 2 and a 3 in the right column for the same value in the left column?
Edit: To put it in more real terms (I was trying to keep it abstract so I could understand the basics), I have a Catalog ID and a Condition for items, and need to find all Catalog IDs that only have Good copies, not any Very Good copies. This link should show what I want to achieve:
https://docs.google.com/spreadsheets/d/e/2PACX-1vSjenkDS2Mk3t4kTcDoJqSc8AV6ONu4Q17K1HPaIUdJkb7dhdnbAt-CzUxGO3ZoJISNpGajUtFTGz8c/pubhtml?gid=0&single=true
to return only the values on the left that had a 3 in the right column every time
try:
=UNIQUE(FILTER(A:A; B:B=3))
update 1:
=UNIQUE(FILTER(Sheet1!A:A; Sheet1!B:B="Good"))
update 2:
=UNIQUE(FILTER(Sheet1!A:A, Sheet1!B:B="Good",
NOT(COUNTIF(FILTER(Sheet1!A:A, Sheet1!B:B<>"Good"), Sheet1!A:A))))

How to divide an alphabetical list into 3 column alphabetical list

I have 2 google sheets, one with an alphabetical order names and numbers for each name like: Dean 1 1 1 1, Jacob 2 2 2 2, Kyle 3 3 3 3. I want to transfer all that into another google sheet that has 3 columns, in one is Dean, in one Jacob and in the other one Kyle. I'm trying to a formula that would see a match for their names and place 1 1 1 1 for Dean, 2 2 2 2 for Jacob and 3 3 3 3 for Kyle.
Photos:
You'll find the alphabetical list in one column in the "Project Automation Final Result" in https://docs.google.com/spreadsheets/d/1QrfqAOvIc4XnaJrxk0PMr7pmQp42q2b-V8Bqrzxuchw/edit?usp=sharing
The 3 columns alphabetical list in "Names lists" same link as above.
And I want to insert the Final Result in here https://docs.google.com/spreadsheets/d/1s5yBvEcGFvUiiJTc3K-kQLlCqeOupuGcvqJkZGDmjzY/edit?usp=sharing
Any ideas, suggestions help, thank you for your time.
use this:
=ARRAYFORMULA(IFERROR(VLOOKUP(A6:A,
IMPORTRANGE("1QrfqAOvIc4XnaJrxk0PMr7pmQp42q2b-V8Bqrzxuchw",
"Project Automation Final Result!A:F"), {2,3,4,5,6}, 0)))

merge two data set and paste one column

I have two data sets and I need to merge them in a special way below.
My First data set
data1=data.frame(store=c(12,13),product=c(1,2))
data1
store product
12 1
13 2
data2=data.frame(product=c(1,1,2,2,2),promo=c("promo1","promo2","promo1","promo2","promo3"))
data2
product promo
1 promo1
1 promo2
2 promo1
2 promo2
2 promo3
Desired data set below;
store product numberofpromo promo
12 1 2 promo1;promo2
13 2 3 promo1;promo2;promo3
Thank you
data=data.frame(data2%>%
group_by(product) %>%
summarise(promotion=paste(promo,collapse=";"),
promo_say=n()))
After finding this, you need to the join

How to do a sum of a column if a particular cell of each row matches a particular value?

I'm trying to make a budget sheet for a trip.
I have 2 sheets in a Google Spreadsheet. One contains the steps of the trip. The other contains a dashboard with the sum for each of these 5 groups of steps: "food", "activities", "shopping", "hotels" and "vehicle".
My first sheet is like that (with 4 columns - the 3rd is the price):
1. Go to museum 45 Activity
2. Playing cards 5 Activity
3. Sleeping at Bohaha Hotel 123 Hotel
4. Take breakfast 10 Food
In the other sheet, I want to make different sums conditioned by the value of the 4th column, and using the values of the 3rd column.
The result of the second sheet in this example would be:
Food 10
Activities 50
Shopping 0
Hotels 123
Vehicle 0
How can I do that?
I can use a function if necessary.
Simple SUMIFS:
=SUMIFS(Sheet1!C1:C99, Sheet1!D1:D99, A1)
Assuming description in second sheet matches description in 4th column (the formula is not going to do the stemming for you to convert Activity to Activities - you can use 1 column for exact match string and 1 column as reporting label...)
I found the perfect formula :)
=SUM(FILTER('Sheet 1'!H5:H; 'Sheet 1'!G5:G="Food"))

Resources