Search Results for

    Show / Hide Table of Contents

    Class Utilities

    Implements various utilities for all learners.

    Inheritance
    Object
    Utilities
    Inherited Members
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Object.ReferenceEquals(Object, Object)
    Object.ToString()
    Namespace: Microsoft.ML.Probabilistic.Learners
    Assembly: Microsoft.ML.Probabilistic.Learners.dll
    Syntax
    public static class Utilities

    Methods

    GetBatch<T>(Int32, T[], Int32)

    Gets the specified batch of elements from a given array.

    Declaration
    public static IReadOnlyList<T> GetBatch<T>(int batch, T[] array, int totalBatchCount)
    Parameters
    Type Name Description
    Int32 batch

    The zero-indexed batch to get the array elements for.

    T[] array

    An array to get the batch of elements from.

    Int32 totalBatchCount

    The total number of batches.

    Returns
    Type Description
    IReadOnlyList<T>

    The array elements for the specified batch.

    Type Parameters
    Name Description
    T

    The type of an array element.

    Load<TLearner>(Stream, IFormatter)

    Deserializes a learner from a given stream and formatter.

    Declaration
    public static TLearner Load<TLearner>(Stream stream, IFormatter formatter)
    Parameters
    Type Name Description
    Stream stream

    The stream.

    IFormatter formatter

    The formatter.

    Returns
    Type Description
    TLearner

    The deserialized learner object.

    Type Parameters
    Name Description
    TLearner

    The type of a learner.

    Load<TLearner>(String)

    Deserializes a learner from a file.

    Declaration
    public static TLearner Load<TLearner>(string fileName)
    Parameters
    Type Name Description
    String fileName

    The file name.

    Returns
    Type Description
    TLearner

    The deserialized learner object.

    Type Parameters
    Name Description
    TLearner

    The type of a learner.

    Save(ILearner, Stream, IFormatter)

    Serializes a learner to a given stream using a given formatter.

    Declaration
    public static void Save(this ILearner learner, Stream stream, IFormatter formatter)
    Parameters
    Type Name Description
    ILearner learner

    The learner.

    Stream stream

    The serialization stream.

    IFormatter formatter

    The formatter.

    Save(ILearner, String)

    Persists a learner to a file.

    Declaration
    public static void Save(this ILearner learner, string fileName)
    Parameters
    Type Name Description
    ILearner learner

    The learner to serialize.

    String fileName

    The name of the file.

    SaveForwardCompatible(ICustomSerializable, String, FileMode)

    Persists an object that controls its binary serialization to a file with the specified name.

    Declaration
    public static void SaveForwardCompatible(this ICustomSerializable obj, string fileName, FileMode fileMode = FileMode.Create)
    Parameters
    Type Name Description
    ICustomSerializable obj

    The object to be serialized.

    String fileName

    The name of the file.

    FileMode fileMode

    The mode used to open the file. Defaults to Create.

    Remarks

    To load a saved learner, you can use the factory methods whose names start with LoadBackwardCompatible.

    SaveForwardCompatibleAsBinary(ICustomSerializable, Stream)

    Persists an object that controls its binary serialization to the specified stream.

    Declaration
    public static void SaveForwardCompatibleAsBinary(this ICustomSerializable obj, Stream stream)
    Parameters
    Type Name Description
    ICustomSerializable obj

    The object to be serialized.

    Stream stream

    The serialization stream.

    Remarks

    To load a saved learner, you can use the factory methods whose names start with LoadBackwardCompatible.

    SaveForwardCompatibleAsText(ICustomSerializable, Stream)

    Persists an object that controls its binary serialization to the specified stream.

    Declaration
    public static void SaveForwardCompatibleAsText(this ICustomSerializable obj, Stream stream)
    Parameters
    Type Name Description
    ICustomSerializable obj

    The object to be serialized.

    Stream stream

    The serialization stream.

    Remarks

    To load a saved learner, you can use the factory methods whose names start with LoadBackwardCompatible.

    In This Article
    Back to top Copyright © .NET Foundation. All rights reserved.