|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.mahout.classifier.sgd.LogisticModelParameters
public class LogisticModelParameters
Encapsulates everything we need to know about a model and how it reads and vectorizes its input. This encapsulation allows us to coherently save and restore a model from a file. This also allows us to keep command line arguments that affect learning in a coherent way.
Constructor Summary | |
---|---|
LogisticModelParameters()
|
Method Summary | |
---|---|
OnlineLogisticRegression |
createRegression()
Creates a logistic regression trainer using the parameters collected here. |
CsvRecordFactory |
getCsvRecordFactory()
Returns a CsvRecordFactory compatible with this logistic model. |
double |
getLambda()
|
double |
getLearningRate()
|
int |
getMaxTargetCategories()
|
int |
getNumFeatures()
|
List<String> |
getTargetCategories()
|
String |
getTargetVariable()
|
Map<String,String> |
getTypeMap()
|
static LogisticModelParameters |
loadFrom(File in)
Reads a model from a file. |
static LogisticModelParameters |
loadFrom(InputStream in)
Reads a model from a stream. |
void |
readFields(DataInput in)
|
void |
saveTo(OutputStream out)
Saves a model to an output stream. |
void |
setLambda(double lambda)
|
void |
setLearningRate(double learningRate)
|
void |
setMaxTargetCategories(int maxTargetCategories)
Sets the number of target categories to be considered. |
void |
setNumFeatures(int numFeatures)
|
void |
setTargetCategories(List<String> targetCategories)
|
void |
setTargetVariable(String targetVariable)
Sets the target variable. |
void |
setTypeMap(Iterable<String> predictorList,
List<String> typeList)
Sets the types of the predictors. |
void |
setTypeMap(Map<String,String> map)
|
void |
setUseBias(boolean useBias)
|
boolean |
useBias()
|
void |
write(DataOutput out)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public LogisticModelParameters()
Method Detail |
---|
public CsvRecordFactory getCsvRecordFactory()
public OnlineLogisticRegression createRegression()
public void saveTo(OutputStream out) throws IOException
IOException
public static LogisticModelParameters loadFrom(InputStream in) throws IOException
IOException
public static LogisticModelParameters loadFrom(File in) throws IOException
IOException
- If there is an error opening or closing the file.public void write(DataOutput out) throws IOException
write
in interface org.apache.hadoop.io.Writable
IOException
public void readFields(DataInput in) throws IOException
readFields
in interface org.apache.hadoop.io.Writable
IOException
public void setTypeMap(Iterable<String> predictorList, List<String> typeList)
predictorList
- The list of variable names.typeList
- The list of types in the format preferred by CsvRecordFactory.public void setTargetVariable(String targetVariable)
targetVariable
- The name of the target variable.public void setMaxTargetCategories(int maxTargetCategories)
maxTargetCategories
- The number of target categories.public void setNumFeatures(int numFeatures)
public void setTargetCategories(List<String> targetCategories)
public List<String> getTargetCategories()
public void setUseBias(boolean useBias)
public boolean useBias()
public String getTargetVariable()
public Map<String,String> getTypeMap()
public void setTypeMap(Map<String,String> map)
public int getNumFeatures()
public int getMaxTargetCategories()
public double getLambda()
public void setLambda(double lambda)
public double getLearningRate()
public void setLearningRate(double learningRate)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |