If initialDistributionStripe is a MapWritable<IntWritable,DoubleWritable>,
then aren't initialDistributionStripe.entrySet()'s entries
Map.Element<IntWritable,DoubleWritable>?

In this case, entry.getKey().get() is an int, and entry.getValue().get() is
a double.

  -jake

On Jun 16, 2011 2:37 PM, "Dhruv Kumar" <[email protected]> wrote:

For the MapReduce variant of BaumWelchTraining, I'm trying to reuse the
functionality of the HmmAlgorithms and HmmModel classes for low level
processing such as calculating alpha and beta factors.
The HmmModel class constructor accepts Matrix and Vector types.

My reducer output types are MapWritable. Since the alpha and beta factors
need to be recalculated in each iteration, and because they use the HmmModel
class, I'm looking for a way to deserialize Writable objects and cast them
into java's Integer and Double types so that I can assign them to a Vector
and Matrix type. Something similar to the following, which is erroneous at
this point.

// initialDistributionStripe is a MapWritable<IntWritable, DoubleWritable>
// initialProbabilities is a vector

for (Map.Entry<Writable, Writable> entry :
initialDistributionStripe.entrySet()) {
     initialProbabilities.set(entry.getKey(), entry.getValue());
   }


Is the only way to deserialize Writables is by hacking into the format and
using bit level techniques or is there some other solution available?

Reply via email to