## org.apache.mahout.vectorizer.encoders
Class InteractionValueEncoder

    java.lang.Object
      org.apache.mahout.vectorizer.encoders.FeatureVectorEncoder
          org.apache.mahout.vectorizer.encoders.InteractionValueEncoder

    public class InteractionValueEncoder

extends FeatureVectorEncoder

Field Summary

Fields inherited from class org.apache.mahout.vectorizer.encoders.FeatureVectorEncoder
`CONTINUOUS_VALUE_HASH_SEED, WORD_LIKE_VALUE_HASH_SEED`

Constructor Summary
`InteractionValueEncoder(String name, FeatureVectorEncoder encoderOne, FeatureVectorEncoder encoderTwo)`

Method Summary
`void` `addInteractionToVector(byte[] originalForm1, byte[] originalForm2, double weight, Vector data)` Adds a value to a vector.
`void` `addInteractionToVector(String original1, String original2, double weight, Vector data)` Adds a value to a vector.
`void` `addToVector(byte[] originalForm, double w, Vector data)` Adds a value to a vector.
`void` `addToVector(String originalForm, double w, Vector data)` Adds a value to a vector.
`String` `asString(String originalForm)` Converts a value into a form that would help a human understand the internals of how the value is being interpreted.
`protected double` `getWeight(byte[] originalForm1, byte[] originalForm2, double w)`
`protected int` `hashForProbe(byte[] originalForm, int dataSize, String name, int probe)` Provides the unique hash for a particular probe.

Methods inherited from class org.apache.mahout.vectorizer.encoders.FeatureVectorEncoder
`addToVector, addToVector, bytesForString, getName, getProbes, getWeight, hash, hash, hash, hash, hash, hashesForProbe, isTraceEnabled, setProbes, setTraceDictionary, trace, trace`

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

Constructor Detail

### InteractionValueEncoder

    public InteractionValueEncoder(String name,
                                   FeatureVectorEncoder encoderOne,
                                   FeatureVectorEncoder encoderTwo)

Method Detail

### addToVector

    public void addToVector(String originalForm,
                            double w,
                            Vector data)

  Adds a value to a vector.

  Overrides:
    `addToVector` in class `FeatureVectorEncoder`
  Parameters:
    `originalForm` - The original form of the first value as a string.
    `data` - The vector to which the value should be added.
    `w` - The weight to be applied to this feature.

### addToVector

    public void addToVector(byte[] originalForm,
                            double w,
                            Vector data)

  Adds a value to a vector. (Unsupported)

  Specified by:
    `addToVector` in class `FeatureVectorEncoder`
  Parameters:
    `originalForm` - The original form of the first value as a byte array.
    `data` - The vector to which the value should be added.

### addInteractionToVector

    public void addInteractionToVector(String original1,
                                       String original2,
                                       double weight,
                                       Vector data)

  Adds a value to a vector.

  Parameters:
    `original1` - The original form of the first value as a string.
    `original2` - The original form of the second value as a string.
    `weight` - How much to weight this interaction
    `data` - The vector to which the value should be added.

### addInteractionToVector

    public void addInteractionToVector(byte[] originalForm1,
                                       byte[] originalForm2,
                                       double weight,
                                       Vector data)

  Adds a value to a vector.

  Parameters:
    `originalForm1` - The original form of the first value as a byte array.
    `originalForm2` - The original form of the second value as a byte array.
    `weight` - How much to weight this interaction
    `data` - The vector to which the value should be added.

### getWeight

    protected double getWeight(byte[] originalForm1,
                               byte[] originalForm2,
                               double w)

### asString

    public String asString(String originalForm)

  Converts a value into a form that would help a human understand the internals of how the value is being interpreted. For text-like things, this is likely to be a list of the terms found with associated weights (if any).

  Specified by:
    `asString` in class `FeatureVectorEncoder`
  Parameters:
    `originalForm` - The original form of the value as a string.
  Returns:
    A string that a human can read.

### hashForProbe

    protected int hashForProbe(byte[] originalForm,
                               int dataSize,
                               String name,
                               int probe)

  Description copied from class: `FeatureVectorEncoder`
  Provides the unique hash for a particular probe. For all encoders except text, this is all that is needed and the default implementation of hashesForProbe will do the right thing. For text and similar values, hashesForProbe should be over-ridden and this method should not be used.

  Specified by:
    `hashForProbe` in class `FeatureVectorEncoder`
  Parameters:
    `originalForm` - The original byte array value
    `dataSize` - The length of the vector being encoded
    `name` - The name of the variable being encoded
    `probe` - The probe number
  Returns:
    The hash of the current probe

Copyright © 2008–2014 The Apache Software Foundation. All rights reserved.