From 66354f865ebe5ec02768ef1c4f171aceb3165cfb Mon Sep 17 00:00:00 2001 From: bryanMed Date: Mon, 26 Apr 2021 20:14:57 -0500 Subject: [PATCH 1/2] Movie Recommender solved (Bryan) --- big-data.iml | 57 +++++++++ movies.csv | 4 + pom.xml | 2 + src/.DS_Store | Bin 0 -> 6148 bytes src/data/.DS_Store | Bin 0 -> 6148 bytes src/data/movies_rapid_test.txt | 35 ++++++ src/data/movies_rapid_test.txt.gz | Bin 0 -> 4212 bytes src/main/.DS_Store | Bin 0 -> 6148 bytes src/main/java/.DS_Store | Bin 0 -> 6148 bytes src/main/java/nearsoft/.DS_Store | Bin 0 -> 6148 bytes src/main/java/nearsoft/academy/.DS_Store | Bin 0 -> 6148 bytes .../java/nearsoft/academy/bigdata/.DS_Store | Bin 0 -> 6148 bytes .../recommendation/MovieRecommender.java | 116 ++++++++++++++++++ src/test/.DS_Store | Bin 0 -> 6148 bytes src/test/java/.DS_Store | Bin 0 -> 6148 bytes src/test/java/nearsoft/.DS_Store | Bin 0 -> 6148 bytes src/test/java/nearsoft/academy/.DS_Store | Bin 0 -> 6148 bytes .../java/nearsoft/academy/bigdata/.DS_Store | Bin 0 -> 6148 bytes .../academy/bigdata/recommendation/.DS_Store | Bin 0 -> 6148 bytes .../recommendation/MovieRecommenderTest.java | 13 +- .../recommendation/MovieRecommender.class | Bin 0 -> 5741 bytes .../compile/default-compile/createdFiles.lst | 1 + .../compile/default-compile/inputFiles.lst | 1 + .../default-testCompile/createdFiles.lst | 1 + .../default-testCompile/inputFiles.lst | 1 + ...ta.recommendation.MovieRecommenderTest.xml | 69 +++++++++++ ...ta.recommendation.MovieRecommenderTest.txt | 4 + .../recommendation/MovieRecommenderTest.class | Bin 0 -> 1030 bytes 28 files changed, 301 insertions(+), 3 deletions(-) create mode 100644 big-data.iml create mode 100644 movies.csv create mode 100644 src/.DS_Store create mode 100644 src/data/.DS_Store create mode 100644 src/data/movies_rapid_test.txt create mode 100644 src/data/movies_rapid_test.txt.gz create mode 100644 src/main/.DS_Store create mode 100644 src/main/java/.DS_Store create mode 100644 src/main/java/nearsoft/.DS_Store create mode 100644 src/main/java/nearsoft/academy/.DS_Store create mode 100644 src/main/java/nearsoft/academy/bigdata/.DS_Store create mode 100644 src/main/java/nearsoft/academy/bigdata/recommendation/MovieRecommender.java create mode 100644 src/test/.DS_Store create mode 100644 src/test/java/.DS_Store create mode 100644 src/test/java/nearsoft/.DS_Store create mode 100644 src/test/java/nearsoft/academy/.DS_Store create mode 100644 src/test/java/nearsoft/academy/bigdata/.DS_Store create mode 100644 src/test/java/nearsoft/academy/bigdata/recommendation/.DS_Store create mode 100644 target/classes/nearsoft/academy/bigdata/recommendation/MovieRecommender.class create mode 100644 target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst create mode 100644 target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst create mode 100644 target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst create mode 100644 target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst create mode 100644 target/surefire-reports/TEST-nearsoft.academy.bigdata.recommendation.MovieRecommenderTest.xml create mode 100644 target/surefire-reports/nearsoft.academy.bigdata.recommendation.MovieRecommenderTest.txt create mode 100644 target/test-classes/nearsoft/academy/bigdata/recommendation/MovieRecommenderTest.class diff --git a/big-data.iml b/big-data.iml new file mode 100644 index 0000000..c251545 --- /dev/null +++ b/big-data.iml @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/movies.csv b/movies.csv new file mode 100644 index 0000000..d909ec3 --- /dev/null +++ b/movies.csv @@ -0,0 +1,4 @@ +0,0,3.0 +1,0,3.0 +2,0,5.0 +3,0,3.0 diff --git a/pom.xml b/pom.xml index 8169ff7..4f587b2 100644 --- a/pom.xml +++ b/pom.xml @@ -12,6 +12,8 @@ UTF-8 + 1.8 + 1.8 diff --git a/src/.DS_Store b/src/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..d5a36a6f6f2950f5e6cb24a01fe1074be7fe7e3e GIT binary patch literal 6148 zcmeHK!EVz)5S?ueY=SCsK%yLweBl%K%x>lRcwAEWG7va zHJ;f(6tu=(q7K7Eg*c`Ktyl&u1FOvd?Og{V2q1@`ynn?5v_1NvMJF-$3n$r-_xX7^ zOyVqWG`@+ob?3&-TT)hKb))*;@2iQQ2l+Vb1f#b!dKu*Xko&KcO6L6_d>!{D`?b5z zRGJ5I+8gQMIO?IxyEkzfsYyqT(TYXm zdp4`cdk>qtdk2H#lj+CVr_ZJi0$)^G?l4}$DR$-wCPz*GPz{Ec#$Rm%)$MZf^2NpX z-7ojQJ}uj$KiY@={58Td~bp!b7|O6V~b z2KB208+`>pbZ}Y=_VuSfqDvEq9%Eq;XHbL*MKqy;uNZ=F4#I?^-DCg4pa}<|pN#A9 zlLg;U1YbOatKC6(25oB@und$LSU1BOo&V2q4==g@mxJucGGH0_rx*}U*Y9>PB|cjh ylB2WMMLj?zA-}?)4#9?xW8I;ncoS6%+Fa@&dW?lZoI$Z40-6TfSO)$o13v+}FcDq= literal 0 HcmV?d00001 diff --git a/src/data/.DS_Store b/src/data/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..42d3662f01886d75eadb690552dfb595551040dd GIT binary patch literal 6148 zcmeHK!Ab)$5Ph@uP!*vUp~rlI;MvPk+C$I%fNHIX(6XYnh^PH*Z~A5?mR-AoCqbPD zlb200liioFlK_y>)AAe`0O-?{i$fM2(0;W&6uG5G7K?F%N1S1UXIkJlD4=V1gf%K` zafinGO;^?RVpT2JubbnQHhnX&2Ap*HaP4pL^2u|}(UXSfY0Gnt2VCKvb1yOHuF*Hx zeC(liq(b-GtPyGW{YYJJCR@h4XvE`VAQT7%LV
Her story goes nationwide when a young girl named Mariela (Ana Claudia Talancon) survives a vicious attack and walks out of the desert crediting the Blessed Virgin for her rescue. Her story is further enhanced when the "Wounds of Christ" (stigmata) appear in her palms. She also claims to have received a message of hope for the Virgin Mary and soon a fanatical movement forms around her to fight against the evil that holds such a stranglehold on the area.

Critique: Possessing a lifelong fascination with such esoteric matters as Catholic mysticism, miracles and the mysterious appearance of the stigmata, I was immediately attracted to the '05 DVD release `Virgin of Juarez'. The film offers a rather unique storyline blending current socio-political concerns, the constant flow of Mexican migrant workers back and forth across the U.S./Mexican border and the traditional Catholic beliefs of the Hispanic population. I must say I was quite surprised by the unexpected route taken by the plot and the means and methods by which the heavenly message unfolds.

`Virgin of Juarez' is not a film that you would care to watch over and over again, but it was interesting enough to merit at least one viewing. Minnie Driver delivers a solid performance and Ana Claudia Talancon is perfect as the fragile and innocent visionary Mariela. Also starring Esai Morales and Angus Macfadyen (Braveheart). + +product/productId: B003AI2VGA +review/userId: A328S9RN3U5M68 +review/profileName: Grady Harp +review/helpfulness: 4/4 +review/score: 3.0 +review/time: 1181952000 +review/summary: Worthwhile and Important Story Hampered by Poor Script and Production +review/text: THE VIRGIN OF JUAREZ is based on true events surrounding the crime problems of Juarez, Mexico reflected in the gringo exploitation of businesses in neighboring El Paso, Texas. The story contains many important facts that desperately need to be brought into the light, but the impact of the film falters because of the choices made by the writer and director.

Karina Danes (Minnie Driver) is a journalist for a Los Angeles newspaper who has flown to Juarez to investigate the multiple (in the hundreds) killings of young women. The targets for these murders seem to be young women working in the US sponsored sweatshops in Juarez who are picked up at night after work, raped, beaten and killed. Danes is convinced the Juarez police force is doing nothing and takes on the mission of exposing the tragedies, in part due to her own past issues of being too idle with similar crimes in the US. She meets Father Herrera (Esai Morales) and a community activist Patrick (Angus MacFadyen) and together they probe the police files and follow the most recent murder, discovering along the way a survivor named Mariela (Ana Claudia Talancón), a frightened young girl whose memory of her rape and beating is erased by her apparent vision of the Virgin Mary. A father of one of the victims, Isidro (Jorge Cervera, Jr.) nurtures Mariela and helps her to escape the hospital, placing her in a 'church' where she becomes a 'saint' to the people of Juarez who long for the crimes to end. Mariela appears to the public with the stigmata of bleeding hands and offers hope to the victims' families. Danes works hard to discover evidence that will expose the perpetrators, taking a sheet of photos of 'most wanted men' from the police office of Detective Lauro (Jacob Vargas), and works with the police and Father Herrera to resolve the tragic chain of events that continue in Juarez. Fearing for Mariela's life, they transport her to Los Angeles where mysterious events end the story.

The squeaky, mawkish script was written by Michael Fallon and directed by Kevin James Dobson. Had their vision been more directed toward defining the line between realism and fanaticism, the story would possibly have been better related. There are some good performances by Driver, Talancón, Morales, and Vargas but the minor roles vary in quality. Reporting atrocities such as the one this film addresses is a valid and valuable contribution of contemporary cinema. It is sad when script and the production dull the impact. Grady Harp, June 07 + +product/productId: B003AI2VGA +review/userId: A1I7QGUDP043DG +review/profileName: Chrissy K. McVay "Writer" +review/helpfulness: 8/10 +review/score: 5.0 +review/time: 1164844800 +review/summary: This movie needed to be made. +review/text: The scenes in this film can be very disquieting due to their graphic re-enactment of real events, but this story needs to be told. I will say the violence was injected into the movie with as much taste as manageable when dealing with rape scenes, etc. Inspired by true events, women are being murdered in Juarez after they leave the factory where they work. A fearful community is suddenly given some hope when one of the young victims not only lives, but experiences 'stigmata' after seeing the Virgin Mary. I was shocked to learn that murders in Juarez are still happening and many are unsolved. I believe this director brought a very important story to the surface. Though it's never pleasant to think about young women being murdered, this movie depicts a harsh reality of the high cost of exploited-cheap labor.

Chrissy K. McVay - Author + +product/productId: B003AI2VGA +review/userId: A1M5405JH9THP9 +review/profileName: golgotha.gov +review/helpfulness: 1/1 +review/score: 3.0 +review/time: 1197158400 +review/summary: distantly based on a real tragedy +review/text: THE VIRGIN OF JUAREZ (2006)
directed by Kevin James Dobson
approx. 1 hour 25 minutes

The town of Juarez, Chihuahua in Mexico is just across the border from El Paso, Texas. It is home to several factories owned by American companies who employ Mexicans at very low wages. Since the early 1990s, Juarez has also been the murder site of hundreds of women. There is a lot of debate as to whether the deaths are the work of a drug gang or a serial killer. It has also been suggested that due to the local police department's failure to solve the crimes, new rapists and thugs have moved to the area knowing that they will never be caught. The situation is an overwhelming tragedy and this movie uses the story as a backdrop.

We start off seeing how unsafe women feel as they walk and work in Juarez. Then we meet the hard-headed American journalist played by Minnie Driver. She aggressively questions the local police and befriends a Catholic priest. Within the first twenty minutes or so, we see the terrifying reality of the situation in Juarez.

At this point, the story jumps from something that might have happened to something that is only found in this movie. A woman named Mariela survives an brutal attack but is in critical condition in a small hospital. While the priest is speaking to her, she lets out a howl... and her hands begin bleeding*. This "stigmata" is meant to show that she has been blessed by the Virgin Mary. Our reporter protagonist clashes with various authorities on what should be done. Meanwhile Mariela goes underground and attracts a devoted following, eventually landing her own radio show (!) and living under the protection of gang members, whom she refers to as "modern warriors". The only thing missing is "Jesús Malverde".

Now I understand that we don't know everything about the Juarez murders and that a screenwriter has to "fill in the blanks" when crafting an exciting dramatization. However if you are going to deviate so far from the true story, then don't preface your movie as being "based on the ongoing unsolved murders in Cuidad Juarez". There is plenty of interesting and legitimate information in the REAL stories of Juarez and there is no need to fabricate. This movie may "raise the issue" of the Juarez women, but it isn't really about them at all!

If you are interested in learning more about the killings in Juarez, there are a few documentaries. A recent one from Las Perlas Del Mar Films is simply titled 'JUAREZ' and is a good introduction. Zulma Aguiar's 'JUAREZ MOTHERS FIGHT FEMICIDE' (focuses on the families) is also easy to find. There is another one which I haven't seen titled 'BORDER ECHOES'.

*- note to Hollywood:
the nails that crucified Jesus were through his wrists, not his palms! diff --git a/src/data/movies_rapid_test.txt.gz b/src/data/movies_rapid_test.txt.gz new file mode 100644 index 0000000000000000000000000000000000000000..373220a3c6c06f2d2bf7462965478787a67b216b GIT binary patch literal 4212 zcmV-)5R300iwFo9?}lIi18r}1X=QU?a$#_3WM6b;b963rcys`jTHA8lNRoZ;uc+3; zP@bS^$(Gxf-Pj1VBwO;d+FHq%*m>F_SR|?ipwLx-XwJia`<|0o07$}_GEk0fP%Kd6{bZzG_@bZ_TS` zuZHKT2ock~m>msII?s8Jk6%B3_596GN8|I<*R_qCx8~qe>7p}N$=n5V-4~@fxAC4c zn_sc;|CzH;JM%6?gMsGSM_W{G+(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v~4mE%`VZ~Nzux91nP=Hl$~s9%yAx1%Z?Y_*3aY=F>Z%^<>!Eu}2qBxjRzrxY5JEu-3uO#{5Sl0bA_eCu0wt|+ zkm&O$(Gi|$L6-lY0ouEgxDuhb72&7-+riwAHzTHyaa`2z-ne~!iEfg(o7L;DvQR8d zP0uJ*QI)yMNpPwAK^A7cZZqs0)6-#?T}ICSsdX~8!{}Gs?w?i{c6FMCaoX;f#ZRvhf_tI9^tP|J?rOK*&TCEKR8(Z~dud%i{T=oWAE3nsA*N4NhT3l*uADms^ z-47myk56_lBtBFl^A1Pw3}am2ZO};*onF8G6T#2GcW-RxT8(YPCzYO0yDr2 zd@loZK6p?<-(hai932=;3ji#^Z3MRY^#^+70QwGdi||0CO$FLi=~@iwItOXfG4H$h z+@ehv(!3e#xHn7Jp-9(wNY8`|>09KH8DIuJGC;i_q)PYy{@?q56T|~Ezzj?#1G2Oi z>@`uFyIa3hNq4OWJ%f@^TyAlk0>fOzh^4Ez1~me|M+VS$m|KJg!ao9r1|FD!f6Bl+ D!aiE| literal 0 HcmV?d00001 diff --git a/src/main/java/.DS_Store b/src/main/java/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..f6f0d44a9b5cd0d81205f6702b82cf978ae6ab53 GIT binary patch literal 6148 zcmeHK%}T>S5T317w-vDmL65n3E7Gd?a}Z*!hu(yU9#m{%s|I3Ln$)7TlGo5T@(Fw# zo!Q-rQoRL+cKk*L=-o+(p$$HC;M4mHA{AhaK8zjI#l2$6OA~%tr zoSK%hD2ubjQ}0Ukywp#-NzLyZ)78G8UIo@ZP%8Sc{opWc_s&Z5yDCooFm88raoB2O z%E?g}w^XmDx^XMf^LQp8WkD9sN{jve##W{5RM$2KWv9Qjg7(_#`e0Cy3rp4QM)Uga zzW*?Ie9}t+fgi4xIg3MhMq`ASTdxyGD!#CFU;TE9;5R?Own}$Pfm5k`2t-!`nvE+E8#A!rBD!&H2 z5l_&^X}{UsM6{vDRt3#Sv)_1r*51$7u15$VJCnFAL|q7>poFC=hDU_rq$^T#o-$CH zIr?HCu6wDzjM9~CcKnYF(7Rg~p}2&`;=%jV5hCZ+soKlhr{GFYgFMV9<4!pGKv(a={3>$xsn+Sz4x_WAKRvI%daJWM zOtSvS6en>XDIeb_S*)iWJ;~y+nJ2ITrK+lWUT@51hexfZ*WQ0UZ+f$%UD*432lIJV zZEd%Ydl!T2ud|!^w_CFiA@R`~*>t#oI~c!_@+BB$sm?wlvZz{QGcp6r05kC97;qbz z+IVtL&JWBCFav*^0oortD53ALuxPdp45kGDR^T=Qn|>Op#&hU9EG!}dk+u|QOQmZu zq%DWvb9uhQ!lEq~(lsB_-C4R0MVh-~e$S)}>09KH8DIu}Wq^7=NS)6AlRx+WCW!}T zfEjq649H41=ytF+cebvqlFnKWdI2S&yu#wL1co_^kxNH$18M|*j|`yiu&@XZgntAK L4LmRd|CE8B`C(rF literal 0 HcmV?d00001 diff --git a/src/main/java/nearsoft/academy/.DS_Store b/src/main/java/nearsoft/academy/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..5ef0c78256e2373772c4862cc39f06164418fe74 GIT binary patch literal 6148 zcmeHK%}T>S5T317w-vDmL65n3E7Gd?a}Z+HLvKPv4=S3NQUft7ZEDe4$!q8v`2;?W z&g^bQtsWICGcfy2=4X@r5_U5HAZnek3Qz(7iAtC&;P8b|oODQX)-#4E^c+5<;MZey z9>hc0?D&fe(7T(203v8Y2=CsX3NS*S#TM$~ix#wovV(5>Du{LVQ*aeW?X*&P7P+zf z_{5}?MOmCKo_H6k>!p6$Y1jPL5nb*1=|y1eeWl_z+Yb(+M)$NdyRDMckCH}97e`?O zQ;rX#Bvjp+>Lg)X&*PbZlm%HhEzS3OYa5laQ(al_m!00m651=vtNngK&Mj0o>t~lY zx4pam{exZz2>fWZ%vc=2BO0Gbx%OH~tdb^1233P>MrME+UNT9vuEqjD(S3sP|r|FC@(YkR)U5;iZPdt;(1gp=y%9KbS-8E(SyQ20-6RMn1Nqq F;1vc@UeW*n literal 0 HcmV?d00001 diff --git a/src/main/java/nearsoft/academy/bigdata/.DS_Store b/src/main/java/nearsoft/academy/bigdata/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..2551d955113db4615e62ca845eb4a397f8491c72 GIT binary patch literal 6148 zcmeHK!A{#i5SpC0FgCt-!`nvE+DB;xsC0D*p!j z5nsUP&^Nmqsw%YHstCoZWO@cVyB>T`8w^m?1keiH$ z=RWs3InT3U*>2yc+ERUaWmW5@Za!^(iO$S8D&ulA?8bvn{PZp^&k}FHHzvQcT!4-^u680?`6uBwBB5pRuELTt% z5C(*S1!2G+Px{G%e2;vFFdz&p4g-8X1W?A%W985u9cXL`0Ib7p1vdXCa!%ke^jJAW z4@9|Cpi5Q0#856B{=mnD9xI0~os=&=lz+4G6^gQN$M}H_ClxxBRu~Wl{$zk_KS+!3 z|HHr6|29Y(VL%vooD8V?L3Gf?-2B}-H%q>21Lz5qh2tuRcPTLJRg74^iZ`KF;1AdU Vh8`=2@Id58z|tU%Fz{a)_ywy5X6XO` literal 0 HcmV?d00001 diff --git a/src/main/java/nearsoft/academy/bigdata/recommendation/MovieRecommender.java b/src/main/java/nearsoft/academy/bigdata/recommendation/MovieRecommender.java new file mode 100644 index 0000000..8f1abec --- /dev/null +++ b/src/main/java/nearsoft/academy/bigdata/recommendation/MovieRecommender.java @@ -0,0 +1,116 @@ +package nearsoft.academy.bigdata.recommendation; + +import org.apache.mahout.cf.taste.common.TasteException; +import org.apache.mahout.cf.taste.impl.model.file.FileDataModel; +import org.apache.mahout.cf.taste.impl.neighborhood.ThresholdUserNeighborhood; +import org.apache.mahout.cf.taste.impl.recommender.GenericUserBasedRecommender; +import org.apache.mahout.cf.taste.impl.similarity.PearsonCorrelationSimilarity; +import org.apache.mahout.cf.taste.model.DataModel; +import org.apache.mahout.cf.taste.neighborhood.UserNeighborhood; +import org.apache.mahout.cf.taste.recommender.RecommendedItem; +import org.apache.mahout.cf.taste.recommender.UserBasedRecommender; +import org.apache.mahout.cf.taste.similarity.UserSimilarity; + +import java.io.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.zip.GZIPInputStream; + +public class MovieRecommender { + int totalReviews = 0; + int totalProducts = 0; + int totalUsers = 0; + + HashMap products = new HashMap(); + HashMap users = new HashMap(); + + public MovieRecommender(String path) throws IOException { + GZIPInputStream inputFile = new GZIPInputStream(new FileInputStream(path)); + Reader decoder = new InputStreamReader(inputFile); + BufferedReader bReader = new BufferedReader(decoder); + String currentLine; + + File result = new File("movies.csv"); + FileWriter fWriter = new FileWriter(result); + BufferedWriter bWriter = new BufferedWriter(fWriter); + + String productList = ""; + String userList = ""; + String scoreList = ""; + + int totalProducts = 0; + int totalUsers = 0; + int totalReviews = 0; + + + while ((currentLine = bReader.readLine()) != null){ + if (currentLine.startsWith("product/productId:")){ + totalReviews++; + String productId = currentLine.split(" ")[1]; + + if (!products.containsKey(productId)){ + products.put(productId, totalProducts++); + } + productList = products.get(productId).toString(); + + } else if (currentLine.startsWith("review/userId:")) { + String userID = currentLine.split(" ")[1]; + + if (!users.containsKey(userID)){ + users.put(userID,totalUsers++); + } + userList = users.get(userID).toString(); + + } else if (currentLine.startsWith("review/score:")){ + scoreList = currentLine.split(" ")[1]; + String finalList = String.format("%s,%s,%s\n", userList, productList, scoreList); + bWriter.write(finalList); + } + } + + bReader.close(); + bWriter.close(); + + this.totalReviews = totalReviews; + this.totalProducts = products.size(); + this.totalUsers = users.size(); + } + + public int getTotalReviews() { + return this.totalReviews; + } + + public int getTotalProducts() { + return this.totalProducts; + } + + public int getTotalUsers() { + return this.totalUsers; + } + + + public List getRecommendationsForUser(String userId) throws IOException, TasteException { + + List results = new ArrayList(); + + int user = users.get(userId); + + DataModel model = new FileDataModel(new File("movies.csv")); + UserSimilarity similarity = new PearsonCorrelationSimilarity(model); + UserNeighborhood neighborhood = new ThresholdUserNeighborhood(0.1, similarity, model); + UserBasedRecommender recommender = new GenericUserBasedRecommender(model, neighborhood, similarity); + + List recommendations = recommender.recommend(user, 3); + + for (RecommendedItem recommendation : recommendations) { + for (String key : this.products.keySet()) { + if (this.products.get(key)==recommendation.getItemID()) { + results.add(key); + } + } + + } + return results; + } +} \ No newline at end of file diff --git a/src/test/.DS_Store b/src/test/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..dbfa0db86a290bd65125fe130ad7756142e01352 GIT binary patch literal 6148 zcmeHK!A`ZzJ*a_Jh}6`sfkLB*>2K&C`2~KC z&g?EEir$PdWG0z?)7hDA=54dvVT|#{s9R<%&lnS+h^Z_L-w4j5E=bCF(tsS-Xa(}h z3#13nxFE^@X8`vu!)}<%#?1Y)e+MwP`>sS4GLQ4(;hov%SMM(Hhf%5Y##8Cc%IcaB zIg#7QT{?XkJCPfWh7EUcj!(yK)c1^iB4seQUGLQI#qIpop$sF}4|@ZZ?00(*a&hK| zT^TpzDC`c^I*y(YA}g}(d|@)F)aym7R;o^m)}+2yDq7V_Z92`0?Va*|t8;t*FnOFl zJ?p*T@S!T%G&qA7Fy;l0ok1AL@EUxx_*onwF+dCu153bwIoibf64XK^5Cg=(?=pbr zg9VCc8%#8+qXP!j0sv;ftpsfK>knw51JE{@Xao-k*QtOym75lWo6dpjbeOkIe4zFrl)1h$FcyLRFGj407kr*HbJ~M#5A4neW|D&J#e-%UnF+dC~Cj&gwbeavQ z&D^aERpMQ1fp$PqFfP$JPXR++#Sn{EaRF2b_$@R5ZG(wM@PN>dfTDp0V&G31_yFv& BTKE6} literal 0 HcmV?d00001 diff --git a/src/test/java/.DS_Store b/src/test/java/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..8168fbca6ae4f68ca3f7e0c5b89de1e1d11e6566 GIT binary patch literal 6148 zcmeHK%}T>S5T317w-vDmL63X!R;1b@^dQ8l2X8_|4=S42s)3l5Cbej-`em2=JVK)N+qSb4!08{`#q7oKLID8=#CmoZ5^GqNLGe-&<&LP{0 z_1Rc9JANYr^zI}i(18HD@ZtT1u?{gtAI1ji@~aWFzQ_;z>9xy$4zJ@V&1$t5QJ5%B zPEAW$mgU*1sE~E<(+v+PdG;y`-I*d3+m?vLs6fu3%sCvv6B=X0-1yxj*2x9NMs=fnMrME+ULoMmh8x<`yx6B5Wz5EfucC5Vjos%H??u zbBnedglj&8yR&c|iZFM_`ISir;aTL78DIuJGeEr`N`=nM1G-<>eONOVBV!G3L@yyohQ9{fZ1k&tYy6Jt+JmU})fh8Te5K F-T-BAU{L@7 literal 0 HcmV?d00001 diff --git a/src/test/java/nearsoft/.DS_Store b/src/test/java/nearsoft/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..5574f0a7aeb90ef4a8bd1908d5e53f5f8bc0e1df GIT binary patch literal 6148 zcmeHK%}&BV5Z*=91!Lr3BFDXWBL>Bga4@N;2W}=cdQbx`CEBEP4HO9?rmvxIOa z(1Db*lQ0g{u&xGi(AV?0CLlykXgS5T317w-vDmL63X!R;2zQ^dQ7q58i}`9#k|jMFTM_ZEDe4$!q8v`2;?W z&g^bQtsWJX8JPVh^Rvl*3A-5p5RGoM1W*A0iAq=~;qZx2oODDA&NGH6%p3t^5Ns#< zG)zXa+3_10pm#S3A;fS75xjYSI>ZQl78|IG&qmN1$qsv+%P=w7kKtt!cd}aTNfgG4 z;}eromSuUmeB__&o}UF-x6=sP2XwU)Wapu?cePGl?I7HXTfO7T?50k$AWmCtQyfPv zOgY?-(@6Ikx|>EFGmmcrQkG=txH8}Guhi>RwN_glR8_yeT&t?pm9@d3B(?q9d7#UU#vl*EIW`G&^a}2nROiul|C+7!d z2AF~GW`Onwg-Yl-%q^O&0|(OrAQsVW1a10hq#EVWbC_Gi2#T|F^#G|4kAP%m6d+KN%3k zrr&Jf+T7VXvPwE@73v8p3FYM$UrW$1M=|EoQ9O@o1pSH(M9*Pv5j`mUBVcIYff@Kw G23`O#tX|Xr literal 0 HcmV?d00001 diff --git a/src/test/java/nearsoft/academy/bigdata/.DS_Store b/src/test/java/nearsoft/academy/bigdata/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..012cc0a1d1b813774bef22871f1e0eb4222f074e GIT binary patch literal 6148 zcmeHK&2AGh5FV!ioK%z?km%7DZV^g^Ls2y&jlbFPjCcLnvUi9`4W`)+QHO{$l(Er5^B3WM))i?4&jwJr zF-A0^A(fO-vJx$hb!33oZi~iPwKK912?M-|^F{q`F9h{o2~%+D_6p z`EYj9dHlkbRg#y(u}jXgAwu52&CATr26kFz6E{xmJG5@;)=6i3KHuy2yXK&`zv!BI zf4A2)`+EnAMN2<JgyTtXuF3bvX9xqr!1^%2=YxSVMgeP&?&v_{N&sLJZYQw$H<5Epz$jqt z5j_y)Q-MBJg%U&gbofn(ivrdjeLAU7e5mkd6)F_v-j4B&3nvwMlvWrJ2L5D#Yd=Vb z@Bf!K*Z(d^8eu>fxSI^9=23h!z}&*!x-v_?YYp@i%EEEA$Lkar?kYwsU&Y%{C-56K WfKkBOBRmlK5pXm}BMkgk27Uq6DQ4>c literal 0 HcmV?d00001 diff --git a/src/test/java/nearsoft/academy/bigdata/recommendation/.DS_Store b/src/test/java/nearsoft/academy/bigdata/recommendation/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..6af3c7e5841cbe43c3aa98f43835e267c6618c93 GIT binary patch literal 6148 zcmeHK%TB{E5FA4f6{6VO~0SP!z;7nhjK$})cis&srz&FF}+AV^Dka|F< z+Ld<4S?~HWmhBjT>&%D8Knp;VD%jYg`9`E(bWL`GXP4--jS;Re!T?iD)}qZ}3>X9d zjRD!ahq&O5eMZK;`>}r~{K_$;EpSa+qCy*w=rOW)Hl7ap<7uDSa&(+f+ixl?ZPend z>YvZcs$ljjx>#s`Bc3BMZaKO!<}Ax7Vx$~HMU8R8ZyBF>`@{vkIY%jxL(V7Hs8sWw zm@~zUk&|C$+gY^~Gk-u87A9={i1ABSJnC*L(;w4M0%jxT}zGR>GjQHB3 zj61^vdsxn?V1_?Imn$GO8S`^yZ_4du;C6$xmIXE0LI!wei!}E=nl%QD0b^jrfSeBz zRWJ!yd(@+YMxOx02Hh$w%MX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4UNaqQ+I8sDNPve*$;z(3ePa;#UBh4xS1PT_^F zrZX$m1k2QL-rBIIp-hdtT2!O%pB|;~@lwt71v6^GEhhx-!=iY7L>-L#BB8;!KN23i z2ko(@h^wGu|MU`hsLn`m0*gCa8>M%pkrU{WKIW7Qociu$l#_Q3As}RN8`TgWZ zoQ!?^esT*xncRs}@gPpadsKQM;@I2sS&??KTXz$ z6Dg)7-OMGXcDUg_TmCLJ6+%b^u$yzkmc-&5q7-<-XNiNApvwHcH(A+^*)C50Nwf!6Yvq(uII)Hz?+$t4xy-#a}yJD z7vV{d6_bIpOSsBQhSHZZY3sOC9+wfQ_1y0kypBoi + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/target/surefire-reports/nearsoft.academy.bigdata.recommendation.MovieRecommenderTest.txt b/target/surefire-reports/nearsoft.academy.bigdata.recommendation.MovieRecommenderTest.txt new file mode 100644 index 0000000..ff7dd86 --- /dev/null +++ b/target/surefire-reports/nearsoft.academy.bigdata.recommendation.MovieRecommenderTest.txt @@ -0,0 +1,4 @@ +------------------------------------------------------------------------------- +Test set: nearsoft.academy.bigdata.recommendation.MovieRecommenderTest +------------------------------------------------------------------------------- +Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.032 sec diff --git a/target/test-classes/nearsoft/academy/bigdata/recommendation/MovieRecommenderTest.class b/target/test-classes/nearsoft/academy/bigdata/recommendation/MovieRecommenderTest.class new file mode 100644 index 0000000000000000000000000000000000000000..995d1ba5c7a9e3ac0c2c750ad7de7b17e55e1a9f GIT binary patch literal 1030 zcmbVLTTc@~6#k~PEG`SJ<)ZZhR8d=y4qhIN5E7!8lvFVVNqi#H?X(Q(?$q5`MBn{E zzKGGpAK;HNp4k@g!6$Z;nRC85*YC{y{`2D(fTwuk!o!?{`7tcG$e^4f*nU~7-Enaj zi&na4m-`MLIH)j;uB%X)4Th0Qb)O;oLboMDzM(?-CJ9k3%IZTf zYYtV+u+a#mh+^F_T==3bgHODrx@}s%q4d87YDeN&c$mN>!?VjW!BCDPpQoe+mZkV05`EP^u+-GdiK%rz z+Z@Xt9%98o%>&1(heufP@E9u$>z7S!8>QB57rZCJF5hV#NuQvp6jGYkcg|^KShW<1 zzVHtv55%EP4EHP)AZKT_YZ|G>^40=bNG0GUHcVWK_=n#{% z=1JqUGum@Yr(j>x;{vUtDL8?vBzpq`6fs2_!!$XMq|PC-6b@MWiOl=r$SJaoY2=o_ z!TItXV=f6-tT4b_D_&%ng?*UQa4|#wEaq?xRV=0%X9rP-8C@)-7K|)xWf@#Y2{%%i N;U?`2w`k4a_Fs8~2uc6| literal 0 HcmV?d00001 From a639320ed32eb5d755bb69336d5be9c7aef7cb83 Mon Sep 17 00:00:00 2001 From: bryanMed Date: Thu, 29 Apr 2021 09:46:06 -0500 Subject: [PATCH 2/2] deleted unnecesary comments --- .../recommendation/MovieRecommenderTest.java | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/src/test/java/nearsoft/academy/bigdata/recommendation/MovieRecommenderTest.java b/src/test/java/nearsoft/academy/bigdata/recommendation/MovieRecommenderTest.java index ec5ffbd..4e17850 100644 --- a/src/test/java/nearsoft/academy/bigdata/recommendation/MovieRecommenderTest.java +++ b/src/test/java/nearsoft/academy/bigdata/recommendation/MovieRecommenderTest.java @@ -15,15 +15,6 @@ public class MovieRecommenderTest { public void testDataInfo() throws IOException, TasteException { //download movies.txt.gz from // http://snap.stanford.edu/data/web-Movies.html - - //dummy tests - /* - MovieRecommender recommender = new MovieRecommender("src/data/movies_rapid_test.txt.gz"); - assertEquals(4, recommender.getTotalReviews()); - assertEquals(1, recommender.getTotalProducts()); - assertEquals(4, recommender.getTotalUsers()); - */ - MovieRecommender recommender = new MovieRecommender("src/data/movies.txt.gz"); assertEquals(7911684, recommender.getTotalReviews()); assertEquals(253059, recommender.getTotalProducts()); @@ -33,5 +24,7 @@ public void testDataInfo() throws IOException, TasteException { assertThat(recommendations, hasItem("B0002O7Y8U")); assertThat(recommendations, hasItem("B00004CQTF")); assertThat(recommendations, hasItem("B000063W82")); + } -} + +} \ No newline at end of file