Table of Contents

Class VectorHelper

Namespace
AiDotNet.Helpers
Assembly
AiDotNet.dll

Provides helper methods for creating and manipulating vectors used in AI and machine learning operations.

public static class VectorHelper
Inheritance
VectorHelper
Inherited Members

Remarks

For Beginners: In AI and machine learning, a vector is simply a list of numbers arranged in a specific order. Think of it as a one-dimensional array or a single column/row of data. Vectors are used to represent:

  • Features of a single data point (like height, weight, age of a person)
  • Target values we want to predict
  • Weights in a trained model
  • Intermediate calculations during model training

This helper class provides convenient methods to work with vectors in your AI applications.

Methods

CreateVector<T>(int)

Creates a new vector with the specified size.

public static Vector<T> CreateVector<T>(int size)

Parameters

size int

The number of elements in the vector.

Returns

Vector<T>

A new vector initialized with default values.

Type Parameters

T

The numeric type of the vector elements (e.g., double, float).

Remarks

For Beginners: This method creates an empty vector with a specific length. For example, if you need a vector to store 5 values, you would call:

var myVector = VectorHelper.CreateVector<double>(5);

This creates a vector that can hold 5 double values, initially set to 0. You can then assign values to individual elements using indexing:

myVector[0] = 10.5;
myVector[1] = 20.3;