zenogantner / MyMediaLite

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

Rating prediction could support writing to stdout #433

Open jkleint opened 11 years ago

jkleint commented 11 years ago

When trying to use the rating prediction tool with --prediction-file=/dev/stdout, it crashes trying to seek, similar to #430.

zenogantner commented 11 years ago

Works for me, did you use the latest version from GitHub?

jkleint commented 11 years ago

I'm probably making some newbie mistake, but I can't seem to compile it from source:

Build FAILED.

Warnings:

/home/jk/software/MyMediaLite/src/MyMediaLite-nogui.sln:  warning : Failed to find project 309290e3-e52b-4e67-9f6e-2a67b5d54320
/home/jk/software/MyMediaLite/src/MyMediaLite-nogui.sln:  warning : Failed to find project 4d4feab8-30ae-449a-bed5-98074fc9bbf2
/home/jk/software/MyMediaLite/src/MyMediaLite-nogui.sln:  warning : Failed to find project c475abe7-84b0-4427-987b-b06e8548676f
/home/jk/software/MyMediaLite/src/MyMediaLite-nogui.sln:  warning : Failed to find project db4c4882-dd1d-42fb-8f23-5c269c36a0b3
/home/jk/software/MyMediaLite/src/MyMediaLite-nogui.sln:  warning : Failed to find project dfdfc30f-6bde-4d8b-bf84-ce958dd662c3

/home/jk/software/MyMediaLite/src/MyMediaLite-nogui.sln (default targets) ->
(Build target) ->
/home/jk/software/MyMediaLite/src/MyMediaLite/MyMediaLite.csproj (default targets) ->
/mnt/ebs-vol1b/mono-3.1.2/lib/mono/4.0/Microsoft.Common.targets (ResolveAssemblyReferences target) ->

        /mnt/ebs-vol1b/mono-3.1.2/lib/mono/4.0/Microsoft.Common.targets:  warning : Reference 'zlib.net, Version=1.0.3.0, Culture=neutral, PublicKeyToken=47d7877cb3620160' not resolved

/home/jk/software/MyMediaLite/src/MyMediaLite-nogui.sln (default targets) ->
(Build target) ->
/home/jk/software/MyMediaLite/src/Tests/Tests.csproj (default targets) ->
/mnt/ebs-vol1b/mono-3.1.2/lib/mono/4.0/Microsoft.Common.targets (ResolveAssemblyReferences target) ->

        /mnt/ebs-vol1b/mono-3.1.2/lib/mono/4.0/Microsoft.Common.targets:  warning : Reference 'zlib.net, Version=1.0.3.0, Culture=neutral, PublicKeyToken=47d7877cb3620160' not resolved

/home/jk/software/MyMediaLite/src/MyMediaLite-nogui.sln (default targets) ->
(Build target) ->
/home/jk/software/MyMediaLite/src/Programs/CommandLineProgram/CommandLineProgram.csproj (default targets) ->
/mnt/ebs-vol1b/mono-3.1.2/lib/mono/4.0/Microsoft.Common.targets (ResolveAssemblyReferences target) ->

        /mnt/ebs-vol1b/mono-3.1.2/lib/mono/4.0/Microsoft.Common.targets:  warning : Reference 'zlib.net, Version=1.0.3.0, Culture=neutral, PublicKeyToken=47d7877cb3620160' not resolved

Errors:

/home/jk/software/MyMediaLite/src/MyMediaLite-nogui.sln (default targets) ->
(Build target) ->
/home/jk/software/MyMediaLite/src/Tests/Tests.csproj (default targets) ->
/mnt/ebs-vol1b/mono-3.1.2/lib/mono/4.0/Microsoft.CSharp.targets (CoreCompile target) ->

        Correlation/BinaryCosineTest.cs(85,22): error CS0012: The type `System.Collections.Generic.ISet`1<T>' is defined in an assembly that is not referenced. Consider adding a reference to assembly `System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'

         8 Warning(s)
         1 Error(s)

Time Elapsed 00:00:01.0946800
make: *** [all] Error 1

Any suggestions? Thanks!

zenogantner commented 11 years ago

Hi, I think it would be better to open a separate ticket for this: #434

jkleint commented 11 years ago

Works with system mono 2.10.8.1; crashes (running) with mono 3.1.2:

An exception was thrown by the type initializer for Mono.Unix.Native.Syscall  at MyMediaLite.IO.FileSystem.CreateUnixAppendStreamWriter (System.String filename) [0x00006] in /home/jk/software/MyMediaLite/src/MyMediaLite/IO/FileSystem.cs:53 
  at MyMediaLite.IO.FileSystem.CreateStreamWriter (System.String filename) [0x0001a] in /home/jk/software/MyMediaLite/src/MyMediaLite/IO/FileSystem.cs:70 
  at MyMediaLite.RatingPrediction.Extensions.WritePredictions (IRecommender recommender, IRatings ratings, System.String filename, IMapping user_mapping, IMapping item_mapping, System.String line_format, System.String header) [0x00000] in /home/jk/software/MyMediaLite/src/MyMediaLite/RatingPrediction/Extensions.cs:92 
  at RatingPrediction.<Run>m__E () [0x00000] in /home/jk/software/MyMediaLite/src/Programs/RatingPrediction/RatingPrediction.cs:327 
  at MyMediaLite.Wrap.MeasureTime (System.Action t) [0x00006] in /home/jk/software/MyMediaLite/src/MyMediaLite/Wrap.cs:31 
  at RatingPrediction.Run (System.String[] args) [0x0075b] in /home/jk/software/MyMediaLite/src/Programs/RatingPrediction/RatingPrediction.cs:326 
  at RatingPrediction.Main (System.String[] args) [0x00006] in /home/jk/software/MyMediaLite/src/Programs/RatingPrediction/RatingPrediction.cs:141 
Terminate on unhandled exception.

Maybe we could special-case the filename - to mean standard output instead? Also, I noticed now that the training status info gets written to stdout as well, mixed up with the predictions output (and there's no --quiet option or anything). Maybe that status info could go to stderr?

zenogantner commented 11 years ago

Interesting -- never saw such an error message before. Could it be that this is also

So far, the library was not developed for streaming to STDOUT, that is why certain reporting stuff goes there, and lower-level debug/progress output goes to STDERR.

The library also lacks a proper logging framework, which then could be used to avoid noise on STDOUT.

Using - for STDOUT will not fix the too-much-noise problem, btw.

But we can try to explicitly write to STDOUT instead. Will try this out on the weekend (no time before that, too much work ;-)