Agent skill

Teradata HNSW Vector Search

Approximate nearest neighbor search using HNSW algorithm

Stars 6
Forks 0

Install this agent skill to your Project

npx add-skill https://github.com/teradata-labs/claude-cookbooks/tree/main/skills/analytics/td-hnsw

SKILL.md

Teradata HNSW Vector Search

Property Value
Skill Name Teradata HNSW Vector Search
Description Approximate nearest neighbor search using HNSW algorithm
Category Vector Search
Primary Function HNSW
Framework MLE
- Minimum Version: Teradata 20.00

Core Capabilities

  • Automated table structure analysis via DBC.ColumnsV
  • Dynamic SQL generation for HNSW
  • Complete workflow from data preparation to results interpretation
  • Data quality validation and preprocessing guidance
  • Parameter optimization and tuning

Key Parameters

  • IDColumn: Unique vector identifier
  • TargetColumns: Column(s) containing vector data
  • M: Connections per layer (default 16)
  • EfConstruction: Build-time search width (default 200)
  • DistanceMetric: 'COSINE', 'EUCLIDEAN', 'INNERPRODUCT'
  • TopK: Number of nearest neighbors to return (Predict)
  • EfSearch: Search-time accuracy parameter (Predict)

Use Cases

  1. Semantic similarity search
  2. Recommendation systems
  3. Image/document retrieval
  4. RAG (Retrieval-Augmented Generation)
  5. Duplicate detection

Example Usage

sql
-- HNSW execution
SELECT * FROM HNSW (
    ON {USER_DATABASE}.{VECTOR_TABLE} AS InputTable
    USING
    IDColumn ('{ID_COLUMN}')
    TargetColumns ('{VECTOR_COLUMN}')
    M (16)                             -- Neighbors per layer
    EfConstruction (200)               -- Construction search size
    DistanceMetric ('COSINE')          -- 'COSINE','EUCLIDEAN','INNERPRODUCT'
) AS dt;

Scripts Included

Core Analytics Scripts

  • table_analysis.sql: Automatic table structure discovery
  • preprocessing.sql: Data preparation and feature engineering
  • model_training.sql: HNSW execution
  • evaluation.sql: Results analysis and metrics
  • complete_workflow_template.sql: End-to-end workflow

Utility Scripts

  • data_quality_checks.sql: Comprehensive data validation
  • parameter_tuning.sql: Parameter optimization
  • diagnostic_queries.sql: Results diagnostics and interpretation

Best Practices

  • Always run table_analysis.sql first to understand your data structure
  • Validate data quality before executing the analytical function
  • Use parameter_tuning.sql to find optimal configuration
  • Review diagnostic_queries.sql output for model/results validation

Limitations

  • Requires Teradata Vantage 20.00+ with ClearScape Analytics
  • Input data must meet function-specific requirements
  • Results depend on data quality and parameter configuration

Teradata HNSW Vector Search - ClearScape Analytics skill for Teradata Vantage

Expand your agent's capabilities with these related and highly-rated skills.

Didn't find tool you were looking for?

Be as detailed as possible for better results