开发者

what causes the error like " the constructor is undefined"

开发者 https://www.devze.com 2023-03-19 19:03 出处:网络
I am trying to compile the example code of \"Mahout in Action\" in Eclipse. There is a java file titled as \"LimitedMemoryDiffStorage.java\". Which essentially just define a class

I am trying to compile the example code of "Mahout in Action" in Eclipse. There is a java file titled as "LimitedMemoryDiffStorage.java". Which essentially just define a class

class LimitedMemoryDiffStorage {

Recommender buildRecommender(DataModel model) throws TasteException {
  DiffStorage diffStorage = new MemoryDiffStorage(
    model, Weighting.WEIGHTED, true, 10000000L);
  return new SlopeOneRecommender(
    model, Weighting.WEIGHTED, Weighting.WEIGHTED, diffStorage);
 }

}

But the eclipse compiler states

The constructor MemoryDiffStorage(DataModel, Weighting, boolean, long) is undefi开发者_运维技巧ned

I think it is defined in the mahout-core library and has been included in the build path, why it still causes this kind of error?


Maybe you are using a version of the library that is different from the one described in the book. Many times it happens that some of the methods, constructors or even classes are changed or even removed. The best way to check this would be to check the sources of mahout-core library, or at least the byte code. To see the methods including constructor in Eclipse, open the specific MemoryDiffStorage class by pressing CTRL + SHIFT + T and typing in the class name. Then in the outline view you should see the actual constructors with their signatures.


According to the documentation at https://builds.apache.org/job/Mahout-Quality/javadoc/org/apache/mahout/cf/taste/impl/recommender/slopeone/MemoryDiffStorage.html the MemoryDiffStorage constructor requires three parameters but you are passing it four.

0

精彩评论

暂无评论...
验证码 换一张
取 消