zenogantner / MyMediaLite

recommender system library for the CLR (.NET)
http://mymedialite.net
502 stars 189 forks source link

type load exceptions in item recommendation #428

Closed jkleint closed 11 years ago

jkleint commented 11 years ago

I'm new to MyMediaLite and may be doing something wrong, but I get crashes trying to do very simple things with item_recommendation out of the box.

For a training file like this:

1 2
1 3
5 6
7 8

And a command like this:

MyMediaLite-3.09/bin/item_recommendation --training-file=small.txt --recommender=BPRMF --cross-validation=5

I get a crash:

loading_time 0.03
memory 0
training data: 3 users, 4 items, 4 events, sparsity 66.66667
BPRMF num_factors=10 bias_reg=0 reg_u=0.0025 reg_i=0.0025 reg_j=0.00025 num_iter=30 learn_rate=0.05 uniform_user_sampling=True with_replacement=False update_j=True 
===> ERROR: A type load exception has occurred.  at MathNet.Numerics.Distributions.Normal..ctor (Double mean, Double stddev) [0x00000] in <filename unknown>:0 
  at MyMediaLite.DataType.MatrixExtensions.InitNormal (MyMediaLite.DataType.Matrix`1 matrix, Double mean, Double stddev) [0x00000] in /home/zgantner/src/MyMediaLite/src/MyMediaLite/DataType/MatrixExtensions.cs:64 
  at MyMediaLite.ItemRecommendation.MF.InitModel () [0x00032] in /home/zgantner/src/MyMediaLite/src/MyMediaLite/ItemRecommendation/MF.cs:64 
  at MyMediaLite.ItemRecommendation.BPRMF.InitModel () [0x00000] in /home/zgantner/src/MyMediaLite/src/MyMediaLite/ItemRecommendation/BPRMF.cs:134 
  at MyMediaLite.ItemRecommendation.BPRMF.Train () [0x00000] in /home/zgantner/src/MyMediaLite/src/MyMediaLite/ItemRecommendation/BPRMF.cs:142 
  at MyMediaLite.Eval.ItemsCrossValidation+<DoCrossValidation>c__AnonStoreyC.<>m__17 (Int32 fold) [0x00028] in /home/zgantner/src/MyMediaLite/src/MyMediaLite/Eval/ItemsCrossValidation.cs:84 

  *****************************************************************************************************
  *** An uncaught exception occured. Please send a bug report to zeno.gantner+mymedialite@gmail.com,***
  *** or report the problem in our issue tracker: https://github.com/zenogantner/MyMediaLite/issues ***
  *** MyMediaLite 3.09                                                                              ***
  *****************************************************************************************************
One or more errors occured  at System.Threading.Tasks.Parallel.HandleExceptions (IEnumerable`1 tasks, System.Threading.Tasks.ExternalInfos infos) [0x00000] in <filename unknown>:0 
  at System.Threading.Tasks.Parallel.For[Object] (Int32 fromInclusive, Int32 toExclusive, System.Threading.Tasks.ParallelOptions parallelOptions, System.Func`1 localInit, System.Func`4 body, System.Action`1 localFinally) [0x00000] in <filename unknown>:0 
  at System.Threading.Tasks.Parallel.For (Int32 fromInclusive, Int32 toExclusive, System.Threading.Tasks.ParallelOptions parallelOptions, System.Action`2 body) [0x00000] in <filename unknown>:0 
  at System.Threading.Tasks.Parallel.For (Int32 fromInclusive, Int32 toExclusive, System.Threading.Tasks.ParallelOptions parallelOptions, System.Action`1 body) [0x00000] in <filename unknown>:0 
  at System.Threading.Tasks.Parallel.For (Int32 fromInclusive, Int32 toExclusive, System.Action`1 body) [0x00000] in <filename unknown>:0 
  at MyMediaLite.Eval.ItemsCrossValidation.DoCrossValidation (IRecommender recommender, ISplit`1 split, IList`1 test_users, IList`1 candidate_items, CandidateItems candidate_item_mode, Boolean compute_fit, Boolean show_results) [0x00060] in /home/zgantner/src/MyMediaLite/src/MyMediaLite/Eval/ItemsCrossValidation.cs:78 
  at MyMediaLite.Eval.ItemsCrossValidation.DoCrossValidation (IRecommender recommender, UInt32 num_folds, IList`1 test_users, IList`1 candidate_items, CandidateItems candidate_item_mode, Boolean compute_fit, Boolean show_results) [0x00028] in /home/zgantner/src/MyMediaLite/src/MyMediaLite/Eval/ItemsCrossValidation.cs:52 
  at ItemRecommendation.Run (System.String[] args) [0x0041c] in /home/zgantner/src/MyMediaLite/src/Programs/ItemRecommendation/ItemRecommendation.cs:285 
  at ItemRecommendation.Main (System.String[] args) [0x00006] in /home/zgantner/src/MyMediaLite/src/Programs/ItemRecommendation/ItemRecommendation.cs:157 
Terminate on unhandled exception.

I consistently get this crash with BPRMF, BPRSLIM, LeastSquareSLIM, MultiCoreBPRMF, SoftMarginRankingMF, WeightedBPRMF, WRMF.

I do not get this crash with ItemKNN, MostPopular, Random, UserKNN.

I'm running on Linux Mint 15:

Mono JIT compiler version 2.10.8.1 (Debian 2.10.8.1-5ubuntu1)
Copyright (C) 2002-2011 Novell, Inc, Xamarin, Inc and Contributors. www.mono-project.com
    TLS:           __thread
    SIGSEGV:       altstack
    Notifications: epoll
    Architecture:  amd64
    Disabled:      none
    Misc:          softdebug 
    LLVM:          supported, not enabled.
    GC:            Included Boehm (with typed GC and Parallel Mark)
zenogantner commented 11 years ago

Could be that you have Math.NET Numerics installed on your system, either from your distribution, or installed by hand?

jkleint commented 11 years ago

It's certainly possible. I compiled Mono 3.1.2 from source and it runs with no problems. Does Math.NET Numerics override built-in libraries?

zenogantner commented 11 years ago

I am not sure which library version is loaded, it may depend on a lot of factors, but I am not an expert in this. Can you check whether several versions are present by running "locate MathNet.Numerics.dll"?

jkleint commented 11 years ago

I'm not an expert either. locate only finds the versions that come with MyMediaLite:

MyMediaLite-3.09/examples/csharp/MathNet.Numerics.dll
MyMediaLite-3.09/lib/mymedialite/MathNet.Numerics.dll

And dpkg doesn't know about any other versions either. It might be a bug with the old mono included with my distro.

zenogantner commented 11 years ago

Okay. Can you make sure you are in control which Mono that is installed you are actually using? Otherwise it is quite hard to track down the problem.

jkleint commented 11 years ago

I was definitely using the Mono 2.10.8.1 (details above) that comes with Linux Mint 15 for the crash. Definitely using 3.1.2 I compiled myself fixes it.

zenogantner commented 11 years ago

Maybe there is a problem with Mono 2.10.8.1 on Mint 15, but I would be surprised -- I have the same version here on Ubuntu, and it works just fine, strange.

Good to know it works with Mono 3.1.2 for you.

With that workaround, I would not invest more time looking at the issue (I have not a lot of time to work on MyMediaLite, so I like concentrating on new features and bugs that concern all/most users).