Skip to Content.
Sympa Menu

illinois-ml-nlp-users - Re: [Illinois-ml-nlp-users] LBJ2 SparseAveragedPerceptron learning

illinois-ml-nlp-users AT lists.cs.illinois.edu

Subject: Support for users of CCG software closed 7-27-20

List archive

Re: [Illinois-ml-nlp-users] LBJ2 SparseAveragedPerceptron learning


Chronological Thread 
  • From: Nicholas Rizzolo <rizzolo AT gmail.com>
  • To: Jiaping Zheng <jzheng AT cs.umass.edu>
  • Cc: illinois-ml-nlp-users AT cs.uiuc.edu
  • Subject: Re: [Illinois-ml-nlp-users] LBJ2 SparseAveragedPerceptron learning
  • Date: Thu, 12 Apr 2012 22:37:02 -0700
  • List-archive: <http://lists.cs.uiuc.edu/pipermail/illinois-ml-nlp-users>
  • List-id: Support for users of CCG software <illinois-ml-nlp-users.cs.uiuc.edu>

Hi Jiaping,

It's actually best not to instantiate the learning algorithm
implementations directly. Instead, use the LBJ language to generate
an implementation for your classifier first, and then call methods in
the generated implementation. For an introduction to the language, go
here:

http://cogcomp.cs.illinois.edu/page/tutorial.201008

It's then very easy to set up an untrained classifier by simply
omitting the 'from' clause in the LBJ source file. Now, refer to the
LBJ runtime reference here:

http://cogcomp.cs.illinois.edu/page/LBJ-runtime-reference

It will show you how to load and save classifiers to whatever files
you want. Please take a look and let me know if you have any
questions.

- Nick


On Thu, Apr 12, 2012 at 10:10 AM, Jiaping Zheng
<jzheng AT cs.umass.edu>
wrote:
> Thanks Nick,
>
> I had a problem reading back an object.  Here is my code snippet
>
> SparseAveragedPerceptron p = new SparseAveragedPerceptron(learningRate,
> threshold, thickness);
> p.initialize(dataSize, featureSize)
>
> for (int i = 1; i <= rounds; i++) {
>    for (each data instance)
>        p.learn(featureIndex, featureValue, labelIndex, lablelValue);
>    p.doneWithRound();
> }
> p.doneLearning();
>
> p.write(new ExceptionlessOutputStream(new ObjectOutputStream(new
> FileOutputStream("file")));
> p.read(new ExceptionlessInputStream(new ObjectInputStream(new
> FileInputStream("file")));
>
> Here is the error I got:
> Error in UTF formatting: malformed input around byte 14
> java.lang.Exception
>       at
> LBJ2.util.ExceptionlessInputStream.readUTF(ExceptionlessInputStream.java:500)
>       at
> LBJ2.util.ExceptionlessInputStream.readString(ExceptionlessInputStream.java:403)
>       at LBJ2.classify.Feature.readFeature(Feature.java:552)
>       at LBJ2.util.FVector.read(FVector.java:282)
>       at LBJ2.learn.Learner.readLabelLexicon(Learner.java:1302)
>       at LBJ2.learn.Learner.read(Learner.java:1280)
>       at LBJ2.learn.LinearThresholdUnit.read(LinearThresholdUnit.java:693)
>       at
> LBJ2.learn.SparseAveragedPerceptron.read(SparseAveragedPerceptron.java:378)
>
>
> What is the recommended way of saving and reading?
>
> --
> Jiaping





Archive powered by MHonArc 2.6.16.

Top of Page