Show / Hide Table of Contents

Class Descriptor

This class is designed to describe the underlying types that will be used in the machine learning process. Any machine learning process requires a set of Features that will be used to discriminate the Label. The Label itself is the target element that the machine learning algorithms learn to predict.

Inheritance
System.Object
Descriptor
Inherited Members
System.Object.Equals(System.Object, System.Object)
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
Namespace:numl.Model
Assembly:numl.dll
Syntax
public class Descriptor

Constructors

View Source

Descriptor()

Default constructor.

Declaration
public Descriptor()

Properties

View Source

Features

Set of features used to discriminate or learn about the Label.

Declaration
public Property[] Features { get; set; }
Property Value
Type Description
Property[]

The features.

View Source

Item[Int32]

Index into features (for convenience)

Declaration
public Property this[int i] { get; }
Parameters
Type Name Description
System.Int32 i

Feature index.

Property Value
Type Description
Property

Feature Property.

View Source

Item[String]

Index intor features (for convenience)

Declaration
public Property this[string name] { get; }
Parameters
Type Name Description
System.String name

Feature name.

Property Value
Type Description
Property

Feature Property.

View Source

Label

Target property that is the target of machine learning.

Declaration
public Property Label { get; set; }
Property Value
Type Description
Property

The label.

View Source

Name

Descriptor name.

Declaration
public string Name { get; set; }
Property Value
Type Description
System.String

The name.

View Source

Type

Base type of object being described. This could also be null.

Declaration
public Type Type { get; set; }
Property Value
Type Description
System.Type

The type.

View Source

VectorLength

Total feature count The number of features does not necessarily equal the number of Features given that there might exist multi-valued features.

Declaration
public int VectorLength { get; }
Property Value
Type Description
System.Int32

The length of the vector.

Methods

View Source

At(Int32)

Gets related property given its offset within the vector representation.

Declaration
public Property At(int i)
Parameters
Type Name Description
System.Int32 i

Vector Index.

Returns
Type Description
Property

Associated Feature.

Exceptions
Type Condition
System.IndexOutOfRangeException

Thrown when the index is outside the required range.

View Source

ColumnAt(Int32)

Gets related property column name given its offset within the vector representation.

Declaration
public string ColumnAt(int i)
Parameters
Type Name Description
System.Int32 i

Vector Index.

Returns
Type Description
System.String

Associated Property Name.

View Source

Convert(IEnumerable<Object>, Boolean)

Converts a list of examples into a lazy double list of doubles.

Declaration
public IEnumerable<IEnumerable<double>> Convert(IEnumerable<object> items, bool withLabels = true)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<System.Object> items

Examples.

System.Boolean withLabels

True to include labels, otherwise False

Returns
Type Description
System.Collections.Generic.IEnumerable<System.Collections.Generic.IEnumerable<System.Double>>

Lazy double enumerable of doubles.

View Source

Convert(Object)

Converts a given example into a lazy list of doubles in preparation for vector conversion (both features and corresponding label)

Declaration
public IEnumerable<double> Convert(object item)
Parameters
Type Name Description
System.Object item

Example.

Returns
Type Description
System.Collections.Generic.IEnumerable<System.Double>

Lazy List of doubles.

View Source

Convert(Object, Boolean)

Converts a given example into a lazy list of doubles in preparation for vector conversion.

Declaration
public IEnumerable<double> Convert(object item, bool withLabel)
Parameters
Type Name Description
System.Object item

Example.

System.Boolean withLabel

Should convert label as well.

Returns
Type Description
System.Collections.Generic.IEnumerable<System.Double>

Lazy List of doubles.

Exceptions
Type Condition
System.InvalidOperationException

Thrown when the requested operation is invalid.

View Source

Create(Type)

Creates a descriptor based upon a marked up concrete type.

Declaration
public static Descriptor Create(Type t)
Parameters
Type Name Description
System.Type t

Class Type.

Returns
Type Description
Descriptor

Descriptor.

Exceptions
Type Condition
System.InvalidOperationException

Thrown when the requested operation is invalid.

View Source

Create<T>()

Creates a descriptor based upon a marked up concrete class.

Declaration
public static Descriptor Create<T>()where T : class
Returns
Type Description
Descriptor

Descriptor.

Type Parameters
Name Description
T
View Source

Equals(Object)

Equality test

Declaration
public override bool Equals(object obj)
Parameters
Type Name Description
System.Object obj

object to compare

Returns
Type Description
System.Boolean

equality

Overrides
System.Object.Equals(System.Object)
View Source

For<T>()

Creates a new descriptor using a strongly typed fluent approach. This initial descriptor is worthless without adding features.

Declaration
public static Descriptor<T> For<T>()
Returns
Type Description
Descriptor<T>

Empty descriptor

Type Parameters
Name Description
T

Source Object Type

View Source

For<T>(String)

Creates a new descriptor using a strongly typed fluent approach. This initial descriptor is worthless without adding features.

Declaration
public static Descriptor<T> For<T>(string name)
Parameters
Type Name Description
System.String name

Desired Descriptor Name.

Returns
Type Description
Descriptor<T>

Empty descriptor

Type Parameters
Name Description
T

Source Object Type

View Source

GetColumns()

Available column names used to discriminate or learn about Label. The number of columns does not necessarily equal the number of Features given that there might exist multi-valued features.

Declaration
public IEnumerable<string> GetColumns()
Returns
Type Description
System.Collections.Generic.IEnumerable<System.String>

An enumerator that allows foreach to be used to process the columns in this collection.

View Source

GetHashCode()

Return hash

Declaration
public override int GetHashCode()
Returns
Type Description
System.Int32

hash

Overrides
System.Object.GetHashCode()
View Source

GetValue(Object, Property)

Returns the raw value from the object for the supplied property.

Declaration
public object GetValue(object o, Property property)
Parameters
Type Name Description
System.Object o

Object to process.

Property property

Property value of the object to return.

Returns
Type Description
System.Object
View Source

Learn(String)

Adds (or replaces) a label to the descriptor.

Declaration
public DescriptorProperty Learn(string name)
Parameters
Type Name Description
System.String name

Name of label (must match property name or dictionary key)

Returns
Type Description
DescriptorProperty

A DescriptorProperty.

View Source

Load(Stream)

Load a descriptor from a stream.

Declaration
public static Descriptor Load(Stream stream)
Parameters
Type Name Description
System.IO.Stream stream

Stream.

Returns
Type Description
Descriptor

Descriptor.

Exceptions
Type Condition
System.NotImplementedException
View Source

New()

Creates a new descriptor using a fluent approach. This initial descriptor is worthless without adding features.

Declaration
public static Descriptor New()
Returns
Type Description
Descriptor

Empty Descriptor.

View Source

New(String)

Creates a new descriptor using a fluent approach. This initial descriptor is worthless without adding features.

Declaration
public static Descriptor New(string name)
Parameters
Type Name Description
System.String name

Desired name.

Returns
Type Description
Descriptor

Empty Named Descriptor.

View Source

New(Type)

Creates a new descriptor using a fluent approach. This initial descriptor is worthless without adding features.

Declaration
public static Descriptor New(Type type)
Parameters
Type Name Description
System.Type type

Type mapping.

Returns
Type Description
Descriptor

A Descriptor.

View Source

ToExamples(IEnumerable<Object>)

Converts a list of examples into a Matrix/Vector tuple.

Declaration
public ToExamples(IEnumerable<object> examples)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<System.Object> examples

Examples.

Returns
Type Description
System.

Tuple containing Matrix and Vector.

View Source

ToMatrix(IEnumerable<Object>)

Converts a list of examples into a Matrix.

Declaration
public Matrix ToMatrix(IEnumerable<object> examples)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<System.Object> examples

Examples.

Returns
Type Description
Matrix

Matrix representation.

View Source

ToString()

Pretty printed descriptor.

Declaration
public override string ToString()
Returns
Type Description
System.String

Pretty printed string.

Overrides
System.Object.ToString()
View Source

ToVector(Object)

Convert an object to its vector representation based on the descriptor properties.

Declaration
public Vector ToVector(object item)
Parameters
Type Name Description
System.Object item

object to convert.

Returns
Type Description
Vector

Vector representation.

View Source

With(String)

Adds a new feature to descriptor.

Declaration
public DescriptorProperty With(string name)
Parameters
Type Name Description
System.String name

Name of feature (must match property name or dictionary key)

Returns
Type Description
DescriptorProperty

method for describing feature.

  • View Source
©2017 — Seth Juarez
numl v0.9.20-beta
MIT License
docs by docfx