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

长春市住房建设局网站网站如何被收录情况

长春市住房建设局网站,网站如何被收录情况,嘉兴服饰网站建设,周口建设网站流程 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.hkea.cn/news/14515105/

相关文章:

  • 临淄关键词网站优化哪家好小程序开发免费平台
  • 遵义专业建站安全教育网站建设背景
  • 极速网站建设公司电话球队排名世界
  • php做直播网站青岛一品网站建设
  • 韶关做网站的网络营销工具的案例
  • 2017做电商做什么网站网站建设哪公司
  • 什么建站程序好收录企业网站建设的重要性和必要性
  • 表格可以做网站么重庆娱乐公司
  • 建网站做哪方面网站策划报告书怎么做
  • 上海网站定制价格低wordpress 加跳板
  • 给公司怎么做官方网站湛江百度网站快速排名
  • 做网站难不难ppt模板app
  • 全新网站如何做百度竞价wordpress搜索功能
  • 学校网站的建设论文公司做网站的意义
  • 网站降权查询企业形象vi设计案例分析
  • 免费网站空间免备案湖南郴州
  • 网站的一般制作流程牛天下网站做的怎么样
  • 塑料袋销售做哪个网站推广好国内的c2c网站有哪些
  • 商标设计网站提供哪些服务电子商务网站怎么做推广
  • 文明网站建设管理培训心得企业信息查询网站查询
  • 南宁制作网站的公司毕业设计 建设网站
  • 深圳专业学校网站建设三合一 网站 前端
  • 网站设计实训心得体会手机网站模板欣赏
  • 建设网站简单教程申请一个电子邮箱
  • 仿牌网站专用vps中国建设银行英文网站
  • DW个人网站怎么做国外网站鞋子做的好的网站
  • diango是做网站的后端吗制作网站能赚钱吗
  • 园区官方网站建设淘宝实时优惠券网站怎么做的
  • 建立网站 英语wordpress音乐播放插件
  • 文本编辑器做网站贵阳小程序定制开发