CategoricalVariable Class

Represents a statistical variable that can take on one of a fixed number of possible values.

Definition

Namespace: Novacta.Analytics
Assembly: Novacta.Analytics (in Novacta.Analytics.dll) Version: 2.1.0+428f3840cfab98dda567bb0ed350b302533e273a
C#
public class CategoricalVariable : IEnumerable<Category>, 
	IEnumerable
Inheritance
Object    CategoricalVariable
Implements
IEnumerableCategory, IEnumerable

Remarks

Instantiation

You can instantiate a CategoricalVariable object by calling its constructor. See the CategoricalVariable constructor summary.

Categories

Each of the possible values of a categorical variable is represented by an instance of type Category. Categories can be added to or removed from a given categorical variable, provided that it wasn't set as read-only by calling SetAsReadOnly. This condition can be verified by inspecting property IsReadOnly. Categories must be identifiable, both by their Code and by their Label. As a consequence, a category can be added only if, in the given categorical variable, no other category already exists having the same code or the same label. Furthermore, a category can be removed by passing its code to method Remove(Double), or its label to method Remove(String).

Use property NumberOfCategories to know how many categories are currently associated to a given variable. Property Categories lists category instances. Category codes, or labels, can be enumerated by inspecting, respectively, properties CategoryCodes and CategoryLabels.

You can verify if a category is in the variable by passing its code to method TryGet(Double, Category), or its label to method TryGet(String, Category).

Constructors

CategoricalVariable Initializes a new instance of the CategoricalVariable class having the specified name.

Properties

Categories Exposes the list of categories in the CategoricalVariable.
CategoryCodes Exposes the enumerator which iterates over the collection of category codes in the CategoricalVariable.
CategoryLabels Exposes the enumerator which iterates over the collection of category labels in the CategoricalVariable.
IsReadOnly Gets a value indicating whether this instance is read only.
Name Gets or sets the variable name.
NumberOfCategories Gets the number of categories.

Methods

Add(Double) Adds a category having the specified code and a default label to the CategoricalVariable.
Add(Double, String) Adds a category having the specified code and label to the CategoricalVariable.
EqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
FinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object)
FromDoubleMatrix Converts from DoubleMatrix to CategoricalVariable.
GetEnumeratorReturns an enumerator that iterates through the collection.
GetHashCodeServes as the default hash function.
(Inherited from Object)
GetTypeGets the Type of the current instance.
(Inherited from Object)
MemberwiseCloneCreates a shallow copy of the current Object.
(Inherited from Object)
Remove(Double) Removes the category having the specified code from the CategoricalVariable.
Remove(String) Removes the category having the specified label from the CategoricalVariable.
SetAsReadOnly Sets the CategoricalVariable as read only.
ToDoubleMatrix Converts from CategoricalVariable to DoubleMatrix.
ToString Returns a String that represents this instance.
(Overrides ObjectToString)
TryGet(Double, Category) Tries to get the category corresponding to a given code.
TryGet(String, Category) Tries to get the category corresponding to a given label.

Operators

(CategoricalVariable to DoubleMatrix) Performs an explicit conversion from CategoricalVariable to DoubleMatrix.
(DoubleMatrix to CategoricalVariable) Performs an explicit conversion from DoubleMatrix to CategoricalVariable.

Explicit Interface Implementations

IEnumerableGetEnumeratorReturns an enumerator that iterates through a collection.

See Also