public class SGDROIFinder extends java.lang.Object implements MLROIFinder
| Constructor and Description |
|---|
SGDROIFinder()
Creates a new SGD ROI finder using the Hinge loss function and a regularization set to 1.0E-5.
|
SGDROIFinder(org.sgdtk.Loss lossFunction,
double regularization)
Creates a new SGD ROI finder using the specified loss function and regularization.
|
SGDROIFinder(org.sgdtk.Model mdl)
Instantiates a new SGD ROI finder from an existing SGD model.
|
| Modifier and Type | Method and Description |
|---|---|
org.sgdtk.Learner |
getLearner()
Returns the model trainer.
|
org.sgdtk.Model |
getLinearModel()
Returns the current SGD model.
|
int |
getNumFeatures()
Returns the number of features used to train this model
|
java.util.Map<java.lang.String,java.lang.Object> |
getObjectMap()
Creates a map of the important fields for the instance, suitable for serialization.
|
long |
getSerializationVersion()
Returns the current version of the serialization format.
|
int |
getVersion()
Returns the current class version.
|
void |
initCurrentVersion(java.util.Map<java.lang.String,java.lang.Object> objectMap)
Initializes an instance with a current-version object graph.
|
boolean |
isROI(Dataset dataset)
Predict whether a sample contains a region of interest
|
boolean |
isROI(double[] data)
Predict whether a sample contains a region of interest
|
void |
legacyRead(com.esotericsoftware.kryo.Kryo kryo,
com.esotericsoftware.kryo.io.Input input) |
void |
legacyWrite(com.esotericsoftware.kryo.Kryo kryo,
com.esotericsoftware.kryo.io.Output output) |
static void |
main(java.lang.String[] args) |
double |
negativeClass()
Returns the value of the negative label.
|
double |
positiveClass()
Returns the value of the positive label.
|
double |
predict(Dataset dataset)
Returns the prediction of the specified sample.
|
double |
predict(double[] data)
Returns the prediction of the specified sample.
|
void |
setLearner(org.sgdtk.Learner learner)
Sets the model trainer.
|
void |
setLinearModel(org.sgdtk.Model linearModel)
Sets the SGD model
|
void |
train(double[][] X,
int[] y)
Trains the model with another set of samples, creating the model if required.
|
boolean |
validDims(double[] data)
Ensure a given sample has correct number of features.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitinit, initPreviousVersion, initUnknownVersion, load, read, save, writepublic SGDROIFinder()
public SGDROIFinder(org.sgdtk.Loss lossFunction,
double regularization)
lossFunction - e.g. HingeLoss, LogLoss, SquaredHingeLoss,regularization - regularization parameter to penalize model complexitypublic SGDROIFinder(org.sgdtk.Model mdl)
mdl - SGD modelpublic void train(double[][] X,
int[] y)
throws java.lang.Exception
train in interface MLROIFinderX - N examples with M features per exampley - N labels for the N examples in Xjava.lang.Exception - if an error occurspublic boolean isROI(double[] data)
public boolean isROI(Dataset dataset)
public long getSerializationVersion()
ObjectMapgetSerializationVersion in interface ObjectMappublic int getVersion()
ObjectMapgetVersion in interface ObjectMappublic java.util.Map<java.lang.String,java.lang.Object> getObjectMap()
ObjectMapgetObjectMap in interface ObjectMappublic void initCurrentVersion(java.util.Map<java.lang.String,java.lang.Object> objectMap)
ObjectMapinitCurrentVersion in interface ObjectMapobjectMap - object graph for initializationpublic double predict(double[] data)
predict in interface MLROIFinderdata - samplepublic double predict(Dataset dataset)
predict in interface MLROIFinderdataset - samplepublic boolean validDims(double[] data)
data - samplepublic org.sgdtk.Learner getLearner()
public void setLearner(org.sgdtk.Learner learner)
learner - new model trainerpublic org.sgdtk.Model getLinearModel()
public void setLinearModel(org.sgdtk.Model linearModel)
linearModel - new modelpublic int getNumFeatures()
public double positiveClass()
positiveClass in interface MLROIFinderpublic double negativeClass()
negativeClass in interface MLROIFinderpublic void legacyWrite(com.esotericsoftware.kryo.Kryo kryo,
com.esotericsoftware.kryo.io.Output output)
public void legacyRead(com.esotericsoftware.kryo.Kryo kryo,
com.esotericsoftware.kryo.io.Input input)
public static void main(java.lang.String[] args)
throws java.lang.Exception
java.lang.Exception