edu.stanford.nlp.classify
Class LogisticClassifier<L,F>

java.lang.Object
  extended by edu.stanford.nlp.classify.LogisticClassifier<L,F>
Type Parameters:
L - The type of the labels in the Dataset
F - The type of the features in the Dataset
All Implemented Interfaces:
Classifier<L,F>, RVFClassifier<L,F>, Serializable

public class LogisticClassifier<L,F>
extends Object
implements Classifier<L,F>, Serializable, RVFClassifier<L,F>

A classifier for binary logistic regression problems. This uses the standard statistics textbook formulation of binary logistic regression, which is more efficient than using the LinearClassifier class.

Author:
Galen Andrew, Sarah Spikes (sdspikes@cs.stanford.edu) (Templatization), Ramesh Nallapati nmramesh@cs.stanford.edu justificationOf(Collection)
See Also:
Serialized Form

Constructor Summary
LogisticClassifier()
          Deprecated. 
LogisticClassifier(boolean biased)
          Deprecated. 
LogisticClassifier(double[] weights, Index<F> featureIndex, L[] classes)
           
LogisticClassifier(LogPrior prior)
          Deprecated. 
LogisticClassifier(LogPrior prior, boolean biased)
          Deprecated. 
 
Method Summary
 L classOf(Collection<F> features)
           
 L classOf(Counter<F> features)
           
 L classOf(Datum<L,F> datum)
           
 L classOf(RVFDatum<L,F> example)
          Deprecated. 
 Index<F> getFeatureIndex()
           
 L getLabelForInternalNegativeClass()
           
 L getLabelForInternalPositiveClass()
           
 double[] getWeights()
           
 Counter<F> justificationOf(Collection<F> features)
          returns the weights assigned by the classifier to each feature
 Counter<F> justificationOf(Counter<F> features)
           
 Collection<L> labels()
           
static void main(String[] args)
           
 double probabilityOf(Collection<F> features, L label)
           
 double probabilityOf(Counter<F> features, L label)
           
 double probabilityOf(Datum<L,F> example)
           
 double probabilityOf(RVFDatum<L,F> example)
          Deprecated. 
 double scoreOf(Collection<F> features)
           
 double scoreOf(Counter<F> features)
           
 Counter<L> scoresOf(Datum<L,F> datum)
          returns the scores for both the classes
 Counter<L> scoresOf(RVFDatum<L,F> example)
          Deprecated. 
 String toString()
           
 void train(GeneralDataset<L,F> data)
          Deprecated. 
 void train(GeneralDataset<L,F> data, double l1reg, double tol)
          Deprecated. 
 void trainWeightedData(GeneralDataset<L,F> data, float[] dataWeights)
          Deprecated. 
 Counter<String> weightsAsCounter()
           
 Counter<F> weightsAsGenericCounter()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LogisticClassifier

public LogisticClassifier(double[] weights,
                          Index<F> featureIndex,
                          L[] classes)

LogisticClassifier

@Deprecated
public LogisticClassifier()
Deprecated. 


LogisticClassifier

@Deprecated
public LogisticClassifier(boolean biased)
Deprecated. 


LogisticClassifier

@Deprecated
public LogisticClassifier(LogPrior prior)
Deprecated. 


LogisticClassifier

@Deprecated
public LogisticClassifier(LogPrior prior,
                                     boolean biased)
Deprecated. 

Method Detail

toString

public String toString()
Overrides:
toString in class Object

getLabelForInternalPositiveClass

public L getLabelForInternalPositiveClass()

getLabelForInternalNegativeClass

public L getLabelForInternalNegativeClass()

weightsAsCounter

public Counter<String> weightsAsCounter()

weightsAsGenericCounter

public Counter<F> weightsAsGenericCounter()

getFeatureIndex

public Index<F> getFeatureIndex()

getWeights

public double[] getWeights()

labels

public Collection<L> labels()
Specified by:
labels in interface Classifier<L,F>

classOf

public L classOf(Datum<L,F> datum)
Specified by:
classOf in interface Classifier<L,F>

classOf

@Deprecated
public L classOf(RVFDatum<L,F> example)
Deprecated. 

Specified by:
classOf in interface RVFClassifier<L,F>

classOf

public L classOf(Counter<F> features)

classOf

public L classOf(Collection<F> features)

scoreOf

public double scoreOf(Collection<F> features)

scoreOf

public double scoreOf(Counter<F> features)

justificationOf

public Counter<F> justificationOf(Counter<F> features)

justificationOf

public Counter<F> justificationOf(Collection<F> features)
returns the weights assigned by the classifier to each feature


scoresOf

public Counter<L> scoresOf(Datum<L,F> datum)
returns the scores for both the classes

Specified by:
scoresOf in interface Classifier<L,F>

scoresOf

@Deprecated
public Counter<L> scoresOf(RVFDatum<L,F> example)
Deprecated. 

Specified by:
scoresOf in interface RVFClassifier<L,F>

probabilityOf

public double probabilityOf(Datum<L,F> example)

probabilityOf

public double probabilityOf(Collection<F> features,
                            L label)

probabilityOf

@Deprecated
public double probabilityOf(RVFDatum<L,F> example)
Deprecated. 


probabilityOf

public double probabilityOf(Counter<F> features,
                            L label)

trainWeightedData

@Deprecated
public void trainWeightedData(GeneralDataset<L,F> data,
                                         float[] dataWeights)
Deprecated. 

Trains on weighted dataset.

Parameters:
dataWeights - weights of the data.

train

@Deprecated
public void train(GeneralDataset<L,F> data)
Deprecated. 


train

@Deprecated
public void train(GeneralDataset<L,F> data,
                             double l1reg,
                             double tol)
Deprecated. 


main

public static void main(String[] args)
                 throws Exception
Throws:
Exception


Stanford NLP Group