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

地方门户类网站智慧团建官网手机版

地方门户类网站,智慧团建官网手机版,外贸谷歌seo,中国网站排名站长之家流程 milvus的使用流程是 创建collection - 创建partition - 创建索引(如果需要检索) - 插入数据 - 检索 这里以Python为例, 使用的milvus版本为2.3.x 首先按照库#xff0c; python3 -m pip install pymilvus Connect from pymilvus import connections c…流程 milvus的使用流程是 创建collection - 创建partition - 创建索引(如果需要检索) - 插入数据 - 检索 这里以Python为例, 使用的milvus版本为2.3.x 首先按照库 python3 -m pip install pymilvus Connect from pymilvus import connections connections.connect(aliasdefault,userusername,passwordpassword,hostlocalhost,port19530 )connections.list_connections() connections.get_connection_addr(default)connections.disconnect(default)以上是源码可以看出alias只是一个字典的映射的key 通过源码可以看到还有两种连接方式: 在.env文件中添加参数MILVUS_URImilvus://Your_Host:Your_Port之后可以使用connections.connect()连接在一次连接成功后将连接配置数据保存在内存下次近执行connections.connect()即可连接可以通过connections.remove_connection删除连接配置数据 Database from pymilvus import connections, dbconn connections.connect(host127.0.0.1, port19530)database db.create_database(book)db.using_database(book) # 切换数据库 db.list_database() db.drop_database(book)Collection 和一些非关系型数据库(MongoDB)类似Collection就是表 # collection from pymilvus import Collection, CollectionSchema, FieldSchema, DataType, utility## 需要提前创建列的名称、类型等数据并且必须添加一个主键 book_id FieldSchema(namebook_id,dtypeDataType.INT64,is_primaryTrue, ) book_name FieldSchema(namebook_name,dtypeDataType.VARCHAR,max_length200,# The default value will be used if this field is left empty during data inserts or upserts.# The data type of default_value must be the same as that specified in dtype.default_valueUnknown ) word_count FieldSchema(nameword_count,dtypeDataType.INT64,# The default value will be used if this field is left empty during data inserts or upserts.# The data type of default_value must be the same as that specified in dtype.default_value9999 ) book_intro FieldSchema(namebook_intro,dtypeDataType.FLOAT_VECTOR,dim2 ) # dim2是向量的维度schema CollectionSchema(fields[book_id, book_name, word_count, book_intro],descriptionTest book search,enable_dynamic_fieldTrue )collection_name bookcollection Collection(namecollection_name,schemaschema,usingdefault,shards_num2)utility.rename_collection(book, lights4) utility.has_collection(lights1) utility.list_collections() # utility.drop_collection(lights)collection Collection(lights3) collection.load(replica_number2) # reduce memory usage collection.release()Partition # Create a Partitioncollection Collection(book) # Get an existing collection. collection.create_partition(novel)Index milvus的索引决定了搜索所用的算法必须设置好所引才能进行搜索。 # Index index_params {metric_type:L2,index_type:IVF_FLAT,params:{nlist:1024} }collection.create_index(field_namebook_intro, index_paramsindex_params )## metric_type是相似性计算算法可选的有以下 ## For floating point vectors: ## L2 (Euclidean distance) ## IP (Inner product) ## COSINE (Cosine similarity) ## For binary vectors: ## JACCARD (Jaccard distance) ## HAMMING (Hamming distance) utility.index_building_progress(Your_Collection)Data 数据可以从dataFrame来也可以从其他方式获得只要列名对上即可。 import pandas as pd import numpy as npinsert_data pd.read_csv(Your_File) mr collection.insert(insert_data)Search # search search_params {metric_type: L2, offset: 5, ignore_growing: False, params: {nprobe: 10} }results collection.search(data[[0.1, 0.2]], anns_fieldbook_intro, # the sum of offset in param and limit # should be less than 16384.paramsearch_params,limit10,exprNone,# 这里需要将想看的列名列举出来output_fields[title],consistency_levelStrong )# get the IDs of all returned hits results[0].ids# get the distances to the query vector from all returned hits results[0].distances# get the value of an output field specified in the search request. hit results[0][0] hit.entity.get(title)具体的代码在我的github。希望对你有所帮助
http://www.huolong8.cn/news/210593/

相关文章:

  • 软件开发流程培训深圳网站seo教程
  • 国外做3d模型的网站上海网站建设市场分析
  • 做网站需要会的软件中英文网站模板源码
  • 网站布局怎么写wordpress主题修改
  • 最好的网站设计公相城区建设局网站
  • 网站设计与开发培训贵阳百度快照优化排名
  • 便利的龙岗网站设计商城网站除了域名备案还要
  • wordpress4.6字体seo网站优化方案案例
  • 如何给客户更好的做网站分析怎么恢复wordpress设定值
  • 网站设计的目的那些网站专门做棋牌推广的
  • 用ps做糖果店网站模板上海seo搜索优化
  • 上海网站建设定制开发群晖wordpress 外网很慢
  • 专业制作开发公司网站怎么在网站做gif
  • 做网站的数据库的步骤有知道做网站的吗
  • 佛山企业网站自助建站开发游戏需要多少钱
  • 电脑做视频的网站吗湖南做电商网站需要什么条件
  • 如何设置wordpress不自动更新开封做网站优化
  • 对网站建设有什么样好的建设意见网站推广营销方案
  • 海口招商建设有限公司网站济南正规的网站制作
  • 富平做网站安国市城乡建设局网站
  • 做美食网站的需求深圳哪里网站制作
  • 建外贸网站哪个好设计网站多少费用多少
  • 用钢铁侠做网站沈阳搜索排名公司
  • wordpress设置301重定向杭州企业seo网站优化
  • 深圳建设工程协会网站wordpress手机中文版下载
  • 外贸网站制作设计小程序是什么时候开始的
  • 通过apache建设网站如何建立自己的公司网站
  • 网站更换域名备案一级造价师注册查询系统平台入口
  • win7如何安装iis来浏览asp网站wordpress 不同分类 不同主题
  • sap和国家网站做接口国家工商企业查询