## org.apache.mahout.clustering.dirichlet.models
Class L1Model

    java.lang.Object
      org.apache.mahout.clustering.dirichlet.models.L1Model

All Implemented Interfaces:
  org.apache.hadoop.io.Writable, Cluster, Model<VectorWritable>

    public class L1Model

extends java.lang.Object
implements Cluster

Field Summary

Fields inherited from interface org.apache.mahout.clustering.Cluster
`CLUSTERED_POINTS_DIR, CLUSTERS_DIR, INITIAL_CLUSTERS_DIR`

Constructor Summary
`L1Model()`
`L1Model(int id, Vector v)`

Method Summary
`java.lang.String` `asFormatString(java.lang.String[] bindings)` Produce a custom, human-friendly, printable representation of the Cluster.
`java.lang.String` `asJsonString()` Produce a textual representation of the Cluster using Json format.
`void` `computeParameters()` Compute a new set of posterior parameters based upon the Observations that have been observed since my creation
`int` `count()` Return the number of observations that have been observed by this model
`Vector` `getCenter()` Get the "center" of the Cluster as a Vector
`int` `getId()` Get the id of the Cluster
`int` `getNumPoints()` Get an integer denoting the number of points observed by this cluster
`Vector` `getRadius()` Get the "radius" of the Cluster as a Vector.
`void` `observe(VectorWritable x)` Observe the given observation, retaining information about it
`double` `pdf(VectorWritable x)` Return the probability that the observation is described by this model
`void` `readFields(java.io.DataInput in)`
`L1Model` `sampleFromPosterior()`
`java.lang.String` `toString()`
`void` `write(java.io.DataOutput out)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### L1Model

    public L1Model()

### L1Model

    public L1Model(int id,
                   Vector v)

Method Detail

### computeParameters

    public void computeParameters()

  Description copied from interface: `Model`
  Compute a new set of posterior parameters based upon the Observations that have been observed since my creation

  Specified by:
    `computeParameters` in interface `Model<VectorWritable>`

### count

    public int count()

  Description copied from interface: `Model`
  Return the number of observations that have been observed by this model

  Specified by:
    `count` in interface `Model<VectorWritable>`
  Returns:
    an int

### observe

    public void observe(VectorWritable x)

  Description copied from interface: `Model`
  Observe the given observation, retaining information about it

  Specified by:
    `observe` in interface `Model<VectorWritable>`
  Parameters:
    `x` - an Observation from the posterior

### pdf

    public double pdf(VectorWritable x)

  Description copied from interface: `Model`
  Return the probability that the observation is described by this model

  Specified by:
    `pdf` in interface `Model<VectorWritable>`
  Parameters:
    `x` - an Observation from the posterior
  Returns:
    the probability that x is in the receiver

### readFields

    public void readFields(java.io.DataInput in)
                    throws java.io.IOException

  Specified by:
    `readFields` in interface `org.apache.hadoop.io.Writable`
  Throws:
    `java.io.IOException`

### write

    public void write(java.io.DataOutput out)
               throws java.io.IOException

  Specified by:
    `write` in interface `org.apache.hadoop.io.Writable`
  Throws:
    `java.io.IOException`

### sampleFromPosterior

    public L1Model sampleFromPosterior()

  Specified by:
    `sampleFromPosterior` in interface `Model<VectorWritable>`
  Returns:
    a sample of my posterior model

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `java.lang.Object`

### asFormatString

    public java.lang.String asFormatString(java.lang.String[] bindings)

  Description copied from interface: `Cluster`
  Produce a custom, human-friendly, printable representation of the Cluster.

  Specified by:
    `asFormatString` in interface `Cluster`
  Parameters:
    `bindings` - an optional String[] containing labels used to format the primary Vector/s of this implementation.
  Returns:
    a String

### asJsonString

    public java.lang.String asJsonString()

  Description copied from interface: `Cluster`
  Produce a textual representation of the Cluster using Json format. (Label bindings are transient and not part of the Json representation)

  Specified by:
    `asJsonString` in interface `Cluster`
  Returns:
    a Json String

### getCenter

    public Vector getCenter()

  Description copied from interface: `Cluster`
  Get the "center" of the Cluster as a Vector

  Specified by:
    `getCenter` in interface `Cluster`
  Returns:
    a Vector

### getId

    public int getId()

  Description copied from interface: `Cluster`
  Get the id of the Cluster

  Specified by:
    `getId` in interface `Cluster`
  Returns:
    a unique integer

### getNumPoints

    public int getNumPoints()

  Description copied from interface: `Cluster`
  Get an integer denoting the number of points observed by this cluster

  Specified by:
    `getNumPoints` in interface `Cluster`
  Returns:
    an integer

### getRadius

    public Vector getRadius()

  Description copied from interface: `Cluster`
  Get the "radius" of the Cluster as a Vector. Usually the radius is the standard deviation expressed as a Vector of size equal to the center. Some clusters may return zero values if not appropriate.

  Specified by:
    `getRadius` in interface `Cluster`
  Returns:
    aVector

Copyright © 2008-2010 The Apache Software Foundation. All Rights Reserved.