five

keisuke-miyako/text-commands-2026-0423

收藏
Hugging Face2026-04-22 更新2026-04-26 收录
下载链接:
https://hf-mirror.com/datasets/keisuke-miyako/text-commands-2026-0423
下载链接
链接失效反馈
官方服务:
资源简介:
--- configs: - config_name: default data_files: - split: train path: "*.jsonl" license: mit language: - en --- # 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.

--- 配置项: - 配置名称:default 数据文件: - 拆分方式:训练集(train) 路径:"*.jsonl" 许可证:MIT 语言: - 英语(en) --- # 类 4D对象语言参考的简洁汇总。 ## 示例 自4D 21版本起,`Vector`类为4D语言的内置组件,旨在简化向量处理及向量间距离与相似度计算的执行流程。该类可通过4D类存储访问,在人工智能领域尤为关键:向量作为数值序列,是复杂数据的基础表征形式,可助力机器高效解读与操作此类数据。 ### 向量计算概述 `4D.Vector`类支持三类核心向量计算,分别适配不同的分析需求。下文将详细阐释这些计算方法的定义、适用场景与类比说明,以便清晰理解: 1. **余弦相似度(Cosine Similarity)** - **定义**:余弦相似度通过测量两个向量间夹角的余弦值,评估二者的方向相关性。该指标不关注向量的模长(即长度),仅聚焦于方向。方向一致的向量无论各自模长如何,均可获得较高的余弦相似度。 - **类比**:假设你正在流媒体平台挑选影片,余弦相似度可将你的观影偏好(如偏爱动作喜剧片)与平台数据库中影片的描述进行比对,相似度由影片特征与你喜好的契合程度决定,与你观影的频率(即参与度的模长)无关。 - **适用场景**:该计算方法适用于文本嵌入、文档比对、语义搜索及文本分类等场景,此类任务中数据的语义对齐比数据规模更为关键。 - **返回值**:结果取值范围为-1(表示方向完全相反)至1(表示方向完全一致),数值越高代表相似度越高。 2. **点积相似度(Dot Product Similarity)** - **定义**:点积相似度通过计算两个向量对应分量乘积的和得到结果。与余弦相似度不同,该指标同时关注向量的方向与模长,本质上是一种加权兼容度评分。 - **类比**:假设使用搜索引擎检索「巧克力蛋糕食谱」,点积不仅可以判断网页是否提及巧克力蛋糕(方向相似度),还能评估其内容的详实程度(模长)。一篇详细介绍巧克力蛋糕制作的网页,得分将高于仅简要提及该主题的网页。 - **适用场景**:该计算方法推荐用于向量模长具备实际意义的模型,如推荐引擎或相关性评分系统。 - **返回值**:结果同时取决于向量的模长与方向,数值越高代表相似度越高。 3. **欧氏距离(Euclidean Distance)** - **定义**:欧氏距离用于衡量多维空间中两个向量间的直线距离,该指标会考虑向量分量间的所有差异,直观反映向量间的间距。 - **类比**:在交友应用中,欧氏距离可用于比对用户在兴趣、年龄、所在地等属性上的档案。若两位用户兴趣相近(如都喜欢徒步旅行、流行音乐)且居住地相距较近,二者档案间的欧氏距离将较小,代表匹配度较高。 - **适用场景**:该计算方法适用于数值型或结构化数据的嵌入任务,尤其当向量空间中数据点的邻近程度与相似度直接相关时。 - **返回值**:结果为非负实数,数值越低代表向量间相似度越高。 建议针对这些计算方法进行测试,以确定最适配您特定数据与需求的方案。 ### 向量对象的属性与方法 4D中的向量对象具备共享、不可变且可流式处理的特性,可在多用户与分布式环境中保障一致性与可靠性。 #### `4D.Vector.new()` - **可用性**:该函数于4D 20 R10版本首次推出。 - **用途**:`4D.Vector.new()`函数用于创建并返回一个新的`4D.Vector`对象。 - **参数**: - `parameter`(实数集合):用于表征待创建向量的实数集合。此类数值通常由人工智能系统生成,以数学形式表征单词或数据集等对象。 - **返回值**:一个新的`4D.Vector`对象。 - **示例**:若要创建向量,可向`4D.Vector.new()`传入实数集合。您可直接访问向量的单个分量,或通过`.toCollection()`方法将整个向量转换为实数集合。 #### `.cosineSimilarity()` - **用途**:该函数用于计算当前向量与作为参数传入的另一向量间的余弦相似度。 - **参数**: - `vector`(4D.Vector):用于与当前向量进行比对的向量,二者维度必须一致。 - **返回值**:代表余弦相似度的实数,取值范围为-1至1。 - **语法**:`Vector.cosineSimilarity(vector: 4D.Vector): Real` #### `.dotSimilarity()` - **用途**:该函数用于计算当前向量与作为参数传入的另一向量间的点积相似度。 - **参数**: - `vector`(4D.Vector):用于与当前向量进行比对的向量,二者维度必须一致。 - **返回值**:代表点积结果的实数,其取值取决于向量的模长与方向。 - **语法**:`Vector.dotSimilarity(vector: 4D.Vector): Real` #### `.euclideanDistance()` - **用途**:该函数用于计算当前向量与作为参数传入的另一向量间的欧氏距离。 - **参数**: - `vector`(4D.Vector):用于与当前向量进行比对的向量,二者维度必须一致。 - **返回值**:代表欧氏距离的非负实数,数值越低代表向量间相似度越高。 - **语法**:`Vector.euclideanDistance(vector: 4D.Vector): Real` #### `.length` - **用途**:该属性返回向量的分量数量。 - **返回值**:代表向量维度的整数。 #### `.toCollection()` - **用途**:该函数将向量转换为实数集合,用于表征其分量。 - **返回值**:实数集合。 - **语法**:`Vector.toCollection(): Collection` ### 版本历史 - `Vector`类于4D 20 R10版本随`4D.Vector.new()`函数首次推出。
提供机构:
keisuke-miyako
5,000+
优质数据集
54 个
任务类型
进入经典数据集
二维码
社区交流群

面向社区/商业的数据集话题

二维码
科研交流群

面向高校/科研机构的开源数据集话题

数据驱动未来

携手共赢发展

商业合作