## org.apache.mahout.classifier.discriminative
Class LinearModel

    java.lang.Object
      org.apache.mahout.classifier.discriminative.LinearModel

    public class LinearModel

extends java.lang.Object

Classifies a data point using a hyperplane.

Constructor Summary
`LinearModel(Vector hyperplane)` Init a linear model with zero displacement and a threshold of 0.5.
`LinearModel(Vector hyperplane, double displacement, double threshold)` Init a linear model with a hyperplane, distance and displacement.

Method Summary
`void` `addDelta(Vector delta)` Update the hyperplane by adding delta.
`boolean` `classify(Vector dataPoint)` Classify a point to either belong to the class modeled by this linear model or not.
`void` `shiftBias(double factor)` Shift the bias of the model.
`void` `timesDelta(int index, double delta)` Multiply the weight at index by delta.
`java.lang.String` `toString()`

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

Constructor Detail

### LinearModel

    public LinearModel(Vector hyperplane,
                       double displacement,
                       double threshold)

  Init a linear model with a hyperplane, distance and displacement.

### LinearModel

    public LinearModel(Vector hyperplane)

  Init a linear model with zero displacement and a threshold of 0.5.

Method Detail

### classify

    public boolean classify(Vector dataPoint)

  Classify a point to either belong to the class modeled by this linear model or not.

  Parameters:
    `dataPoint` - the data point to classify.
  Returns:
    returns true if data point should be classified as belonging to this model.

### addDelta

    public void addDelta(Vector delta)

  Update the hyperplane by adding delta.

  Parameters:
    `delta` - the delta to add to the hyperplane vector.

### toString

    public java.lang.String toString()

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

### shiftBias

    public void shiftBias(double factor)

  Shift the bias of the model.

  Parameters:
    `factor` - factor to multiply the bias by.

### timesDelta

    public void timesDelta(int index,
                           double delta)

  Multiply the weight at index by delta.

  Parameters:
    `index` - the index of the element to update.
    `delta` - the delta to multiply the element with.

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