0

I am researching with Lenskit for Java, I wanna load file with CSV file. I using TextEntitySource to load source but I got error.

import java.io.File;
import java.io.IOException;

import org.lenskit.data.dao.file.TextEntitySource;

public class MainCTF {
    public static void main(String[] args) throws IOException {
        TextEntitySource entitySource = new TextEntitySource();
        File file = new File("D:\\newdocres\\dataset\\item_feature_matrix.csv");
        entitySource.setFile(file.toPath());
    }
}
Exception in thread "main" java.lang.NoSuchMethodError: 'com.google.common.io.ByteSource org.grouplens.lenskit.util.io.LKFileUtils.byteSource(java.io.File, org.grouplens.lenskit.util.io.CompressionMode)'
    at org.lenskit.data.dao.file.TextEntitySource.setFile(TextEntitySource.java:107)
    at main.MainCTF.main(MainCTF.java:17)

So How to can load a file CSV or using JDBC in Lenskit for java

  • 3
    The evidence suggests that you have *inconsistent* dependencies on your runtime classpath. Check that your dependency versions are consistent. – Stephen C Mar 04 '23 at 03:10

1 Answers1

0

LensKit maintainer here.

I am not sure what precisely is happening with this error. It doesn't look like one of the usual failure modes, but @Stephen-C's suggestion that it is a dependency mismatch sounds likely. The dependencies should all match if you're getting them from Maven Central with either Maven or Gradle, but it's worth checking a full dependency list for your project to make sure you have the right versions.

LensKit for Java has not been maintained since 2018, and was last known to work on Java 8. In Java 9, Oracle broke Java's backwards compatibility in ways that affected LensKit, and I was not able to find a solution before shifting development and maintenance effort to LensKit for Python. If you really need to use the Java version, and the dependencies are correct, try with Java 8 (so long as the application isn't network-facing).

Michael Ekstrand
  • 28,379
  • 9
  • 61
  • 93
  • Thanks for helping me. By the way, what classes will/have to be replaced by SparseVector related classes and Lenskit for java also be support in the future not? Thanks alot. – Drake Nguyen Mar 06 '23 at 08:55
  • I am researching recommendation systems supporting job requirements websites so Should I consider using Lenskit? (My project is a graduation project) – Drake Nguyen Mar 06 '23 at 09:11
  • @DrakeNguyen LensKit for Java is no longer supported. If there's a critical bug affecting a production deployment, will try to fix that, but there is no ongoing maintenance or testing. I would definitely recommend considering LensKit (although I'm obviously a bit biased), but the Python version is the one with ongoing support. `SparseVector` is still in use in the last version of LensKit for Java. – Michael Ekstrand Mar 06 '23 at 16:48