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 0000000..d5a36a6
Binary files /dev/null and b/src/.DS_Store differ
diff --git a/src/data/.DS_Store b/src/data/.DS_Store
new file mode 100644
index 0000000..42d3662
Binary files /dev/null and b/src/data/.DS_Store differ
diff --git a/src/data/movies_rapid_test.txt b/src/data/movies_rapid_test.txt
new file mode 100644
index 0000000..55cdd17
--- /dev/null
+++ b/src/data/movies_rapid_test.txt
@@ -0,0 +1,35 @@
+product/productId: B003AI2VGA
+review/userId: A141HP4LYPWMSR
+review/profileName: Brian E. Erland "Rainbow Sphinx"
+review/helpfulness: 7/7
+review/score: 3.0
+review/time: 1182729600
+review/summary: "There Is So Much Darkness Now ~ Come For The Miracle"
+review/text: Synopsis: On the daily trek from Juarez, Mexico to El Paso, Texas an ever increasing number of female workers are found raped and murdered in the surrounding desert. Investigative reporter Karina Danes (Minnie Driver) arrives from Los Angeles to pursue the story and angers both the local police and the factory owners who employee the undocumented aliens with her pointed questions and relentless quest for the truth.
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 0000000..373220a
Binary files /dev/null and b/src/data/movies_rapid_test.txt.gz differ
diff --git a/src/main/.DS_Store b/src/main/.DS_Store
new file mode 100644
index 0000000..64303a2
Binary files /dev/null and b/src/main/.DS_Store differ
diff --git a/src/main/java/.DS_Store b/src/main/java/.DS_Store
new file mode 100644
index 0000000..f6f0d44
Binary files /dev/null and b/src/main/java/.DS_Store differ
diff --git a/src/main/java/nearsoft/.DS_Store b/src/main/java/nearsoft/.DS_Store
new file mode 100644
index 0000000..c727c52
Binary files /dev/null and b/src/main/java/nearsoft/.DS_Store differ
diff --git a/src/main/java/nearsoft/academy/.DS_Store b/src/main/java/nearsoft/academy/.DS_Store
new file mode 100644
index 0000000..5ef0c78
Binary files /dev/null and b/src/main/java/nearsoft/academy/.DS_Store differ
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 0000000..2551d95
Binary files /dev/null and b/src/main/java/nearsoft/academy/bigdata/.DS_Store differ
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 0000000..dbfa0db
Binary files /dev/null and b/src/test/.DS_Store differ
diff --git a/src/test/java/.DS_Store b/src/test/java/.DS_Store
new file mode 100644
index 0000000..8168fbc
Binary files /dev/null and b/src/test/java/.DS_Store differ
diff --git a/src/test/java/nearsoft/.DS_Store b/src/test/java/nearsoft/.DS_Store
new file mode 100644
index 0000000..5574f0a
Binary files /dev/null and b/src/test/java/nearsoft/.DS_Store differ
diff --git a/src/test/java/nearsoft/academy/.DS_Store b/src/test/java/nearsoft/academy/.DS_Store
new file mode 100644
index 0000000..3c0db62
Binary files /dev/null and b/src/test/java/nearsoft/academy/.DS_Store differ
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 0000000..012cc0a
Binary files /dev/null and b/src/test/java/nearsoft/academy/bigdata/.DS_Store differ
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 0000000..6af3c7e
Binary files /dev/null and b/src/test/java/nearsoft/academy/bigdata/recommendation/.DS_Store differ
diff --git a/src/test/java/nearsoft/academy/bigdata/recommendation/MovieRecommenderTest.java b/src/test/java/nearsoft/academy/bigdata/recommendation/MovieRecommenderTest.java
index 0d0b1fe..4e17850 100644
--- a/src/test/java/nearsoft/academy/bigdata/recommendation/MovieRecommenderTest.java
+++ b/src/test/java/nearsoft/academy/bigdata/recommendation/MovieRecommenderTest.java
@@ -15,7 +15,7 @@ public class MovieRecommenderTest {
public void testDataInfo() throws IOException, TasteException {
//download movies.txt.gz from
// http://snap.stanford.edu/data/web-Movies.html
- MovieRecommender recommender = new MovieRecommender("/path/to/movies.txt.gz");
+ MovieRecommender recommender = new MovieRecommender("src/data/movies.txt.gz");
assertEquals(7911684, recommender.getTotalReviews());
assertEquals(253059, recommender.getTotalProducts());
assertEquals(889176, recommender.getTotalUsers());
@@ -27,4 +27,4 @@ public void testDataInfo() throws IOException, TasteException {
}
-}
+}
\ No newline at end of file
diff --git a/target/classes/nearsoft/academy/bigdata/recommendation/MovieRecommender.class b/target/classes/nearsoft/academy/bigdata/recommendation/MovieRecommender.class
new file mode 100644
index 0000000..f16deba
Binary files /dev/null and b/target/classes/nearsoft/academy/bigdata/recommendation/MovieRecommender.class differ
diff --git a/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst
new file mode 100644
index 0000000..81ec89a
--- /dev/null
+++ b/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst
@@ -0,0 +1 @@
+nearsoft/academy/bigdata/recommendation/MovieRecommender.class
diff --git a/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst
new file mode 100644
index 0000000..9c7d870
--- /dev/null
+++ b/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst
@@ -0,0 +1 @@
+/Users/bryan.medina/Desktop/movieRecommenderBryan/academy-exercises/src/main/java/nearsoft/academy/bigdata/recommendation/MovieRecommender.java
diff --git a/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst b/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst
new file mode 100644
index 0000000..1a2de6b
--- /dev/null
+++ b/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst
@@ -0,0 +1 @@
+nearsoft/academy/bigdata/recommendation/MovieRecommenderTest.class
diff --git a/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst b/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst
new file mode 100644
index 0000000..897c3e9
--- /dev/null
+++ b/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst
@@ -0,0 +1 @@
+/Users/bryan.medina/Desktop/movieRecommenderBryan/academy-exercises/src/test/java/nearsoft/academy/bigdata/recommendation/MovieRecommenderTest.java
diff --git a/target/surefire-reports/TEST-nearsoft.academy.bigdata.recommendation.MovieRecommenderTest.xml b/target/surefire-reports/TEST-nearsoft.academy.bigdata.recommendation.MovieRecommenderTest.xml
new file mode 100644
index 0000000..2a3a4fd
--- /dev/null
+++ b/target/surefire-reports/TEST-nearsoft.academy.bigdata.recommendation.MovieRecommenderTest.xml
@@ -0,0 +1,69 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ 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 0000000..995d1ba
Binary files /dev/null and b/target/test-classes/nearsoft/academy/bigdata/recommendation/MovieRecommenderTest.class differ