commit 75f8bb5701bc469cdb23db6b9f24012d9a1dca82 Author: Czesiu Date: Fri Mar 31 18:05:48 2023 +0200 test diff --git a/mahoutBasicReccomender/.idea/.gitignore b/mahoutBasicReccomender/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/mahoutBasicReccomender/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/mahoutBasicReccomender/.idea/compiler.xml b/mahoutBasicReccomender/.idea/compiler.xml new file mode 100644 index 0000000..c7068f8 --- /dev/null +++ b/mahoutBasicReccomender/.idea/compiler.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/mahoutBasicReccomender/.idea/encodings.xml b/mahoutBasicReccomender/.idea/encodings.xml new file mode 100644 index 0000000..aa00ffa --- /dev/null +++ b/mahoutBasicReccomender/.idea/encodings.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/mahoutBasicReccomender/.idea/jarRepositories.xml b/mahoutBasicReccomender/.idea/jarRepositories.xml new file mode 100644 index 0000000..712ab9d --- /dev/null +++ b/mahoutBasicReccomender/.idea/jarRepositories.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/mahoutBasicReccomender/.idea/misc.xml b/mahoutBasicReccomender/.idea/misc.xml new file mode 100644 index 0000000..9902dc5 --- /dev/null +++ b/mahoutBasicReccomender/.idea/misc.xml @@ -0,0 +1,14 @@ + + + + + + + + + + \ No newline at end of file diff --git a/mahoutBasicReccomender/csv/customer.csv b/mahoutBasicReccomender/csv/customer.csv new file mode 100644 index 0000000..a7297d4 --- /dev/null +++ b/mahoutBasicReccomender/csv/customer.csv @@ -0,0 +1,15 @@ +1,1,3 +1,2,1 +1,4,5 +1,5,3 +1,9,3 +1,10,3 +2,1,2 +2,3,2 +2,4,1 +2,7,5 +3,1,5 +3,2,1 +3,3,1 +3,6,1 +3,8,1 diff --git a/mahoutBasicReccomender/pom.xml b/mahoutBasicReccomender/pom.xml new file mode 100644 index 0000000..63d45b5 --- /dev/null +++ b/mahoutBasicReccomender/pom.xml @@ -0,0 +1,30 @@ + + + 4.0.0 + + org.example + mahoutBasicReccomender + 1.0-SNAPSHOT + + + 19 + 19 + UTF-8 + + + + + org.slf4j + slf4j-api + 2.0.5 + + + org.apache.mahout + mahout-core + 0.9 + + + + \ No newline at end of file diff --git a/mahoutBasicReccomender/src/main/java/org/example/Main.java b/mahoutBasicReccomender/src/main/java/org/example/Main.java new file mode 100644 index 0000000..18b2ca9 --- /dev/null +++ b/mahoutBasicReccomender/src/main/java/org/example/Main.java @@ -0,0 +1,22 @@ +package org.example; + +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.similarity.LogLikelihoodSimilarity; +import org.apache.mahout.cf.taste.model.DataModel; + +import java.io.File; +import java.io.IOException; + +public class Main { + public static String dataFile = "csv/customer.csv"; + public static void main(String[] args) throws IOException, TasteException { + + DataModel model = new FileDataModel(new File(dataFile)); + + LogLikelihoodSimilarity similarity = new LogLikelihoodSimilarity(model); + + System.out.println("Similarity between user1 and user3 is " + similarity.userSimilarity(1, 3)); + + } +} \ No newline at end of file diff --git a/mahoutBasicReccomender/target/classes/org/example/Main.class b/mahoutBasicReccomender/target/classes/org/example/Main.class new file mode 100644 index 0000000..a75fe93 Binary files /dev/null and b/mahoutBasicReccomender/target/classes/org/example/Main.class differ