Class SparseFormat
Provides static methods to save and load files saved in LibSVM's sparse format.
Inheritance
System.Object
SparseFormat
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Mars.Common.IO
Assembly: Mars.IO.dll
Syntax
public static class SparseFormat
Methods
| Improve this Doc View SourceLoad(Stream, out Sparse<Double>[], out Boolean[], SerializerCompression)
Loads an array of sparse samples from a stream.
Declaration
public static void Load(Stream stream, out Sparse<double>[] samples, out bool[] outputs, SerializerCompression compression = SerializerCompression.None)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | stream | The stream from where the file will be loaded. |
Sparse<System.Double>[] | samples | The samples that have been read from the file. |
System.Boolean[] | outputs | The output labels associated with each sample in samples . |
SerializerCompression | compression | The type of compression to use. Default is None. |
Load(String, out Sparse<Double>[], out Boolean[], SerializerCompression)
Loads an array of sparse samples from a file in the disk.
Declaration
public static void Load(string path, out Sparse<double>[] samples, out bool[] outputs, SerializerCompression compression = SerializerCompression.None)
Parameters
Type | Name | Description |
---|---|---|
System.String | path | The path to the file containing the samples to be loaded. |
Sparse<System.Double>[] | samples | The samples that have been read from the file. |
System.Boolean[] | outputs | The output labels associated with each sample in samples . |
SerializerCompression | compression | The type of compression to use. Default is None. |
Save(Sparse<Double>[], Boolean[], Stream, SerializerCompression)
Saves an array of sparse samples to a stream.
Declaration
public static void Save(Sparse<double>[] samples, bool[] outputs, Stream stream, SerializerCompression compression = SerializerCompression.None)
Parameters
Type | Name | Description |
---|---|---|
Sparse<System.Double>[] | samples | The samples that have been read from the file. |
System.Boolean[] | outputs | The output labels associated with each sample in samples . |
System.IO.Stream | stream | The stream where the file will be saved. |
SerializerCompression | compression | The type of compression to use. Default is None. |
Save(Sparse<Double>[], Boolean[], String, SerializerCompression)
Saves an array of sparse samples to a file in the disk.
Declaration
public static void Save(Sparse<double>[] samples, bool[] outputs, string path, SerializerCompression compression = SerializerCompression.None)
Parameters
Type | Name | Description |
---|---|---|
Sparse<System.Double>[] | samples | The samples that have been read from the file. |
System.Boolean[] | outputs | The output labels associated with each sample in samples . |
System.String | path | The disk path under which the file will be saved. |
SerializerCompression | compression | The type of compression to use. Default is None. |
Save(Double[][], Boolean[], Stream, SerializerCompression)
Saves an array of dense samples to a stream.
Declaration
public static void Save(double[][] samples, bool[] outputs, Stream stream, SerializerCompression compression = SerializerCompression.None)
Parameters
Type | Name | Description |
---|---|---|
System.Double[][] | samples | The samples that have been read from the file. |
System.Boolean[] | outputs | The output labels associated with each sample in samples . |
System.IO.Stream | stream | The stream where the file will be saved. |
SerializerCompression | compression | The type of compression to use. Default is None. |
Save(Double[][], Boolean[], String, SerializerCompression)
Saves an array of dense samples to a file in the disk.
Declaration
public static void Save(double[][] samples, bool[] outputs, string path, SerializerCompression compression = SerializerCompression.None)
Parameters
Type | Name | Description |
---|---|---|
System.Double[][] | samples | The samples that have been read from the file. |
System.Boolean[] | outputs | The output labels associated with each sample in samples . |
System.String | path | The disk path under which the file will be saved. |
SerializerCompression | compression | The type of compression to use. Default is None. |