dataBC=Import["/Users/guilhermeramos/Library/Mobile Documents/com~apple~CloudDocs/FEUP - PosDoc/Bookcrossing_data/BX-Ratings-WWW_userParsedALL.csv"];

usersConv=Import["/Users/guilhermeramos/Library/Mobile Documents/com~apple~CloudDocs/FEUP - PosDoc/Bookcrossing_data/userUnique.csv"];
itemsConv=Import["/Users/guilhermeramos/Library/Mobile Documents/com~apple~CloudDocs/FEUP - PosDoc/Bookcrossing_data/itemUnique.csv"];

dataBC2={#[[1]],#[[2]],(#[[3]]+1)/11//N}&/@dataBC;

(* Simple Reputation-based Ranking *)
Clear[RepBase]
RepBase[data_,λ_,Nit_]:=Module[{R,ranks,reps,tmp,tmp2,n,m,usrs,itms,repsI,gatherByUsers,gatherByItems},
gatherByUsers=GatherBy[data,#[[1]]&];
gatherByItems=GatherBy[data,#[[2]]&];
n=Max[#[[1]]&/@data];
m=Max[#[[2]]&/@data];
reps=Table[.5,n];
ranks=Table[0,m];
Do[
(* Ranks *)
Do[
tmp=gatherByItems[[i]];
usrs=First/@tmp;
If[Length[usrs]==0,Continue[]];
repsI=reps[[usrs]];
ranks[[i]]=1/Total[repsI]*(repsI.(#[[3]]&/@tmp));
,{i,m}
];
(* Reps *)
Do[
tmp2=gatherByUsers[[u]];

itms=(#[[2]]&/@tmp2);
If[Length[itms]==0,Continue[]];
reps[[u]]=1-(λ/Length[itms])(Norm[(#[[3]]&/@tmp2)-ranks[[itms]],1]);
,{u,n}
];
,{k,Nit}
];
{reps,ranks}
];

{reps1,ranks1}=RepBase[dataBC2,.5,2];

reps1[[;;20]]

ranks1[[;;20]]

Histogram[reps1]

(* Fair Reputation-based Ranking *)
Clear[FairRepBase]
FairRepBase[data_,λ_,Nit_,groups_]:=Module[{R,ranks,reps,n,m,usrs,itms,repsI,μs,σs,μ,σ,tmp,tmp2,gatherByUsers,gatherByItems},
gatherByUsers=GatherBy[data,#[[1]]&];
gatherByItems=GatherBy[data,#[[2]]&];
n=Max[#[[1]]&/@data];
m=Max[#[[2]]&/@data];
reps=Table[.5,n];
ranks=Table[0,m];
Do[
(* Ranks *)
Do[
tmp=gatherByItems[[i]];
usrs=First/@tmp;
If[Length[usrs]==0,Continue[]];
repsI=reps[[usrs]];
ranks[[i]]=1/Total[repsI]*(repsI.(#[[3]]&/@tmp));
,{i,m}
];

(* Reps *)
Do[
tmp2=gatherByUsers[[u]];

itms=(#[[2]]&/@tmp2);
If[Length[itms]==0,Continue[]];
reps[[u]]=1-(λ/Length[itms])(Norm[(#[[3]]&/@tmp2)-ranks[[itms]],1]);
,{u,n}
];
,{k,Nit}
];
(* Fair *)
{μs,σs}=({Mean[#],StandardDeviation[#]}&/@Table[reps[[g]],{g,groups}])\[Transpose];
μ=Min[μs];
σ=Min[σs];
Print[{μ,σ}];
Do[
If[σs[[i]]<10^-6,
reps[[groups[[i]]]]=(μ+(reps[[groups[[i]]]]-μs[[i]])*(σ/(10^-6))),
reps[[groups[[i]]]]=(μ+(reps[[groups[[i]]]]-μs[[i]])*(σ/σs[[i]]))
];
,{i,Length[groups]}
];
(* Ranks *)
Do[
tmp=gatherByItems[[i]];
usrs=First/@tmp;
If[Length[usrs]==0,Continue[]];
repsI=reps[[usrs]];
ranks[[i]]=1/Total[repsI]*(repsI.(#[[3]]&/@tmp));
,{i,m}
];
{reps,ranks}
];

(* Fair Reputation-based Ranking groups of attributes *)
Clear[FairRepBaseSubset]
FairRepBaseSubset[data_,λ_,Nit_,groups_]:=Module[{R,ranks,reps,n,m,usrs,itms,repsI,μs,σs,μ,σ,tmp,tmp2,gatherByUsers,gatherByItems,subset,help},
gatherByUsers=GatherBy[data,#[[1]]&];
gatherByItems=GatherBy[data,#[[2]]&];
n=Max[#[[1]]&/@data];
m=Max[#[[2]]&/@data];
reps=Table[.5,n];
ranks=Table[0,m];
subset=Union[Flatten[groups]];
Do[
(* Ranks *)
Do[
tmp=gatherByItems[[i]];
help=Table[If[MemberQ[subset,tmp[[i,1]]],i,Nothing],{i,Length@tmp}];
usrs=Flatten[tmp[[#,1]]&/@help];
If[Length[usrs]==0,Continue[]];
repsI=reps[[usrs]];

If[Length@repsI≠Length@(Flatten[tmp[[#,3]]&/@help]),
Print[{Length@help,Length@usrs,Length@repsI,Length@(Flatten[tmp[[#,1]]&/@help])}];
Abort[]];

ranks[[i]]=1.0/Total[repsI]*(repsI.(Flatten[tmp[[#,3]]&/@help]));
,{i,m}
];

(* Reps *)
Do[
tmp2=gatherByUsers[[u]];
help=Table[If[MemberQ[subset,tmp2[[i,1]]],i,Nothing],{i,Length@tmp2}];
itms=Flatten[tmp2[[#,2]]&/@help];
If[Length[itms]==0,Continue[]];
reps[[u]]=1.0-(λ/Length[itms])(Norm[(Flatten[tmp2[[#,3]]&/@help])-ranks[[itms]],1]);
,{u,n}
];
Print[k];
,{k,Nit}
];
(* Fair *)
{μs,σs}=({Mean[#],StandardDeviation[#]}&/@Table[reps[[g]],{g,groups}])\[Transpose];
μ=Min[μs];
σ=Min[σs];
Print[{μ,σ}];
Do[
If[σs[[i]]<10^-6,
reps[[groups[[i]]]]=(μ+(reps[[groups[[i]]]]-μs[[i]])*(σ/(10^-6))),
reps[[groups[[i]]]]=(μ+(reps[[groups[[i]]]]-μs[[i]])*(σ/σs[[i]]))
];
,{i,Length[groups]}
];
(* Ranks *)
Do[
tmp=gatherByItems[[i]];
help=Table[If[MemberQ[subset,tmp[[i,1]]],i,Nothing],{i,Length@tmp}];
usrs=Flatten[tmp[[#,1]]&/@help];
If[Length[usrs]==0,Continue[]];
repsI=reps[[usrs]];
If[Length@repsI≠Length@(Flatten[tmp[[#,3]]&/@help]),
Print[{Length@help,Length@usrs,Length@repsI,Length@(Flatten[tmp[[#,1]]&/@help])}];
Abort[]];
ranks[[i]]=1.0/Total[repsI]*(repsI.(Flatten[tmp[[#,3]]&/@help]));
,{i,m}
];
{reps,ranks}
];

userAtt=Import["/Users/guilhermeramos/Library/Mobile Documents/com~apple~CloudDocs/FEUP - PosDoc/Bookcrossing_data/BX-Users-WWW.csv"][[2;;]];

userAtt[[;;10]]

userAtt[[2,2,0]]

StringSplit[userAtt[[2,2]],", "][[-1]]

Max[First/@userAtt]

Max[First/@dataBC]

userAtt2=({ToExpression[#[[1]]]}~Join~{StringSplit[#[[2]],", "][[-1]]}~Join~{#[[3]]})&/@userAtt;

userAtt2

usersConv[[;;10]]

DotheConversion[convList_,listToConv_]:=Module[{res,user,found,i,USERS},
res={};
USERS=Last/@convList;
Do[
user=el[[1]];
If[MemberQ[USERS,user],
found=False;
i=1;
While[!found,
If[convList[[i,2]]==user,
found=True,
i++;
];
];
AppendTo[res,{convList[[i,1]]}~Join~el[[2;;]]];
];
,{el,listToConv}
];
res
];

userAtt3=DotheConversion[usersConv,userAtt2];

Max[Last/@usersConv]

Max[First/@userAtt]

Min[First/@userAtt]

userAtt[[;;10]]

Min[Last/@usersConv]
Max[Last/@usersConv]

Min[First/@userAtt]
Max[First/@userAtt]

Length[usersConv]

Length[userAtt]

Length[Intersection[Last/@usersConv,First/@userAtt]]

userAtt4=Table[{el[[1]]}~Join~((userAtt2[[Position[First/@userAtt2,el[[2]]][[1,1]]]])[[2;;]]),{el,usersConv}];

Beep[]

userAtt4[[;;10]]

userAtt5=(#[[;;2]]~Join~{IntegerPart[#[[3]]]})&/@userAtt4;

userAtt5[[;;10]]

gatherByAge=GatherBy[userAtt5,Last];

usersCV0To20=Select[userAtt5,Last@#≤20&];
usersCV20To40=Select[userAtt5,20<Last@#≤40&];
usersCV40To60=Select[userAtt5,40<Last@#≤60&];
usersCV60Tooo=Select[userAtt5,Last@#>60&];

usersCV0To20[[1]]

Length/@({First/@usersCV0To20,First/@usersCV20To40,First/@usersCV40To60,First/@usersCV60Tooo})

PieChart3D[Length/@({First/@usersCV0To20,First/@usersCV20To40,First/@usersCV40To60,First/@usersCV60Tooo}),ChartLegends->Placed[SwatchLegend[{None,{"]0,20]","]20,40]","]40,60]","]60,∞["}},LegendFunction->(Framed[Style[#,14],RoundingRadius->3,Background->White]&),LegendMargins->5],{.15,.6}]]

usersCV0To20[[;;10]]

BoxWhiskerChart[reps1[[#]]&/@({First/@usersCV0To20,First/@usersCV20To40,First/@usersCV40To60,First/@usersCV60Tooo}),{"Outliers",{"MeanMarker",1,Directive[Thick,White]}},AspectRatio->.4,BarSpacing->.5,GridLines->Automatic,GridLinesStyle->Directive[Gray, Dotted],FrameStyle->Directive[Black,14],ChartLegends->Placed[SwatchLegend[{None,{"]0,20]","]20,40]","]40,60]","]60,∞["}},LegendFunction->(Framed[Style[#,14],RoundingRadius->3,Background->White]&),LegendMargins->5],{.15,.6}],PlotTheme->"Detailed",ChartStyle->97,BarOrigin->Left,PlotRange->{{.43,1},All}]

userAtt5=({#[[1]]}~Join~{Check[StringSplit[#[[2]],","][[-1]],Null]}~Join~{IntegerPart[#[[3]]]})&/@(userAtt);

Check

userAtt5

countries=Union[#[[2]]&/@userAtt5];

countries

Length@countries

continents=Import["/Users/guilhermeramos/Library/Mobile Documents/com~apple~CloudDocs/FEUP - PosDoc/Bookcrossing_data/Continents_data.csv"];

continents[[;;10]]

userAtt5[[1,2]]

Capitalize[StringTake[userAtt5[[5,2]],{2,-1}]]

FindContinent[string_,contInfo_]:=Module[{i,found,usa},
found=False;
i=1;
usa=False;
While[i≤Length@contInfo&&!found,
If[StringContainsQ[Capitalize[StringTake[string[[2]],{2,-1}]],"usa"]||StringContainsQ[Capitalize[StringTake[string[[2]],{2,-1}]],"u.s.a"],
found=True;
usa=True,
If[(StringContainsQ[contInfo[[i,3]],Capitalize[StringTake[string[[2]],{2,-1}]]]),
found=True,
i++;
];
];
];
If[found,If[usa,"NA",contInfo[[i,2]]],{}]
];

userAtt5[[;;100]]

CLUSTERSkmeans3={{600,6299,6765,6845,6958,17466,18773,33053,33311,35914,42831,51280,52899,490,1294,20360,20967,27005,29677,4683,10441,16558,16871,18192,18710,20532,27295,27570,27967,40473,42972,50553,50607,762,2330,3116,6522,14321,15202,16777,19269,19836,31039,32236,34959,44347,45318,48490,4668,13385,16735,42364,44102,44305,48113,48308,6263,12120,15199,15504,16630,22815,30261,35777,36780,39501,39827,45059,3239,3430,3993,4682,10637,11476,11804,14396,14795,14937,14942,17453,18095,18812,20656,20673,24845,27236,28778,29351,30634,32281,34659,36883,37486,42539,43750,44135,46104,46357,48293,48620,49321,49716,52456,28495,37143,51447,542,928,2194,7190,14666,15309,16066,17159,17599,21737,22774,23292,23485,23799,23823,25752,25901,26404,29776,32621,34393,35016,37991,40064,41280,41815,46780,48092,49367,117,5552,5837,8425,8636,12303,17705,22904,23840,27410,38971,42164,44676,46232,51423,51973,1986,16709,19876,34990,3081,8064,9327,24238,27028,32478,51741,52600,4001,9477,11977,13202,20186,27604,8448,10305,14873,49765,1030,2690,12316,12542,13130,20319,22416,24951,26805,32893,36411,36802,38154,43417,53157,1951,2148,5809,24755,30112,36168,44976,48677,50099,51505,4449,7386,10845,13352,20984,21706,22067,26923,29735,31141,36458,37191,37869,38466,38668,41016,43500,45075,47269,48840,50761,52232,1675,8146,12309,12455,22693,23935,27053,27130,38304,43979,49859,1579,2211,3634,4251,4253,4874,6431,7229,7631,11146,11695,11755,13442,14907,16758,17633,18108,20239,21062,21429,31126,31768,33571,35998,36600,36785,37735,37899,38469,42912,43129,43544,44213,46111,47631,51783,52398,52458,194,2542,9384,20899,21995,23160,39467,42133,42352,29212,47189,20233,23624,40068,41264,43884,2510,21780,25276,28323,35303,4274,6346,6798,9659,14001,17235,17660,17933,18019,19818,21057,24642,30579,32404,41663,41781,42959,51957,53382,4012,4982,6057,6960,13322,15666,17577,17684,19497,22788,24941,34264,34359,34368,37103,37320,39386,40726,41477,45552,47937,48189,50773,13185,49311,52353,23982,42991,47907,48517,4690,10543,20124,26403,33888,38525,43392,9860,3412,13270,15157,16497,20004,20634,32529,33012,33929,22772,27139,32928,43562,46430,854,885,2267,5430,5497,6492,6701,8100,8340,16646,18273,19234,19832,21916,22119,22293,22638,22852,23477,25235,25852,26569,29417,29689,32331,39640,39832,42995,43248,44955,46003,49550,2425,5001,5950,8383,10626,10683,12147,12655,18923,19185,21395,25380,25896,26708,27656,27809,29855,30784,33247,35615,35896,36406,36604,37189,38720,40998,42825,44129,44593,45418,48479,50221,51004,51434,52221,7525,11337,27253,27891,3519,10741,12142,12900,13599,14110,15979,17857,19670,24083,28720,28783,32735,35394,37861,38170,40376,46242,51989,1472,2754,3498,6981,8832,9474,9755,10795,11802,13775,15698,23636,31600,33068,34187,34669,35483,39102,40807,43363,44062,45465,46411,47535,51376,52323,6851,7096,34259,52950,846,10548,24673,26614,29865,32122,44761,48155,49762,7977,14583,16151,17894,26138,32813,37463,42765,46004,46884,3791,6849,8221,9140,21859,25206,30999,31027,35808,37577,45179,47305,48449,49347,17740,19141,27934,33420,50011,51523,51893,7290,24517,24625,30182,38415,42227,48806,51121,3756,4951,21381,21600,31831,33362,52064,32721,38603,44760,4696,10262,13025,20958,33134,23252,45043,19591,28939,39022,46985,50083,52208,7212,12209,19337,28219,28757,30223,1069,39485,44991,1103,10906,11714,15258,24732,29145,34175,36101,40382,47223,49196,51910,52282,2888,22974,29147,36678,44961,2234,12197,19824,22294,28437,30157,32833,36495,37981,40215,48240,51533,1567,2130,4949,6997,8525,9730,13802,15142,18678,23451,31669,41119,43959,45661,49549,11861,17794,18727,19200,31409,34843,45096,9779,26522,50042,15386,24215,25958,39149,43977,47523,9569,40492,17410,31511,34540,39970,47780,47992,33566,7734,9175,9968,19258,19821,26317,27220,28096,36559,37291,47879,52047,52411,29155,34363,4693,16051,21464,21502,21974,26680,26863,34683,36324,39659,40926,44330,46218,50833,343,11258,30667,53197,2499,22741,22775,30854,31339,8933,19808,21535,27942,39058,1148,4208,14687,15323,20884,33575,37230,40483,46962,160,4862,5549,6462,10115,12553,13168,15454,16931,18234,21234,23042,23238,24261,29752,34543,44800,50846,34935,23166,23764,29378,39049,48323,25547,26973,32091,41952,44458,45378,1604,11571,14767,20889,21442,32831,34966,39636,44940,51556,8859,33754,38540,27330,636,1590,8276,10837,14800,22576,27799,34418,36143,51776,17512,3885,29028,2843,7262,11637,22422,14557,17605,17720,21020,30034,44259,26470,32117,44535,5595,12211,16202,28540,30510,33847,36224,41753,8854,11013,13330,19023,21046,22645,29374,31286,34427,47243,49195,13724,20241,26748,37348,38478,39474,50838,10396,29381,6808,8890,15936,24921,31723,14958,15194,50664,5010,6378,34953,47904,3944,11316,36529,36571,45807,46157,51117,16128,30405,52384,47202,28697,39175,47730,40747,43521,27599,16302,23579,32753,10986,16381,13282,17840,21353,32612,12572,12894,16214,26747,32081,36421,39201,9044,16708,26085,29121,48949,51135,342,8232,19350,21242,23931,34237,3140,16401,30600,24399,32415,28964,29033,41895,12428,27022,27255,29774,32638,32703,35357,48575,40712,52577,25172,39762,42723,39273,6185,11938,24353,30213,23501,36753,40264,30032,49083,52044,26160,19609,32606,33610,1772,29831,18981,3654,25085,41003,38037,29955,15249,43179,14382,46553,11747,32528,47472,4870,19943,28341,23508,2293,25335,15434,49935,7630,31942,44513,6779,3692,12970,23742,20094,3021,1443,43386,25602,1598,44161,53165,45739,52626,36017,6049,30768,11752,26243,52054,3914,16471,50563,30580,24263,24358,3826,30774},
{8843,9982,31119,47027,51258,12134,23921,29126,33437,11058,17460,35971,28571,32801,1714,13703,12421,12663,17450,30709,40927,51868,1192,3471,5859,7583,11431,32782,33056,34480,1218,2828,8603,10603,11088,14095,17580,23884,25992,28842,29347,35240,38760,40961,44197,45103,47515,51138,39496,47242,47603,1592,15422,25066,25529,28244,36765,36974,48858,52896,52976,3085,8975,13368,13978,20262,24694,25020,26125,28235,28320,28387,29570,33626,35132,35854,38278,42940,43638,44406,52145,52519,712,6239,17437,19895,29749,35564,35737,53218,8245,24011,25379,22582,15421,25804,34512,40156,10442,11709,24635,33655,37240,40098,43414,51243,13821,16317,33341,39794,53092,3915,7366,7846,9918,19438,19799,27340,36061,37180,39765,46830,40061,30,2373,2785,12770,19455,42522,2452,6497,8037,14702,15673,15852,17257,18658,21214,30194,31016,47371,50632,1333,45431,884,4928,10529,21898,30195,33270,45223,37598,40289,44006,18223,26793,42483,9587,11345,20794,37239,44159,53390,51,25822,34792,36708,45520,52835,53317,3092,5213,34098,42835,51648,28155,52485,37061,37299,38994,6806,13666,25726,37442,44270,54,3746,9794,33722,41478,48786,2555,8649,8711,13372,17935,18874,21362,30376,1796,14957,25571,26650,26924,31024,38656,39171,50960,5184,13449,15433,15629,24820,26328,27658,37866,38790,39662,42462,45171,25046,31270,14292,18292,25581,32986,33300,47899,1251,2630,8413,10703,13257,14725,15788,21884,40093,47209,52914,37062,141,3542,34121,51975,7967,9307,12446,28404,40920,49026,49332,51951,1546,4401,37570,19144,37770,42512,6347,8160,11215,16147,16920,17558,18781,19020,24933,36011,29598,31293,38019,671,21843,25485,36410,38036,40045,50367,51361,3753,8031,26268,30429,51356,4166,24606,39872,42753,48023,1142,21470,48116,53306,2839,7974,16391,30533,51178,11398,42416,43287,43300,43693,43755,44744,51179,53204,1987,9319,18876,25443,30397,32280,27068,27597,29861,36500,49462,15004,24236,33819,35212,39037,45651,51466,19676,22641,33622,10545,39727,13424,13952,44701,45283,52451,107,8356,19432,47263,20808,21994,47657,317,5851,10969,18168,24679,33209,33922,36718,42372,48127,5713,15841,44223,6976,43066,20715,31871,35366,39062,21370,45456,42970,3315,36548,51840,351,1544,8801,31843,35870,16835,27502,2597,19288,23183,38141,28179,2108,17358,32055,33930,37145,43243,43645,32110,16619,20663,46230,15537,28618,7111,46648,4068,46981,51909,29788,41618,46640,26646,21122,27347,28220,37727,52649,6102,9475,40097,45955,8215,11446,12379,21166,23736,44680,2838,15821,42519,50261,11944,20645,24812,37912,44068,9248,12869,43736,16598,35538,51012,42856,1466,2905,20228,25187,29425,41833,47725,47820,11275,17714,34702,2384,3411,11017,33756,9165,15148,23898,38164,45500,28032,39117,51425,3232,49222,43856,17345,28694,39199,43208,43459,15890,26415,26558,34532,36869,41771,47956,48966,22635,8590,17887,19320,25366,42363,50970,23956,39771,19341,50586,14045,41542,50425,32432,7920,14648,16498,18919,29192,31067,33851,39167,40740,46318,118,25240,20996,44446,50868,4072,16291,32661,27357,30639,32930,35837,36264,44591,46517,48659,18750,6610,22409,37425,7649,26867,31282,45595,4092,12079,25519,294,21374,23646,6123,10247,17922,32070,1672,6510,26011,44046,27427,33501,50974,35435,8741,15520,23244,25530,1371,15345,52213,47964,37816,49233,9308,13427,24326,40388,45188,14397,17370,17861,16007,12997,35306,12083,21079,14309,1106,5264,24542,32014,39434,49914,15773,38759,14030,14254,18507,36644,6283,6577,14993,44052,16236,21958,35851,46084,51791,12706,19140,24460,27463,4577,9523,28029,28352,50347,51595,30180,34735,41335,20622,41205,44913,48059,51375,53038,30082,14253,15123,28250,38948,6969,20381,40871,50427,13759,2366,12795,51048,31855,40441,19333,41802,51718,14140,43105,44059,21653,39038,26529,44687,47912,23850,45455,6541,9771,36807,43400,815,13216,16290,40170,42218,4268,7208,9668,12402,18523,23844,26653,53179,44464,45315,8917,36523,21064,51534,15971,20748,26539,40356,12771,19434,10474,35532,43570,13291,20847,43915,21976,1313,2461,2950,15275,27322,36305,45210,48120,36598,6527,10023,10078,36525,46731,46896,51863,47147,29981,41022,46024,1149,16295,30749,48190,5814,15352,45444,15937,28971,38467,43746,15691,20797,30153,8868,42115,18381,45713,7079,25007,36046,6508,601,37957,43872,19752,2546,20737,26543,42988,49619,8707,13600,15563,41576,11496,18903,9846,15801,33730,52497,45993,47018,51959,37652,11610,30191,13551,32926,25589,48374,52498,22188,30294,35494,24544,51865,17653,41803,41810,45790,43233,28600,38611,19326,23588,26733,26881,11060,21417,24975,616,39042,32259,2734,48366,4537,6966,15097,45078,48044,21157,15276,39374,28349,7881,8873,24889,37498,30562,948,49401,9861,15603,30055,14695,38483,45528,15638,29304,1422,9093,38380,39263,21411,52770,51096,46009,44065,3426,8353,16714,912,39122,11478,5605,18831,19196,22357,829,20153,51600,36960,45386,6485,3535,33844,7358,46015,20664,52163,37932,32982,8415,22463,37213,37691,40300,41001,37569,41712,12851,29621,33320,32313,33951,48348,10229,41585,45259,40751,2336,26738,30144,9588,20507,4741,3339,33650,42426,26856,15963,25649,45752,6607,41594,9756,26888,34010,7141,15384,34145,38492,19637,51891,32668,42083,6409,31563,27601,17413,31057,29927,48181,51557,47872,50687,35064,43109,5624,26036,41505,5206,47299,31542,33039,10992,43350,10010,4135,29699,32794,49976,31715,3381,23205,27079,52523,28825,47206,23927,24398,28601,35204,42827,49015,11216,43909,34957,1328,19731,29607,29610,39223,47464,19651,12658,22978,30839,45851,46461,52247,51209,51402,5190,41644,4315,26927,51366,14766,21591,39910,46501,7830,31077,49783,11437,4902,7021,45996,33256,32207,34338,7660,33701,45938,7261,46466,2640,33215,28536,33414,47497,25305,43851,11942,3427,44662,598,48789,16824,40888,5670,22809,10282,8684,22406,51210,46127,41809,1382,19552,8302,34267,3808,28312,41932,4945,10925,47408,21617,26777,43919,4297,30060,37011,37283,19929,4952,40606,18178,45696,16828,19551,1525,22260,36730,27291,48830,51608,17208,7989,37573,33954,18300,24052,30814,5824,30208,41894,14630,18397,29764,7013,1952,21657,30609,5110,38445,38681,5716,30558,15571,22217,14597,23196,33907,17689,35825,9214,14566,30340,4844,9337,39573,18303,16188,47567,40527,18629,32453,34164,32098,29922,35066,33030,24556,12352,28986,35081,6908,49566,16892,17176,15724,16724,50093,13674,41291},
{1146,1959,2190,5467,6437,7667,22343,22970,34095,36310,38891,39652,41510,42677,43278,49049,50008,50674,50814,5707,9715,11563,21457,24814,33759,35175,43089,46279,48780,3185,6061,7081,7399,9640,10296,23024,24424,24869,26731,27436,28226,31138,32047,35665,39836,40659,41793,43804,44348,44732,45094,49182,2002,8267,13251,20890,22882,24747,27115,29657,32499,34621,35912,36220,38254,41494,44638,17227,24025,33041,48407,4226,15170,23416,24038,36794,36972,40044,41321,46750,47803,50265,50428,51498,3920,3966,5229,8545,11686,12210,12521,16676,16807,17218,21903,22697,29081,33553,35559,36479,36917,39438,42884,46550,47783,48451,49084,8220,9944,13018,16016,31383,40748,48225,50190,52652,3235,8905,12990,13023,14605,17265,27277,27320,30721,42366,47871,50281,13806,25797,47939,21819,8069,37341,48074,11622,15321,18717,35077,37908,40425,49546,4574,9149,22123,27460,32501,1752,12441,19148,20750,37125,38465,40707,42934,43626,30511,35390,46889,9135,13805,34831,50071,1820,18356,24253,37479,7011,9173,15135,18823,20299,22282,22959,24731,26692,27076,27469,28105,28898,29169,29913,30858,41707,42774,51215,51572,52719,35810,48115,30983,24250,41273,3014,24849,48654,49043,5020,11324,22209,24725,31341,39962,150,11404,16999,24031,24504,27728,27755,33344,48707,48881,50169,10827,17769,37911,3631,7131,44892,53145,6901,13913,42075,8898,17305,24711,38784,7887,8467,19098,28794,29335,42969,45424,46559,51526,37997,50243,19385,21471,35113,5417,13798,27334,35834,44405,46552,18655,26968,8818,23202,27631,47513,31707,15255,2188,10728,30873,1817,26468,51216,34442,44245,20910,30906,52075,13670,32285,21451,22599,48421,41886,12263,27872,14138,17817,51687,27812}
};

continents

x=0;
Print[ProgressIndicator[Dynamic[x/Length@userAtt5]]];
Print[Dynamic[{x,Length@userAtt5}]];
userCont=Table[x=k;
FindContinent[userAtt5[[k]],continents]
,{k,Length@userAtt5}];

Beep[]
Union[userCont]

Length@userCont

userCont[[;;1000]]

Union[userCont]

usersWithLoc=Table[If[userCont[[i]]==={},Nothing,i],{i,Length@userCont}];

usersWithLoc[[;;10]]

Count[userCont,{}]

usersConv[[usersWithLoc[[;;10]]]]

dataBC2

groundTruthBC=Map[Function[y,Mean[Last/@y]],GatherBy[dataBC2,#[[2]]&]];

groundTruthBC[[1]]

Length[groundTruthBC]

{reps1,ranks1}=RepBase[dataBC2,.5,2];

reps1[[;;20]]

Length@ranks1

KendallTau[groundTruthBC,ranks1]

usersCV0To20[[;;20]]

usersCV0To20

If[#≤Length[reps1],reps1[[#]],Nothing]&/@({First/@usersCV0To20,First/@usersCV20To40,First/@usersCV40To60,First/@usersCV60Tooo})

ages

Length@ages

BoxWhiskerChart[reps1[[#]]&/@({Select[ages[[1]],#<53358&],Select[ages[[2]],#<53358&],Select[ages[[3]],#<53358&],Select[ages[[4]],#<53358&]}),{"Outliers",{"MeanMarker",1,Directive[Thick,White]}},AspectRatio->.4,BarSpacing->.5,GridLines->Automatic,GridLinesStyle->Directive[Gray, Dotted],FrameStyle->Directive[Black,14],ChartLegends->Placed[SwatchLegend[{None,{"]0,20]","]20,40]","]40,60]","]60,∞["}},LegendFunction->(Framed[Style[#,14],RoundingRadius->3,Background->White]&),LegendMargins->5],{.15,.6}],PlotTheme->"Detailed",ChartStyle->97,BarOrigin->Left,PlotRange->{All,All}]

Export["/Users/gramos/Library/Mobile Documents/com~apple~CloudDocs/FEUP - PosDoc/Bookcrossing_data/plot1.csv",reps1[[#]]&/@({Select[ages[[1]],#<53358&],Select[ages[[2]],#<53358&],Select[ages[[3]],#<53358&],Select[ages[[4]],#<53358&]})]

dataBC2[[usersWithLoc]][[;;10]]

{reps1,ranks1}=RepBase[dataBC2,.5,3];

Length/@{First/@usersCV0To20,First/@usersCV20To40,First/@usersCV40To60,First/@usersCV60Tooo}

Total@%

GatherBy[dataBC2,First]//Length

53408

{reps1Age,ranks1Age}=FairRepBase[dataBC2,.5,3,(Function[w,Select[w,#≤53408&]])/@{First/@usersCV0To20,First/@usersCV20To40,First/@usersCV40To60,First/@usersCV60Tooo}];

KendallTau[groundTruthBC,ranks1Age]

BoxWhiskerChart[reps1Age[[#]]&/@({First/@usersCV0To20,First/@usersCV20To40,First/@usersCV40To60,First/@usersCV60Tooo}),{"Outliers",{"MeanMarker",1,Directive[Thick,White]}},AspectRatio->.4,BarSpacing->.5,GridLines->Automatic,GridLinesStyle->Directive[Gray, Dotted],FrameStyle->Directive[Black,14],ChartLegends->Placed[SwatchLegend[{None,{"]0,20]","]20,40]","]40,60]","]60,∞["}},LegendFunction->(Framed[Style[#,14],RoundingRadius->3,Background->White]&),LegendMargins->5],{.15,.6}],PlotTheme->"Detailed",ChartStyle->97,BarOrigin->Left,PlotRange->{{.43,1},All}]

Export["/Users/gramos/Library/Mobile Documents/com~apple~CloudDocs/FEUP - PosDoc/Bookcrossing_data/plot2.txt",reps1Age[[#]]&/@({First/@usersCV0To20,First/@usersCV20To40,First/@usersCV40To60,First/@usersCV60Tooo})]

DiffLocs=GatherBy[Table[{i,userCont[[i]]},{i,Length@userCont}],Last];

userCont[[;;100]]

Length@DiffLocs

Last@First@#&/@DiffLocs

NewLocs={DiffLocs[[2]],DiffLocs[[3]]~Join~DiffLocs[[6]],DiffLocs[[5]]~Join~DiffLocs[[4]],DiffLocs[[7]]};

Length@reps1

BoxWhiskerChart[reps1[[#]]&/@(Map[Function[y,Select[(First/@y),#≤53408&]],DiffLocs[[2;;-2]]]),{"Outliers",{"MeanMarker",1,Directive[Thick,White]}},AspectRatio->.4,BarSpacing->.5,GridLines->Automatic,GridLinesStyle->Directive[Gray, Dotted],FrameStyle->Directive[Black,14],ChartLegends->Placed[SwatchLegend[{None,{"EU","OC","SA","NA","AS","AF","AN"}},LegendFunction->(Framed[Style[#,14],RoundingRadius->3,Background->White]&),LegendMargins->5],{0,0}],PlotTheme->"Detailed",ChartStyle->97,BarOrigin->Left,PlotRange->{{.43,1},All}]

Export["/Users/gramos/Library/Mobile Documents/com~apple~CloudDocs/FEUP - PosDoc/Bookcrossing_data/plot3.txt",reps1[[#]]&/@(Map[Function[y,Select[(First/@y),#≤53408&]],DiffLocs[[2;;-2]]])]

BoxWhiskerChart[reps1[[#]]&/@(Map[Function[y,Select[(First/@y),#≤53408&]],NewLocs]),{"Outliers",{"MeanMarker",1,Directive[Thick,White]}},AspectRatio->.4,BarSpacing->.5,GridLines->Automatic,GridLinesStyle->Directive[Gray, Dotted],FrameStyle->Directive[Black,14],ChartLegends->Placed[SwatchLegend[{None,{"EU","OC","SA","NA","AS","AF","AN"}},LegendFunction->(Framed[Style[#,14],RoundingRadius->3,Background->White]&),LegendMargins->5],{0,0}],PlotTheme->"Detailed",ChartStyle->97,BarOrigin->Left,PlotRange->{{.43,1},All}]

{reps1Loc,ranks1Age}=FairRepBase[dataBC2,.5,3,{First/@usersCV0To20,First/@usersCV20To40,First/@usersCV40To60,First/@usersCV60Tooo}];

BoxWhiskerChart[reps1Loc[[#]]&/@(Map[Function[y,Select[(First/@y),#≤53408&]],NewLocs]),{"Outliers",{"MeanMarker",1,Directive[Thick,White]}},AspectRatio->.4,BarSpacing->.5,GridLines->Automatic,GridLinesStyle->Directive[Gray, Dotted],FrameStyle->Directive[Black,14],ChartLegends->Placed[SwatchLegend[{None,{"EU","OC","SA","NA","AS","AF","AN"}},LegendFunction->(Framed[Style[#,14],RoundingRadius->3,Background->White]&),LegendMargins->5],{0,0}],PlotTheme->"Detailed",ChartStyle->97,BarOrigin->Left,PlotRange->{{.43,1},All}]

Export["/Users/gramos/Library/Mobile Documents/com~apple~CloudDocs/FEUP - PosDoc/Bookcrossing_data/BC_OnlyLoc_fair.csv",reps1Loc[[#]]&/@(Map[Function[y,Select[(First/@y),#≤53408&]],NewLocs])]

Export["/Users/gramos/Library/Mobile Documents/com~apple~CloudDocs/FEUP - PosDoc/Bookcrossing_data/plot3Join.csv",reps1[[#]]&/@(Map[Function[y,Select[(First/@y),#≤53408&]],NewLocs])]

BoxWhiskerChart[reps1Age[[#]]&/@(Map[Function[y,Select[(First/@y),#≤53408&]],DiffLocs[[2;;-2]]]),{"Outliers",{"MeanMarker",1,Directive[Thick,White]}},AspectRatio->.4,BarSpacing->.5,GridLines->Automatic,GridLinesStyle->Directive[Gray, Dotted],FrameStyle->Directive[Black,14],ChartLegends->Placed[SwatchLegend[{None,{"EU","OC","SA","NA","AS","AF","AN"}},LegendFunction->(Framed[Style[#,14],RoundingRadius->3,Background->White]&),LegendMargins->5],{0,0}],PlotTheme->"Detailed",ChartStyle->97,BarOrigin->Left,PlotRange->{{.43,1},All}]

Export["/Users/gramos/Library/Mobile Documents/com~apple~CloudDocs/FEUP - PosDoc/Bookcrossing_data/plot4.txt",reps1Age[[#]]&/@(Map[Function[y,Select[(First/@y),#≤53408&]],DiffLocs[[2;;-2]]])]

(#[[1,2]]&/@DiffLocs)[[2;;-2]]

{reps1Mult,ranks1Mult}=FairRepBase[dataBC2,.5,3,
Select[{Intersection[ages[[1]],locs[[1]]],Intersection[ages[[1]],locs[[2]]],Intersection[ages[[1]],locs[[3]]],Intersection[ages[[1]],locs[[4]]],

Intersection[ages[[2]],locs[[1]]],Intersection[ages[[2]],locs[[2]]],Intersection[ages[[2]],locs[[3]]],Intersection[ages[[2]],locs[[4]]],

Intersection[ages[[3]],locs[[1]]],Intersection[ages[[3]],locs[[2]]],Intersection[ages[[3]],locs[[3]]],Intersection[ages[[3]],locs[[4]]],

Intersection[ages[[4]],locs[[1]]],Intersection[ages[[4]],locs[[2]]],Intersection[ages[[4]],locs[[3]]],Intersection[ages[[4]],locs[[4]]]
},Length[#]>1&]];

.

filteredUsrs=Intersection[Join@@CLUSTERSkmeans3,Join@@locs];

filteredUsrs[[;;10]]

locs=(Map[Function[y,Select[(First/@y),#≤53408&]],NewLocs]);
ages={First/@usersCV0To20,First/@usersCV20To40,First/@usersCV40To60,First/@usersCV60Tooo};

Length@locs
Length@ages

dataBC2Filter=Table[If[MemberQ[filteredUsrs,el[[1]]],el,Nothing],{el,dataBC2}];

dataBC2Filter[[;;10]]

clustAndLocs={
Intersection[CLUSTERSkmeans3[[1]]+1,locs[[1]]],Intersection[CLUSTERSkmeans3[[1]]+1,locs[[2]]],Intersection[CLUSTERSkmeans3[[1]]+1,locs[[3]]],Intersection[CLUSTERSkmeans3[[1]]+1,locs[[4]]],

Intersection[CLUSTERSkmeans3[[2]]+1,locs[[1]]],Intersection[CLUSTERSkmeans3[[2]]+1,locs[[2]]],Intersection[CLUSTERSkmeans3[[2]]+1,locs[[3]]],Intersection[CLUSTERSkmeans3[[2]]+1,locs[[4]]],

Intersection[CLUSTERSkmeans3[[3]]+1,locs[[1]]],Intersection[CLUSTERSkmeans3[[3]]+1,locs[[2]]],Intersection[CLUSTERSkmeans3[[3]]+1,locs[[3]]],Intersection[CLUSTERSkmeans3[[3]]+1,locs[[4]]]
};

Length/@Select[{
Intersection[CLUSTERSkmeans3[[1]]+1,locs[[1]]],Intersection[CLUSTERSkmeans3[[1]]+1,locs[[2]]],Intersection[CLUSTERSkmeans3[[1]]+1,locs[[3]]],Intersection[CLUSTERSkmeans3[[1]]+1,locs[[4]]],

Intersection[CLUSTERSkmeans3[[2]]+1,locs[[1]]],Intersection[CLUSTERSkmeans3[[2]]+1,locs[[2]]],Intersection[CLUSTERSkmeans3[[2]]+1,locs[[3]]],Intersection[CLUSTERSkmeans3[[2]]+1,locs[[4]]],

Intersection[CLUSTERSkmeans3[[3]]+1,locs[[1]]],Intersection[CLUSTERSkmeans3[[3]]+1,locs[[2]]],Intersection[CLUSTERSkmeans3[[3]]+1,locs[[3]]],Intersection[CLUSTERSkmeans3[[3]]+1,locs[[4]]]
},Length[#]>1&]

Length/@clustAndLocs

Position[%323,0]

Position[%323,1]

Complement[Range[Length@%323],Flatten@{4,8,12}]

{reps1Clust,ranks1Clust}=FairRepBaseSubset[dataBC2,.5,3,
CLUSTERSkmeans3+1];

Length[%209[[1]]]

Export["/Users/gramos/Library/Mobile Documents/com~apple~CloudDocs/FEUP - PosDoc/Bookcrossing_data/BX_CLUSTERS_loc_notFair.csv",reps1[[#]]&/@(clustAndLocs)]

Export["/Users/gramos/Library/Mobile Documents/com~apple~CloudDocs/FEUP - PosDoc/Bookcrossing_data/BX_CLUSTERS_loc_fairClust.csv",reps1Clust[[#]]&/@(clustAndLocs)]

BoxWhiskerChart[reps1Clust[[#]]&/@(clustAndLocs),{"Outliers",{"MeanMarker",1,Directive[Thick,White]}},AspectRatio->.4,BarSpacing->.5,GridLines->Automatic,GridLinesStyle->Directive[Gray, Dotted],FrameStyle->Directive[Black,14],ChartLegends->Placed[SwatchLegend[{None,{"EU","OC","SA","NA","AS","AF","AN"}},LegendFunction->(Framed[Style[#,14],RoundingRadius->3,Background->White]&),LegendMargins->5],{0,0}],PlotTheme->"Detailed",ChartStyle->97,BarOrigin->Left,PlotRange->{{.43,1},All}]

Length@locs

locs[[1]]

NotebookDirectory[]

Export["/Users/gramos/Library/Mobile Documents/com~apple~CloudDocs/FEUP - PosDoc/Bookcrossing_data/locs.csv",locs]

{reps1Loc,ranks1Loc}=FairRepBase[dataBC2,.5,3,
locs];

Length/@locs

(Join@@locs)[[;;10]]

KendallTau[groundTruthBC,ranks1Loc]

groundTruthBC[[1]]

BXLocClust1=ToExpression["{"<>(StringDrop[StringDrop[#,-1],1])<>"}"]&/@(Import["/Users/gramos/Library/Mobile Documents/com~apple~CloudDocs/FEUP - \
PosDoc/Bookcrossing_data/locs_Clust1.csv"][[1]]);

Length/@BXLocClust1

BXLocClust2=ToExpression["{"<>(StringDrop[StringDrop[#,-1],1])<>"}"]&/@(Import["/Users/gramos/Library/Mobile Documents/com~apple~CloudDocs/FEUP - \
PosDoc/Bookcrossing_data/locs_Clust2.csv"][[1]]);

Length/@BXLocClust2

BXLocClust3=ToExpression["{"<>(StringDrop[StringDrop[#,-1],1])<>"}"]&/@(Import["/Users/gramos/Library/Mobile Documents/com~apple~CloudDocs/FEUP - \
PosDoc/Bookcrossing_data/locs_Clust3.csv"][[1]]);
Length/@BXLocClust3

BXLocClust4={Join@@(ToExpression["{"<>(StringDrop[StringDrop[#,-1],1])<>"}"]&/@(Import["/Users/gramos/Library/Mobile Documents/com~apple~CloudDocs/FEUP - \
PosDoc/Bookcrossing_data/locs_Clust4.csv"][[1]]))};
Length/@BXLocClust4

locsFirstClustSec=BXLocClust1~Join~BXLocClust2~Join~BXLocClust3~Join~BXLocClust4;

BoxWhiskerChart[reps1Loc[[#]]&/@(locsFirstClustSec),{"Outliers",{"MeanMarker",1,Directive[Thick,White]}},AspectRatio->.4,BarSpacing->.5,GridLines->Automatic,GridLinesStyle->Directive[Gray, Dotted],FrameStyle->Directive[Black,14],ChartLegends->Placed[SwatchLegend[{None,{"EU","OC","SA","NA","AS","AF","AN"}},LegendFunction->(Framed[Style[#,14],RoundingRadius->3,Background->White]&),LegendMargins->5],{0,0}],PlotTheme->"Detailed",ChartStyle->97,BarOrigin->Left,PlotRange->{{.43,1},All}]

Export["/Users/gramos/Library/Mobile Documents/com~apple~CloudDocs/FEUP - PosDoc/Bookcrossing_data/BX_CLUSTERS_clust_fairLoc.csv",reps1Loc[[#]]&/@(locsFirstClustSec)]

{reps1MultClustFirst,ranks1MultClustFirst}=FairRepBase[dataBC2,.5,3,
locsFirstClustSec];

KendallTau[groundTruthBC,ranks1MultClustFirst]

BoxWhiskerChart[reps1MultClustFirst[[#]]&/@(locsFirstClustSec),{"Outliers",{"MeanMarker",1,Directive[Thick,White]}},AspectRatio->.4,BarSpacing->.5,GridLines->Automatic,GridLinesStyle->Directive[Gray, Dotted],FrameStyle->Directive[Black,14],ChartLegends->Placed[SwatchLegend[{None,{"EU","OC","SA","NA","AS","AF","AN"}},LegendFunction->(Framed[Style[#,14],RoundingRadius->3,Background->White]&),LegendMargins->5],{0,0}],PlotTheme->"Detailed",ChartStyle->97,BarOrigin->Left,PlotRange->{{.43,1},All}]

Export["/Users/gramos/Library/Mobile Documents/com~apple~CloudDocs/FEUP - PosDoc/Bookcrossing_data/BX_CLUSTERS_clust_fairAll.csv",reps1MultClustFirst[[#]]&/@(locsFirstClustSec)]

Export["/Users/gramos/Library/Mobile Documents/com~apple~CloudDocs/FEUP - PosDoc/Bookcrossing_data/BX_CLUSTERS_clust_notFair.csv",reps1[[#]]&/@(locsFirstClustSec)]

BXLocClust1Fixed[[1,;;4]]

{{1,2},{3}}~Join~{{5}}

BoxWhiskerChart[reps1Loc[[#]]&/@(clustAndLocs),{"Outliers",{"MeanMarker",1,Directive[Thick,White]}},AspectRatio->.4,BarSpacing->.5,GridLines->Automatic,GridLinesStyle->Directive[Gray, Dotted],FrameStyle->Directive[Black,14],ChartLegends->Placed[SwatchLegend[{None,{"EU","OC","SA","NA","AS","AF","AN"}},LegendFunction->(Framed[Style[#,14],RoundingRadius->3,Background->White]&),LegendMargins->5],{0,0}],PlotTheme->"Detailed",ChartStyle->97,BarOrigin->Left,PlotRange->{{.43,1},All}]

Export["/Users/gramos/Library/Mobile Documents/com~apple~CloudDocs/FEUP - PosDoc/Bookcrossing_data/BX_CLUSTERS_loc_fairLoc.csv",reps1Loc[[#]]&/@(clustAndLocs)]

{reps1Mult,ranks1Mult}=FairRepBase[dataBC2,.5,3,
clustAndLocs];

KendallTau[groundTruthBC,ranks1Mult]

Length@reps1Mult

BoxWhiskerChart[reps1Mult[[#]]&/@(clustAndLocs),{"Outliers",{"MeanMarker",1,Directive[Thick,White]}},AspectRatio->.4,BarSpacing->.5,GridLines->Automatic,GridLinesStyle->Directive[Gray, Dotted],FrameStyle->Directive[Black,14],ChartLegends->Placed[SwatchLegend[{None,{"EU","OC","SA","NA","AS","AF","AN"}},LegendFunction->(Framed[Style[#,14],RoundingRadius->3,Background->White]&),LegendMargins->5],{0,0}],PlotTheme->"Detailed",ChartStyle->97,BarOrigin->Left,PlotRange->{{.43,1},All}]

784*10

Length[Join@@clustAndLocs]

Length@clustAndLocs

Length/@clustAndLocs

reps1Mult[[;;20]]

Export["/Users/gramos/Library/Mobile Documents/com~apple~CloudDocs/FEUP - PosDoc/Bookcrossing_data/BX_CLUSTERS_loc_fairAll.csv",reps1Mult[[#]]&/@(clustAndLocs)]

BoxWhiskerChart[reps1Mult[[#]]&/@(Map[Function[y,Select[(First/@y),#≤53408&]],DiffLocs[[2;;-2]]]),{"Outliers",{"MeanMarker",1,Directive[Thick,White]}},AspectRatio->.4,BarSpacing->.5,GridLines->Automatic,GridLinesStyle->Directive[Gray, Dotted],FrameStyle->Directive[Black,14],ChartLegends->Placed[SwatchLegend[{None,{"EU","OC","SA","NA","AS","AF","AN"}},LegendFunction->(Framed[Style[#,14],RoundingRadius->3,Background->White]&),LegendMargins->5],{0,0}],PlotTheme->"Detailed",ChartStyle->97,BarOrigin->Left,PlotRange->{{.43,1},All}]

Export["/Users/gramos/Library/Mobile Documents/com~apple~CloudDocs/FEUP - PosDoc/Bookcrossing_data/plot6.txt",reps1Mult[[#]]&/@(Map[Function[y,Select[(First/@y),#≤53408&]],DiffLocs[[2;;-2]]])]