netkit.classifiers
Class NetworkLearner
java.lang.Object
netkit.classifiers.NetworkLearner
public class NetworkLearner
- extends java.lang.Object
Field Summary |
java.util.logging.Logger |
logger
|
Method Summary |
Graph |
getGraph()
|
InferenceMethod |
getInferenceMethod()
|
Classifier |
getLocalClassifier()
|
NetworkClassifier |
getNetworkClassifier()
|
DataSplit |
getSplit()
|
boolean |
inTrainingSet(Node n)
|
Estimate |
runActiveLearner(PickLabelStrategy ps,
DataSplit split)
See fully parameterized method for details. |
Estimate |
runActiveLearner(PickLabelStrategy ps,
DataSplit split,
int picksPerIteration,
int maxPicks,
boolean learnWithTruth,
int depth)
Run active learning using the given parameters. |
Estimate |
runInference(DataSplit split)
|
Estimate |
runInference(DataSplit split,
boolean showItAcc,
boolean learnWithTruth,
int depth)
|
Estimate |
runLeaveOneOut(DataSplit split)
|
Estimate |
runLeaveOneOut(DataSplit split,
boolean learnWithTruth,
int depth)
|
void |
saveIterationPredictions(java.lang.String stem,
PrintEstimateWriter pe,
boolean append,
Node[] eval,
java.lang.String header)
|
void |
saveIterationsInPajek(java.lang.String pajekFile)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
logger
public final java.util.logging.Logger logger
NetworkLearner
public NetworkLearner(Classifier lc,
NetworkClassifier nc,
InferenceMethod ic,
boolean applyCMN)
getNetworkClassifier
public NetworkClassifier getNetworkClassifier()
getLocalClassifier
public Classifier getLocalClassifier()
getInferenceMethod
public InferenceMethod getInferenceMethod()
getGraph
public Graph getGraph()
getSplit
public DataSplit getSplit()
inTrainingSet
public boolean inTrainingSet(Node n)
runActiveLearner
public Estimate runActiveLearner(PickLabelStrategy ps,
DataSplit split)
- See fully parameterized method for details. This method calls the more
fully qualified method, with the following parameters:
runActiveLearner(ps,split,seedSize,true)
It computes seedSize
to be the number of classes possible, thereby
in effect setting the initial seeds to be one instance of each class randomly
chosen from the training set from the given DataSplit.
- Parameters:
ps
- Strategy for picking labelssplit
- Split from which to pick seeds + test set
- Returns:
- Final estimates after running active learning
- See Also:
#runActiveLearner(PickLabelStrategy, DataSplit, boolean, int, boolean)
runActiveLearner
public Estimate runActiveLearner(PickLabelStrategy ps,
DataSplit split,
int picksPerIteration,
int maxPicks,
boolean learnWithTruth,
int depth)
- Run active learning using the given parameters.
The methodology works as follows:
- Initialize the strategy object with a reference to this object
- Repeat until
labelSet
is as large as maximum size given or the strategy does not pick more nodes.
- Learn a model using the
labelSet
. Use complete truth (learnWithTruth
) or truth up to depth
from nodes in the labelSet
- Use learned model to predict labels from all nodes that are not in the
labelSet
.
- Use strategy to pick nodes that should be labeled next. If
pickFromTrainingOnly
is true, then only pick from nodes that are in the DataSplit training set, otherwise allow the strategy to pick any node in the graph that are not part of the DataSplit test set.
- Get true labels from the picked nodes and add these to
labelSet
.
Return the final predictions for the test set only
- Parameters:
ps
- Strategy for picking labelssplit
- Split from which to pick seeds + test setpicksPerIteration
- How many instances should be picked each iterationmaxPicks
- How many instances should be picked totallearnWithTruth
- Use complete truth when learning classifiersdepth
- Get true labels to this depth when learning a relational classifier
- Returns:
- Final estimates after running active learning
runLeaveOneOut
public Estimate runLeaveOneOut(DataSplit split)
runLeaveOneOut
public Estimate runLeaveOneOut(DataSplit split,
boolean learnWithTruth,
int depth)
saveIterationPredictions
public void saveIterationPredictions(java.lang.String stem,
PrintEstimateWriter pe,
boolean append,
Node[] eval,
java.lang.String header)
saveIterationsInPajek
public void saveIterationsInPajek(java.lang.String pajekFile)
runInference
public Estimate runInference(DataSplit split)
runInference
public Estimate runInference(DataSplit split,
boolean showItAcc,
boolean learnWithTruth,
int depth)