DnnEstimator Class

Definition

The DnnTransformer is used in following two scenarios.

  1. Scoring with pretrained TensorFlow model: In this mode, the transform extracts hidden layers' values from a pre-trained Tensorflow model and uses outputs as features in ML.Net pipeline.
  2. Retraining of TensorFlow model: In this mode, the transform retrains a TensorFlow model using the user data passed through ML.Net pipeline. Once the model is trained, it's outputs can be used as features for scoring.
public sealed class DnnEstimator : Microsoft.ML.IEstimator<Microsoft.ML.Transforms.DnnTransformer>
type DnnEstimator = class
    interface IEstimator<DnnTransformer>
Public NotInheritable Class DnnEstimator
Implements IEstimator(Of DnnTransformer)
Inheritance
DnnEstimator
Implements

Remarks

The DnnTransform extracts specified outputs using a pre-trained Tensorflow model. Optionally, it can further retrain TensorFlow model on user data to adjust model parameters on the user data ( also know as "Transfer Learning").

This transform requires the Microsoft.ML.Dnn nuget to be installed. The DnnTransform has the following assumptions regarding input, output, processing of data, and retraining.

  1. For the input model, currently the DnnTransform supports both the Frozen model format and also the SavedModel format. However, retraining of the model is only possible for the SavedModel format. Checkpoint format is currently neither supported for scoring nor for retraining due lack of TensorFlow C-API support for loading it.
  2. The transform supports scoring only one example at a time. However, retraining can be performed in batches.
  3. Advanced transfer learning/fine tuning scenarios (e.g. adding more layers into the network, changing the shape of inputs, freezing the layers which do not need to be updated during retraining process etc.) are currently not possible due to lack of support for network/graph manipulation inside the model using TensorFlow C-API.
  4. The name of input column(s) should match the name of input(s) in TensorFlow model.
  5. The name of each output column should match one of the operations in the TensorFlow graph.
  6. Currently, double, float, long, int, short, sbyte, ulong, uint, ushort, byte and bool are the acceptable data types for input/output.
  7. Upon success, the transform will introduce a new column in IDataView corresponding to each output column specified.

Methods

Fit(IDataView)

Trains and returns a DnnTransformer.

GetOutputSchema(SchemaShape)

Returns the SchemaShape of the schema which will be produced by the transformer. Used for schema propagation and verification in a pipeline.

Applies to