Skip to content

Commit a9ef42e

Browse files
committed
Milvus integrated
1 parent 58edfcd commit a9ef42e

File tree

12 files changed

+453
-1051
lines changed

12 files changed

+453
-1051
lines changed

examples/1. Vanilla RL/2. DDPG.ipynb

+33-113
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": 1,
6+
"outputs": [
7+
{
8+
"name": "stderr",
9+
"output_type": "stream",
10+
"text": [
11+
"/ssd/anaconda/envs/recnn/lib/python3.8/site-packages/tqdm/std.py:670: FutureWarning: The Panel class is removed from pandas. Accessing it from the top-level namespace will also be removed in the next version\n",
12+
" from pandas import Panel\n"
13+
]
14+
}
15+
],
16+
"source": [
17+
"from milvus import Milvus, IndexType, MetricType, Status\n",
18+
"\n",
19+
"# == recnn ==\n",
20+
"import sys\n",
21+
"sys.path.append(\"../../../\")\n",
22+
"import recnn"
23+
],
24+
"metadata": {
25+
"collapsed": false,
26+
"pycharm": {
27+
"name": "#%%\n"
28+
}
29+
}
30+
},
31+
{
32+
"cell_type": "code",
33+
"source": [
34+
"\n",
35+
"frame_size = 10\n",
36+
"batch_size = 1\n",
37+
"# embeddgings: https://drive.google.com/open?id=1EQ_zXBR3DKpmJR3jBgLvt-xoOvArGMsL\n",
38+
"dirs = recnn.data.env.DataPath(\n",
39+
" base=\"../../../data/\",\n",
40+
" embeddings=\"embeddings/ml20_pca128.pkl\",\n",
41+
" ratings=\"ml-20m/ratings.csv\",\n",
42+
" cache=\"cache/frame_env.pkl\", # cache will generate after you run\n",
43+
" use_cache=True\n",
44+
")\n",
45+
"env = recnn.data.env.FrameEnv(dirs, frame_size, batch_size)\n",
46+
"\n",
47+
"from recnn.data.db_con import MilvusConnection\n",
48+
"milvus = MilvusConnection(env)\n",
49+
"\n",
50+
"import numpy as np\n",
51+
"q_records = np.random.rand(3, 128)\n",
52+
"\n",
53+
"results = milvus.search(q_records)"
54+
],
55+
"metadata": {
56+
"collapsed": false,
57+
"pycharm": {
58+
"name": "#%%\n"
59+
}
60+
},
61+
"execution_count": 3,
62+
"outputs": []
63+
},
64+
{
65+
"cell_type": "code",
66+
"execution_count": 4,
67+
"outputs": [
68+
{
69+
"data": {
70+
"text/plain": "tensor([[21268, 1287, 23734, 22477, 19162, 14730, 1705, 22382, 14789, 18980],\n [21268, 1287, 23734, 22477, 1705, 14730, 19162, 18980, 22382, 14789],\n [21268, 1287, 23734, 22477, 19162, 14730, 1705, 22382, 14789, 22131]])"
71+
},
72+
"execution_count": 4,
73+
"metadata": {},
74+
"output_type": "execute_result"
75+
}
76+
],
77+
"source": [
78+
"results"
79+
],
80+
"metadata": {
81+
"collapsed": false,
82+
"pycharm": {
83+
"name": "#%%\n"
84+
}
85+
}
86+
},
87+
{
88+
"cell_type": "code",
89+
"execution_count": null,
90+
"outputs": [],
91+
"source": [],
92+
"metadata": {
93+
"collapsed": false,
94+
"pycharm": {
95+
"name": "#%%\n"
96+
}
97+
}
98+
}
99+
],
100+
"metadata": {
101+
"kernelspec": {
102+
"display_name": "Python 3",
103+
"language": "python",
104+
"name": "python3"
105+
},
106+
"language_info": {
107+
"codemirror_mode": {
108+
"name": "ipython",
109+
"version": 2
110+
},
111+
"file_extension": ".py",
112+
"mimetype": "text/x-python",
113+
"name": "python",
114+
"nbconvert_exporter": "python",
115+
"pygments_lexer": "ipython2",
116+
"version": "2.7.6"
117+
}
118+
},
119+
"nbformat": 4,
120+
"nbformat_minor": 0
121+
}

examples/[Results]/2. Diversity Test (Indexes).ipynb

+101-629
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)