Class SparseWriter
Writer for data files containing samples in libsvm's sparse format.
Inheritance
System.Object
SparseWriter
Implements
System.IDisposable
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 sealed class SparseWriter : IDisposable
Constructors
| Improve this Doc View SourceSparseWriter(Stream, Encoding)
Initializes a new instance of the SparseWriter class.
Declaration
public SparseWriter(Stream stream, Encoding encoding = null)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | stream | The file stream to be written. |
System.Text.Encoding | encoding | The encoding tu use when reading the sparse matrix |
SparseWriter(String, Encoding)
Initializes a new instance of the SparseWriter class.
Declaration
public SparseWriter(string path, Encoding encoding)
Parameters
Type | Name | Description |
---|---|---|
System.String | path | The complete file path to be written. |
System.Text.Encoding | encoding | The character encoding to use. |
Properties
| Improve this Doc View SourceBaseStream
Returns the underlying stream.
Declaration
public Stream BaseStream { get; }
Property Value
Type | Description |
---|---|
System.IO.Stream |
Methods
| Improve this Doc View SourceDispose()
Performs application-defined tasks associated with
freeing, releasing, or resetting unmanaged resources.
Declaration
public void Dispose()
Finalize()
Releases unmanaged resources and performs other cleanup operations before the
SparseReader is reclaimed by garbage collection.
Declaration
protected void Finalize()
Write(Sparse<Double>, Double)
Writes the given feature vector and associated output label/value to the file.
Declaration
public void Write(Sparse<double> feature, double output)
Parameters
Type | Name | Description |
---|---|---|
Sparse<System.Double> | feature | The feature vector to be written. |
System.Double | output | The output value to be written. |
Write(Sparse<Double>[], Boolean[])
Writes the given feature vectors and associated output label/value to the file.
Declaration
public void Write(Sparse<double>[] features, bool[] outputs)
Parameters
Type | Name | Description |
---|---|---|
Sparse<System.Double>[] | features | The array of feature vectors to be written. |
System.Boolean[] | outputs | The array of output values to be written. |
Write(Double[], Boolean)
Writes the given feature vector and associated output label/value to the file.
Declaration
public void Write(double[] feature, bool output)
Parameters
Type | Name | Description |
---|---|---|
System.Double[] | feature | The feature vector to be written. |
System.Boolean | output | The output value to be written. |
Write(Double[], Double)
Writes the given feature vector and associated output label/value to the file.
Declaration
public void Write(double[] feature, double output)
Parameters
Type | Name | Description |
---|---|---|
System.Double[] | feature | The feature vector to be written. |
System.Double | output | The output value to be written. |
Write(Double[][], Boolean[])
Writes the given feature vectors and associated output label/value to the file.
Declaration
public void Write(double[][] features, bool[] outputs)
Parameters
Type | Name | Description |
---|---|---|
System.Double[][] | features | The array of feature vectors to be written. |
System.Boolean[] | outputs | The array of output values to be written. |
Implements
System.IDisposable