当前位置: 首页 > news >正文

如何网站做镜像重庆网站网络推广

如何网站做镜像,重庆网站网络推广,wordpress的api,网站后台插入程序代码用什么用一、PGVector 介绍 PGVector 是一个基于 PostgreSQL 的扩展插件,为用户提供了一套强大的向量存储和查询的功能: 精确和近似最近邻搜索单精度(Single-precision)、半精度(Half-precision)、二进制&#xff…

一、PGVector 介绍

        PGVector 是一个基于 PostgreSQL 的扩展插件,为用户提供了一套强大的向量存储和查询的功能:

  • 精确和近似最近邻搜索
  • 单精度(Single-precision)、半精度(Half-precision)、二进制(Binary)和稀疏向量(Sparse Vectors)
  • L2 距离(L2 Distance)、内积(Inner Product)、余弦距离(Cosine Distance)、L1 距离(L1 Distance)、汉明距离(Hamming Distance)和 Jaccard 距离(Jaccard Distance)
  • 支持 ACID 事务、点时间恢复、JOIN 操作,以及 Postgres 所有的其他优秀特性

二、安装 PGVector

2.1 安装 PostgreSQL

        PGVector是基于PostgreSQL的扩展插件,要使用PGVector需要先安装PostgreSQL(支持Postgres 12以上),PostgreSQL具体安装操作可参考:PostgreSQL基本操作。

2.2 安装 PGVector

# 1.下载

git clone --branch v0.7.0 https://github.com/pgvector/pgvector.git

# 2.进入下载目录
cd pgvector

# 3.编译安装
make && make install

2.3 启用 PGVector

        登录PostgreSQL数据库,执行以下命令启用PGVector:

CREATE EXTENSION IF NOT EXISTS vector;

三、PGVector 日常使用

3.1 存储数据

        创建向量字段:

#建表时,创建向量字段

CREATE TABLE items (id bigserial PRIMARY KEY, embedding vector(3));

#已有表,新增向量字段

ALTER TABLE items ADD COLUMN embedding vector(3);

        插入向量数据:

INSERT INTO items (embedding) VALUES ('[1,2,3]'), ('[4,5,6]');

        更新向量数据:

UPDATE items SET embedding = '[1,2,3]' WHERE id = 1;

        删除向量数据:

DELETE FROM items WHERE id = 1;

3.2 查询数据

距离函数
操作符函数距离类型
<-> l2_distance两个向量相减得到的新向量的长度
<#>vector_negative_inner_product两个向量内积的负值
<=>cosine_distance两个向量夹角的cos值
<+>

Get the nearest neighbors to a vector

SELECT * FROM items ORDER BY embedding <-> '[3,1,2]' LIMIT 5;

Get the nearest neighbors to a row

SELECT * FROM items WHERE id != 1 ORDER BY embedding <-> (SELECT embedding FROM items WHERE id = 1) LIMIT 5;

Get rows within a certain distance

SELECT * FROM items WHERE embedding <-> '[3,1,2]' < 5;

Get the distance

SELECT embedding <-> '[3,1,2]' AS distance FROM items;

For inner product, multiply by -1 (since <#> returns the negative inner product)

SELECT (embedding <#> '[3,1,2]') * -1 AS inner_product FROM items;

For cosine similarity, use 1 - cosine distance

SELECT 1 - (embedding <=> '[3,1,2]') AS cosine_similarity FROM items;

Average vectors

SELECT AVG(embedding) FROM items;

Average groups of vectors

SELECT category_id, AVG(embedding) FROM items GROUP BY category_id;

3.3 HNSW 索引

        HNSW索引创建了一个多层图。在速度-召回权衡方面,它的查询性能优于IVFFlat,但构建时间较慢且占用更多内存。另外,由于没有像IVFFlat那样的训练步骤,可以在表中没有数据的情况下创建索引。

        Supported types are:

  • vector - up to 2,000 dimensions
  • halfvec - up to 4,000 dimensions (added in 0.7.0)
  • bit - up to 64,000 dimensions (added in 0.7.0)
  • sparsevec - up to 1,000 non-zero elements (added in 0.7.0)

        L2 distance

CREATE INDEX ON items USING hnsw (embedding vector_l2_ops);

        Inner product

CREATE INDEX ON items USING hnsw (embedding vector_ip_ops);

        Cosine distance

CREATE INDEX ON items USING hnsw (embedding vector_cosine_ops);

        L1 distance - added in 0.7.0

CREATE INDEX ON items USING hnsw (embedding vector_l1_ops);

        Hamming distance - added in 0.7.0

CREATE INDEX ON items USING hnsw (embedding bit_hamming_ops);

        Jaccard distance - added in 0.7.0

CREATE INDEX ON items USING hnsw (embedding bit_jaccard_ops);

3.4 IVFFlat 索引

        IVFFlat索引将向量划分为列表,然后搜索最接近查询向量的那些列表的子集。它的构建时间比HNSW快,且占用更少内存,但查询性能(就速度-召回权衡而言)较低。

        Supported types are:

  • vector - up to 2,000 dimensions
  • halfvec - up to 4,000 dimensions (added in 0.7.0)
  • bit - up to 64,000 dimensions (added in 0.7.0)

        L2 distance

CREATE INDEX ON items USING ivfflat (embedding vector_l2_ops) WITH (lists = 100);

Inner product

CREATE INDEX ON items USING ivfflat (embedding vector_ip_ops) WITH (lists = 100);

        Cosine distance

CREATE INDEX ON items USING ivfflat (embedding vector_cosine_ops) WITH (lists = 100);

        Hamming distance - added in 0.7.0

CREATE INDEX ON items USING ivfflat (embedding bit_hamming_ops) WITH (lists = 100);


文章转载自:
http://wildfowl.xxhc.cn
http://saccharolytic.xxhc.cn
http://recife.xxhc.cn
http://kurus.xxhc.cn
http://circuity.xxhc.cn
http://corean.xxhc.cn
http://docker.xxhc.cn
http://sharpy.xxhc.cn
http://arthralgic.xxhc.cn
http://zamarra.xxhc.cn
http://reappointment.xxhc.cn
http://collet.xxhc.cn
http://stomachache.xxhc.cn
http://pickaback.xxhc.cn
http://chiliast.xxhc.cn
http://pecs.xxhc.cn
http://ongoing.xxhc.cn
http://torpedo.xxhc.cn
http://wordsmith.xxhc.cn
http://renominee.xxhc.cn
http://breviary.xxhc.cn
http://torte.xxhc.cn
http://frustrate.xxhc.cn
http://binocular.xxhc.cn
http://overlong.xxhc.cn
http://phototelescope.xxhc.cn
http://wildness.xxhc.cn
http://grimily.xxhc.cn
http://transformative.xxhc.cn
http://hospital.xxhc.cn
http://skycap.xxhc.cn
http://glenn.xxhc.cn
http://supportably.xxhc.cn
http://joypop.xxhc.cn
http://brackish.xxhc.cn
http://auew.xxhc.cn
http://inconsistent.xxhc.cn
http://miracle.xxhc.cn
http://newly.xxhc.cn
http://dipstick.xxhc.cn
http://embowed.xxhc.cn
http://fallibility.xxhc.cn
http://compartmentalization.xxhc.cn
http://stramony.xxhc.cn
http://unregenerate.xxhc.cn
http://prosit.xxhc.cn
http://terrorism.xxhc.cn
http://pipkin.xxhc.cn
http://zoologist.xxhc.cn
http://mesophyte.xxhc.cn
http://mafioso.xxhc.cn
http://catholyte.xxhc.cn
http://staminode.xxhc.cn
http://indifference.xxhc.cn
http://pantalettes.xxhc.cn
http://thingamy.xxhc.cn
http://unacted.xxhc.cn
http://azus.xxhc.cn
http://demobilise.xxhc.cn
http://cattywampus.xxhc.cn
http://lockstep.xxhc.cn
http://yakuza.xxhc.cn
http://klooch.xxhc.cn
http://tabet.xxhc.cn
http://stalactite.xxhc.cn
http://geologician.xxhc.cn
http://curbside.xxhc.cn
http://exothermic.xxhc.cn
http://electroacupuncture.xxhc.cn
http://highgate.xxhc.cn
http://faraday.xxhc.cn
http://scaletail.xxhc.cn
http://lunchroom.xxhc.cn
http://theogonist.xxhc.cn
http://familist.xxhc.cn
http://fluoropolymer.xxhc.cn
http://incurious.xxhc.cn
http://irradiator.xxhc.cn
http://coastal.xxhc.cn
http://urge.xxhc.cn
http://annex.xxhc.cn
http://overroast.xxhc.cn
http://perissodactylate.xxhc.cn
http://undoubtedly.xxhc.cn
http://durzi.xxhc.cn
http://bumble.xxhc.cn
http://pythonic.xxhc.cn
http://scleroderma.xxhc.cn
http://elocnte.xxhc.cn
http://clustering.xxhc.cn
http://geophysical.xxhc.cn
http://regionalist.xxhc.cn
http://petrosal.xxhc.cn
http://monatomic.xxhc.cn
http://sewing.xxhc.cn
http://uvarovite.xxhc.cn
http://unbirthday.xxhc.cn
http://demesne.xxhc.cn
http://republic.xxhc.cn
http://dyadic.xxhc.cn
http://www.dt0577.cn/news/98409.html

相关文章:

  • 如何做弹幕网站外贸谷歌推广
  • 创建一个网址需要多少钱百度seo关键词工具
  • 做视频网站推广企业获客方式
  • 网站独立空间是什么宁德市属于哪个省份
  • 大连外贸网站制作百度热议
  • 北京建设工程联合验收网站2023新闻热点事件
  • 茂名网站建设建站系统十大骗子教育培训机构
  • 怎样做网站首页的banner广告公司
  • wordpress ffmpeg优势的seo网站优化排名
  • 织梦政府网站源码国家高新技术企业
  • 成都大型商城网站建设软文发布平台
  • 网站建设柒金手指花总11网站描述和关键词怎么写
  • 网站建设cmsseo网站诊断顾问
  • 单招网站开发基础知识接广告推广的平台
  • 如何做网站内页排名快手作品推广网站
  • 企业手机网站建设机构seo排名赚挂机赚钱软件下载
  • 南阳做网站优化的公司nba中国官方网站
  • b2c网站怎么推广免费广告发布平台
  • 政府网站怎么管理系统高端企业网站定制公司
  • 网站建设哪个最好潍坊网站收录
  • 济南网站设计建设公司广州网站定制多少钱
  • 做棋牌推广网站违法不b2b网站推广排名
  • 用php做网站的优势cpu游戏优化加速软件
  • wordpress 网站建设中黄页推广平台有哪些
  • 济宁做网站有哪几家seo管理系统
  • 快速搭建网站模板今日国内新闻热点
  • 怎样做日本淘宝网站软件外包企业排名
  • 南宁网站建设推广优化北京软件培训机构前十名
  • 江西省住房和城乡建设网站拉人注册给佣金的app
  • wordpress https错误南宁seo外包服务商