CoolFace
Datasetpublic

keisuke-miyako/text-commands-2026-0423

Classes Clean summary of 4D object language reference. Example As of 4D version 21, the Vector class is a built-in component of the 4D language, designed to facilitate the handling of vectors and the execution of distance and similarity calculations between them. This class is accessible via the 4D class store and is particularly relevant in the context of artificial intelligence, where vectors—sequences of numerical values—serve as foundational representations… See the full description on the dataset page: https://huggingface.co/datasets/keisuke-miyako/text-commands-2026-0423.

sourceHugging Facemitupdated 5mo agoView on Hugging Face
0likes124downloads
Dataset Card

Classes

Clean summary of 4D object language reference.

Example

As of 4D version 21, the Vector class is a built-in component of the 4D language, designed to facilitate the handling of vectors and the execution of distance and similarity calculations between them. This class is accessible via the 4D class store and is particularly relevant in the context of artificial intelligence, where vectors—sequences of numerical values—serve as foundational representations for complex data, enabling machines to interpret and manipulate such data effectively.\n\n### Overview of Vector Computations\nThe 4D.Vector class supports three primary types of vector computations, each suited to distinct analytical needs. Below is a detailed explanation of these computations, their definitions, use cases, and analogies for clarity:\n\n1. Cosine Similarity\n - Definition: Cosine similarity evaluates the orientation of two vectors by measuring the cosine of the angle between them. This metric is indifferent to the magnitude (or length) of the vectors and focuses solely on their direction. Vectors pointing in the same direction yield a high cosine similarity, regardless of their individual magnitudes.\n - Analogy: Consider a scenario where you are selecting movies on a streaming platform. Cosine similarity compares your preferences (e.g., a fondness for action-comedy films) with the descriptions of movies in the platform’s database. The similarity is determined by how closely the characteristics of the movies align with your tastes, irrespective of how frequently you watch movies (i.e., the magnitude of your engagement).\n - Use Case: This computation is ideal for text embeddings, document comparisons, semantic search, and text classification, where the semantic alignment of data is more critical than its scale.\n - Returned Value: The result ranges from -1 (indicating opposite directions) to 1 (indicating identical directions). Higher values denote greater similarity.\n\n2. Dot Product Similarity\n - Definition: The dot product similarity calculates the sum of the products of corresponding components of two vectors. Unlike cosine similarity, this metric is sensitive to both the direction and magnitude of the vectors, effectively serving as a weighted compatibility score.\n - Analogy: Imagine using a search engine to look up \"chocolate cake recipe.\" The dot product can assess not only whether a webpage discusses chocolate cakes (directional similarity) but also the depth of its content (magnitude). A webpage with extensive, detailed information about chocolate cakes will score higher than one with only a brief mention.\n - Use Case: This computation is recommended for models where vector magnitudes are meaningful, such as recommendation engines or relevance scoring systems.\n - Returned Value: The result is dependent on both the magnitudes and directions of the vectors. Higher values indicate greater similarity.\n\n3. Euclidean Distance\n - Definition: Euclidean distance measures the straight-line distance between two vectors in a multi-dimensional space. This metric accounts for all differences between vector components, providing a literal measure of how far apart the vectors are.\n - Analogy: In a dating application, Euclidean distance could be used to compare user profiles based on interests, age, location, and other attributes. If two users share similar interests (e.g., hiking, pop music) and live close to each other, the Euclidean distance between their profiles will be small, suggesting a strong match.\n - Use Case: This computation is well-suited for numeric or structured data embeddings, particularly when the proximity of data points in the vector space directly correlates with their similarity.\n - Returned Value: The result is a non-negative real number. Lower values indicate greater similarity between vectors.\n\nIt is advisable to experiment with these computations to determine which best aligns with your specific data and requirements.\n\n### Vector Object Properties and Methods\nVector objects in 4D are characterized as shared, immutable, and streamable, ensuring consistency and reliability in multi-user and distributed environments.\n\n#### 4D.Vector.new()\n- Availability: This function was introduced in 4D version 20 R10.\n- Purpose: The 4D.Vector.new() function creates and returns a new 4D.Vector object.\n- Parameters:\n - parameter (Collection of reals): A collection of real numbers representing the vector to be created. These values are typically generated by artificial intelligence systems and mathematically represent objects such as words or datasets.\n- Return Value: A new 4D.Vector object.\n- Example: To create a vector, pass a collection of real numbers to 4D.Vector.new(). Individual components of the vector can be accessed directly, or the entire vector can be converted back to a collection using the .toCollection() method.\n\n#### .cosineSimilarity()\n- Purpose: This function calculates the cosine similarity between the current vector and another vector provided as a parameter.\n- Parameters:\n - vector (4D.Vector): The vector to compare with the current vector. Both vectors must be of the same size.\n- Return Value: A real number representing the cosine similarity, ranging from -1 to 1.\n- Syntax: Vector.cosineSimilarity(vector: 4D.Vector): Real\n\n#### .dotSimilarity()\n- Purpose: This function calculates the dot product between the current vector and another vector provided as a parameter.\n- Parameters:\n - vector (4D.Vector): The vector to compare with the current vector. Both vectors must be of the same size.\n- Return Value: A real number representing the dot product, which varies based on the magnitudes and directions of the vectors.\n- Syntax: Vector.dotSimilarity(vector: 4D.Vector): Real\n\n#### .euclideanDistance()\n- Purpose: This function calculates the Euclidean distance between the current vector and another vector provided as a parameter.\n- Parameters:\n - vector (4D.Vector): The vector to compare with the current vector. Both vectors must be of the same size.\n- Return Value: A non-negative real number representing the Euclidean distance. Lower values indicate greater similarity.\n- Syntax: Vector.euclideanDistance(vector: 4D.Vector): Real\n\n#### .length\n- Purpose: This property returns the number of components in the vector.\n- Return Value: An integer representing the vector's dimensionality.\n\n#### .toCollection()\n- Purpose: This function converts the vector into a collection of real numbers, representing its components.\n- Return Value: A collection of real numbers.\n- Syntax: Vector.toCollection(): Collection\n\n### Version History\n- The Vector class was introduced in 4D version 20 R10 with the 4D.Vector.new() function.