Ahh, you are using the SuffixSensitiveGISModelReader, but is the file
you read the same
as you write, below you write to foo and read from foo.txt.
You can also try to use the BinaryGISModelWriter/Reader, that should
work if its a problem related
to the readers, usually the plain text ones are not used much anymore.
Jörn
On 03/18/2013 03:55 PM, Jörn Kottmann wrote:
Which model reader do you use to read the model back in?
As far as I see in the code you need to use the PlainTextGISModelReader,
either directly or again via the SuffixSensitiveGISModelReader.
HTH,
Jörn
On 03/18/2013 11:12 AM, Joachim De Beule wrote:
> Looks like you are getting an IOException while writing the model,
> is that correct?
Not while writing the model, but when calling close on the writer (after
the call to persist returned nil). This means that the writer somehow is
already closed during the call to persist I guess? Perhaps there is some
interaction with Clojure's lazyness? (just guessing)
Hello,
we need to have a look at the exception to be able to identify the
problem,
please post it here.
Jörn
Dear Jörn,
Below you can see a complete trace of my clojure interaction leading
up to
the exception. s you can see, an exception is already thrown when I
try to
close the SuffixSensitiveGISModelWriter. The model is however written to
file. When I try to read that file, the "NumberFormatException" is
thrown.
The input string "my_30" is one of the features on which the
classifier
was trained.
user> (set! GIS/SMOOTHING_OBSERVATION 3)
3
user> (def event-stream (cases->event-stream (concat (load-data :zone09)
(load-data :mobistar "nl")) #(N-grams 2 %) :sentiment))
event-stream
user> (def model (GIS/trainModel event-stream 100 3 true true))
model
user> (def writer (SuffixSensitiveGISModelWriter. model (
clojure.java.io/file "/tmp/foo")))
writer
user> (.persist writer)
nil
user> (.close writer)
IOException Stream closed java.io.BufferedWriter.ensureOpen
(BufferedWriter.java:98)
user> (def reader (SuffixSensitiveGISModelReader.
(clojure.java.io/file"/tmp/foo.txt")))
reader
user> (def read-model (.getModel reader))
NumberFormatException For input string: "my_30"
sun.misc.FloatingDecimal.readJavaFormatString
(FloatingDecimal.java:1222)
user>