/** * Custom step function for line search. */ @JsonTypeInfo(use = Id.NAME, include = As.WRAPPER_OBJECT) @JsonSubTypes(value = {@JsonSubTypes.Type(value = DefaultStepFunction.class, name = "default"), @JsonSubTypes.Type(value = GradientStepFunction.class, name = "gradient"), @JsonSubTypes.Type(value = NegativeDefaultStepFunction.class, name = "negativeDefault"), @JsonSubTypes.Type(value = NegativeGradientStepFunction.class, name = "negativeGradient"),}) public class StepFunction implements Serializable, Cloneable { private static final long serialVersionUID = -1884835867123371330L; @Override public StepFunction clone() { try { StepFunction clone = (StepFunction) super.clone(); return clone; } catch (CloneNotSupportedException e) { throw new RuntimeException(e); } } }
@JsonSubTypes(value = {@JsonSubTypes.Type(value = ChartHistogram.class, name = "ChartHistogram"), @JsonSubTypes.Type(value = ChartHorizontalBar.class, name = "ChartHorizontalBar"), @JsonSubTypes.Type(value = ChartLine.class, name = "ChartLine"),
@JsonSubTypes(value = {@JsonSubTypes.Type(value = CnnToFeedForwardPreProcessor.class, name = "cnnToFeedForward"), @JsonSubTypes.Type(value = CnnToRnnPreProcessor.class, name = "cnnToRnn"), @JsonSubTypes.Type(value = ComposableInputPreProcessor.class, name = "composableInput"),
/** ScoreCalculator interface is used to calculate a score for a neural network. * For example, the loss function, test set accuracy, F1, or some other (possibly custom) metric. * @param <T> Type of model. For example, {@link org.deeplearning4j.nn.multilayer.MultiLayerNetwork} or {@link org.deeplearning4j.nn.graph.ComputationGraph} */ @JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, include = JsonTypeInfo.As.PROPERTY, property = "@class") @JsonInclude(JsonInclude.Include.NON_NULL) @JsonSubTypes(value = { @JsonSubTypes.Type(value = DataSetLossCalculator.class, name = "BestScoreEpochTerminationCondition"), @JsonSubTypes.Type(value = DataSetLossCalculatorCG.class, name = "MaxEpochsTerminationCondition"), }) public interface ScoreCalculator<T extends Model> extends Serializable { /** Calculate the score for the given MultiLayerNetwork */ double calculateScore(T network); }
@JsonSubTypes(value = {@JsonSubTypes.Type(value = ElementWiseVertex.class, name = "ElementWiseVertex"), @JsonSubTypes.Type(value = MergeVertex.class, name = "MergeVertex"), @JsonSubTypes.Type(value = SubsetVertex.class, name = "SubsetVertex"),
@JsonSubTypes(value = {@JsonSubTypes.Type(value = LossBinaryXENT.class, name = "BinaryXENT"), @JsonSubTypes.Type(value = LossCosineProximity.class, name = "CosineProximity"), @JsonSubTypes.Type(value = LossHinge.class, name = "Hinge"),
/** Interface for saving MultiLayerNetworks learned during early stopping, and retrieving them again later * @param <T> Type of model to save. For example, {@link org.deeplearning4j.nn.multilayer.MultiLayerNetwork} or {@link org.deeplearning4j.nn.graph.ComputationGraph} * @author Alex Black */ @JsonInclude(JsonInclude.Include.NON_NULL) @JsonSubTypes(value = {@JsonSubTypes.Type(value = InMemoryModelSaver.class, name = "InMemoryModelSaver"), @JsonSubTypes.Type(value = LocalFileGraphSaver.class, name = "LocalFileGraphSaver"), @JsonSubTypes.Type(value = LocalFileModelSaver.class, name = "LocalFileModelSaver"), }) @JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, include = JsonTypeInfo.As.PROPERTY, property = "@class") public interface EarlyStoppingModelSaver<T extends Model> extends Serializable { /** Save the best model (so far) learned during early stopping training */ void saveBestModel(T net, double score) throws IOException; /** Save the latest (most recent) model learned during early stopping */ void saveLatestModel(T net, double score) throws IOException; /** Retrieve the best model that was previously saved */ T getBestModel() throws IOException; /** Retrieve the most recent model that was previously saved */ T getLatestModel() throws IOException; }
@JsonSubTypes(value = {@JsonSubTypes.Type(value = GaussianReconstructionDistribution.class, name = "Gaussian"), @JsonSubTypes.Type(value = BernoulliReconstructionDistribution.class, name = "Bernoulli"), @JsonSubTypes.Type(value = ExponentialReconstructionDistribution.class, name = "Exponential"),
@JsonSubTypes(value = {@JsonSubTypes.Type(value = StyleChart.class, name = "StyleChart"), @JsonSubTypes.Type(value = StyleTable.class, name = "StyleTable"), @JsonSubTypes.Type(value = StyleText.class, name = "StyleText"),
/** Interface for termination conditions to be evaluated once per epoch (i.e., once per pass of the full data set), * based on a score and epoch number */ @JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, include = JsonTypeInfo.As.PROPERTY, property = "@class") @JsonInclude(JsonInclude.Include.NON_NULL) @JsonSubTypes(value = { @JsonSubTypes.Type(value = BestScoreEpochTerminationCondition.class, name = "BestScoreEpochTerminationCondition"), @JsonSubTypes.Type(value = MaxEpochsTerminationCondition.class, name = "MaxEpochsTerminationCondition"), @JsonSubTypes.Type(value = MaxScoreIterationTerminationCondition.class, name = "MaxScoreIterationTerminationCondition"), }) public interface EpochTerminationCondition extends Serializable { /** Initialize the epoch termination condition (often a no-op)*/ void initialize(); /**Should the early stopping training terminate at this epoch, based on the calculated score and the epoch number? * Returns true if training should terminated, or false otherwise * @param epochNum Number of the last completed epoch (starting at 0) * @param score Score calculate for this epoch * @return Whether training should be terminated at this epoch */ boolean terminate(int epochNum, double score); }
@JsonSubTypes(value = {@JsonSubTypes.Type(value = AutoEncoder.class, name = "autoEncoder"), @JsonSubTypes.Type(value = ConvolutionLayer.class, name = "convolution"), @JsonSubTypes.Type(value = Convolution1DLayer.class, name = "convolution1d"),
@JsonSubTypes(value = {@JsonSubTypes.Type(value = ColorConversionTransform.class, name = "ColorConversionTransform"), @JsonSubTypes.Type(value = CropImageTransform.class, name = "CropImageTransform"), @JsonSubTypes.Type(value = EqualizeHistTransform.class, name = "EqualizeHistTransform"),
@JsonSubTypes(value = {@JsonSubTypes.Type(value = ActivationCube.class, name = "Cube"), @JsonSubTypes.Type(value = ActivationELU.class, name = "ELU"), @JsonSubTypes.Type(value = ActivationHardSigmoid.class, name = "HardSigmoid"),
@JsonSubTypes(value = {@JsonSubTypes.Type(value = InputType.InputTypeFeedForward.class, name = "FeedForward"), @JsonSubTypes.Type(value = InputType.InputTypeRecurrent.class, name = "Recurrent"), @JsonSubTypes.Type(value = InputType.InputTypeConvolutional.class, name = "Convolutional"),