Uploaded image for project: 'Mahout'
  1. Mahout
  2. MAHOUT-367

IllegalArgumentException in AbstractJDBCModel when requesting mostSimilarItems for an item without preferences

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.4
    • Labels:
      None

      Description

      I'm using GenericItemBasedRecommender together with MySQLJDBCDataModel for generating recommendations for an online shop. Whenever the recommender tries to calculate the most similar items for an item without preferences (e.g. a brand new product), an IllegalArgumentException is thrown as AbstractJDBCModel tries to create a GenericItemPreferenceArray from the empty preference list.

      Sample stacktrace:

      java.lang.IllegalArgumentException: size is less than 1
      at org.apache.mahout.cf.taste.impl.model.GenericItemPreferenceArray.<init>(GenericItemPreferenceArray.java:49)
      at org.apache.mahout.cf.taste.impl.model.GenericItemPreferenceArray.<init>(GenericItemPreferenceArray.java:56)
      at org.apache.mahout.cf.taste.impl.model.jdbc.AbstractJDBCDataModel.getPreferencesForItem(AbstractJDBCDataModel.java:441)
      at org.apache.mahout.cf.taste.impl.recommender.GenericItemBasedRecommender.doMostSimilarItems(GenericItemBasedRecommender.java:169)
      at org.apache.mahout.cf.taste.impl.recommender.GenericItemBasedRecommender.mostSimilarItems(GenericItemBasedRecommender.java:128)
      at org.apache.mahout.cf.taste.impl.recommender.GenericItemBasedRecommender.mostSimilarItems(GenericItemBasedRecommender.java:121)
      at de.zalando.recommendation.recommender.cf.TasteRecommenderAdapter.mostSimilarItems(TasteRecommenderAdapter.java:38)
      at de.zalando.recommendation.recommender.taste.cache.CachingRecommender.mostSimilarItems(CachingRecommender.java:39)
      at de.zalando.recommendation.recoreco.rest.RecommendationsRestController.mostSimilarItems(RecommendationsRestController.java:53)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.doInvokeMethod(HandlerMethodInvoker.java:710)
      at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:167)
      at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:414)
      at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:402)
      at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:771)
      at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:716)
      at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:647)
      at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:552)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
      at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
      at java.lang.Thread.run(Thread.java:619)

        Attachments

          Activity

            People

            • Assignee:
              srowen Sean R. Owen
              Reporter:
              ssc Sebastian Schelter
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: