Skip to content

Commit

Permalink
Merge pull request #1460 from jinhonglin-ryan/master
Browse files Browse the repository at this point in the history
movie recommendation updated with newer comments and deletion of load()
  • Loading branch information
zc277584121 authored Nov 11, 2024
2 parents 33af32d + 3a399ab commit d343e82
Showing 1 changed file with 73 additions and 44 deletions.
117 changes: 73 additions & 44 deletions bootcamp/tutorials/quickstart/movie_recommendation_with_milvus.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@
"metadata": {
"id": "E8LsgeBzDIv8",
"ExecuteTime": {
"end_time": "2024-10-28T03:58:17.790191Z",
"start_time": "2024-10-28T03:58:17.785125Z"
"end_time": "2024-11-10T04:43:29.331948Z",
"start_time": "2024-11-10T04:43:29.322790Z"
}
},
"outputs": [],
Expand All @@ -98,8 +98,8 @@
"metadata": {
"id": "aBOi2mvKDIv8",
"ExecuteTime": {
"end_time": "2024-10-28T03:58:19.501086Z",
"start_time": "2024-10-28T03:58:19.049909Z"
"end_time": "2024-11-10T04:43:29.739181Z",
"start_time": "2024-11-10T04:43:29.333409Z"
}
},
"outputs": [],
Expand All @@ -122,11 +122,11 @@
"cell_type": "code",
"execution_count": 3,
"metadata": {
"id": "4rXlQ29MDIv8",
"ExecuteTime": {
"end_time": "2024-10-28T02:52:31.594866Z",
"start_time": "2024-10-28T02:52:31.584663Z"
},
"id": "4rXlQ29MDIv8"
"end_time": "2024-11-10T04:43:29.746569Z",
"start_time": "2024-11-10T04:43:29.740806Z"
}
},
"outputs": [],
"source": [
Expand All @@ -147,13 +147,17 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 5,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "VUXhaRtQDIv8",
"outputId": "ac2c222b-9af3-4b64-d8dd-cf5b3fe2f376"
"outputId": "ac2c222b-9af3-4b64-d8dd-cf5b3fe2f376",
"ExecuteTime": {
"end_time": "2024-11-10T04:44:04.205921Z",
"start_time": "2024-11-10T04:44:03.187020Z"
}
},
"outputs": [],
"source": [
Expand All @@ -177,13 +181,13 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 6,
"metadata": {
"id": "eaBFyWQPDIv8",
"ExecuteTime": {
"end_time": "2024-10-28T02:52:32.123914Z",
"start_time": "2024-10-28T02:52:32.116018Z"
},
"id": "eaBFyWQPDIv8"
"end_time": "2024-11-10T04:44:06.851427Z",
"start_time": "2024-11-10T04:44:06.768643Z"
}
},
"outputs": [],
"source": [
Expand All @@ -198,25 +202,27 @@
"id": "rmt5EIn8DIv8"
},
"source": [
"Define the fields for the collection, which include the id, title, type, release year, rating, and description."
"Define the fields for the collection, which include the id, title, type, release year, rating, description, and embedding."
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 7,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "xf5YMsDmDIv8",
"outputId": "b26cb009-8a82-4cfd-9d76-db6323d0df69"
"outputId": "b26cb009-8a82-4cfd-9d76-db6323d0df69",
"ExecuteTime": {
"end_time": "2024-11-10T04:44:08.634998Z",
"start_time": "2024-11-10T04:44:08.631894Z"
}
},
"outputs": [],
"source": [
"from pymilvus import DataType\n",
"\n",
"# Create collection which includes the id, title, and embedding.\n",
"\n",
"# 1. Create schema\n",
"schema = MilvusClient.create_schema(\n",
" auto_id=True,\n",
Expand Down Expand Up @@ -247,34 +253,33 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 8,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "K9fwi332DIv8",
"outputId": "d9e1e36a-4830-491f-ce3b-be1974a363cf"
"outputId": "d9e1e36a-4830-491f-ce3b-be1974a363cf",
"ExecuteTime": {
"end_time": "2024-11-10T04:44:11.606543Z",
"start_time": "2024-11-10T04:44:11.097780Z"
}
},
"outputs": [],
"source": [
"# Create the index on the collection and load it.\n",
"\n",
"# 1. Prepare index parameters\n",
"index_params = client.prepare_index_params()\n",
"\n",
"\n",
"# 2. Add an index on the embedding field\n",
"index_params.add_index(\n",
" field_name=\"embedding\", metric_type=\"IP\", index_type=\"AUTOINDEX\", params={}\n",
")\n",
"\n",
"\n",
"# 3. Create index\n",
"client.create_index(collection_name=COLLECTION_NAME, index_params=index_params)\n",
"\n",
"\n",
"# 4. Load collection\n",
"client.load_collection(collection_name=COLLECTION_NAME, replica_number=1)"
"# 4. Load Collection\n",
"client.load_collection(collection_name=COLLECTION_NAME)"
]
},
{
Expand All @@ -289,7 +294,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 9,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
Expand Down Expand Up @@ -331,7 +336,11 @@
]
},
"id": "7pyst3ZBDIv8",
"outputId": "4f477b23-f190-4a36-905a-3884e40e70b9"
"outputId": "4f477b23-f190-4a36-905a-3884e40e70b9",
"ExecuteTime": {
"end_time": "2024-11-10T04:44:16.177399Z",
"start_time": "2024-11-10T04:44:13.214578Z"
}
},
"outputs": [],
"source": [
Expand All @@ -352,9 +361,13 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 10,
"metadata": {
"id": "YBi6ria2DIv8"
"id": "YBi6ria2DIv8",
"ExecuteTime": {
"end_time": "2024-11-10T04:44:16.183133Z",
"start_time": "2024-11-10T04:44:16.179165Z"
}
},
"outputs": [],
"source": [
Expand Down Expand Up @@ -406,10 +419,22 @@
"base_uri": "https://localhost:8080/"
},
"id": "hMIpsCJUDrO3",
"outputId": "957f4502-dc50-49cc-c534-f447a7451445"
"outputId": "957f4502-dc50-49cc-c534-f447a7451445",
"ExecuteTime": {
"end_time": "2024-11-10T04:44:50.716217Z",
"start_time": "2024-11-10T04:44:17.361030Z"
}
},
"execution_count": null,
"outputs": []
"execution_count": 11,
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"100%|██████████| 8807/8807 [00:33<00:00, 264.06it/s]\n"
]
}
]
},
{
"cell_type": "markdown",
Expand All @@ -423,42 +448,46 @@
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": 12,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "ohIMv8stDIv9",
"outputId": "67186ad6-3522-4f3f-c20d-c67693c05b5e"
"outputId": "67186ad6-3522-4f3f-c20d-c67693c05b5e",
"ExecuteTime": {
"end_time": "2024-11-10T04:44:51.025459Z",
"start_time": "2024-11-10T04:44:50.720202Z"
}
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"output_type": "stream",
"text": [
"Description: movie about a fluffly animal Expression: release_year < 2019 and rating like \"PG%\"\n",
"Results:\n",
"\tRank: 1 Score: 0.42213767766952515 Title: The Adventures of Tintin\n",
"\tRank: 1 Score: 0.4221227169036865 Title: The Adventures of Tintin\n",
"\t\tType: Movie Release Year: 2011 Rating: PG\n",
"This 3-D motion capture adapts Georges Remi's classic comic strip about the adventures\n",
"of fearless young journalist Tintin and his trusty dog, Snowy.\n",
"\n",
"\tRank: 2 Score: 0.4041026830673218 Title: Hedgehogs\n",
"\tRank: 2 Score: 0.4041031002998352 Title: Hedgehogs\n",
"\t\tType: Movie Release Year: 2016 Rating: PG\n",
"When a hedgehog suffering from memory loss forgets his identity, he ends up on a big\n",
"city journey with a pigeon to save his habitat from a human threat.\n",
"\n",
"\tRank: 3 Score: 0.3980264663696289 Title: Osmosis Jones\n",
"\tRank: 3 Score: 0.3980264365673065 Title: Osmosis Jones\n",
"\t\tType: Movie Release Year: 2001 Rating: PG\n",
"Peter and Bobby Farrelly outdo themselves with this partially animated tale about an\n",
"out-of-shape 40-year-old man who's the host to various organisms.\n",
"\n",
"\tRank: 4 Score: 0.39479154348373413 Title: The Lamb\n",
"\tRank: 4 Score: 0.3947935104370117 Title: The Lamb\n",
"\t\tType: Movie Release Year: 2017 Rating: PG\n",
"A big-dreaming donkey escapes his menial existence and befriends some free-spirited\n",
"animal pals in this imaginative retelling of the Nativity Story.\n",
"\n",
"\tRank: 5 Score: 0.39370301365852356 Title: Open Season 2\n",
"\tRank: 5 Score: 0.39370331168174744 Title: Open Season 2\n",
"\t\tType: Movie Release Year: 2008 Rating: PG\n",
"Elliot the buck and his forest-dwelling cohorts must rescue their dachshund pal from\n",
"some spoiled pets bent on returning him to domesticity.\n"
Expand Down

0 comments on commit d343e82

Please sign in to comment.