Improved query
This commit is contained in:
parent
b32c86c302
commit
28d17d5c35
@ -2,7 +2,7 @@
|
|||||||
"cells": [
|
"cells": [
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 1,
|
"execution_count": 6,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
@ -13,7 +13,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 2,
|
"execution_count": 7,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
@ -34,7 +34,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 3,
|
"execution_count": 8,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [
|
"outputs": [
|
||||||
{
|
{
|
||||||
@ -52,7 +52,7 @@
|
|||||||
" Case(problem={'v_left': 43.0, 'v_front': 31.5, 'd_left': -98.0, 'd_front': 60.0, 'type_left': 'truck', 'type_front': 'car', 'radius_curve(m)': 1720.0, 'slope_street': 'flat', 'street_type': 'autobahn', 'time': 'dusk', 'weather': 'rain', 'type_vehicle': 'car', 'speed_limit(km/h)': 130.0}, solution={'action': 'continue'})]"
|
" Case(problem={'v_left': 43.0, 'v_front': 31.5, 'd_left': -98.0, 'd_front': 60.0, 'type_left': 'truck', 'type_front': 'car', 'radius_curve(m)': 1720.0, 'slope_street': 'flat', 'street_type': 'autobahn', 'time': 'dusk', 'weather': 'rain', 'type_vehicle': 'car', 'speed_limit(km/h)': 130.0}, solution={'action': 'continue'})]"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"execution_count": 3,
|
"execution_count": 8,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"output_type": "execute_result"
|
"output_type": "execute_result"
|
||||||
}
|
}
|
||||||
@ -72,7 +72,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 4,
|
"execution_count": 12,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
@ -97,6 +97,11 @@
|
|||||||
")\n",
|
")\n",
|
||||||
"\n",
|
"\n",
|
||||||
"case_base.add_symbolic_sim(\n",
|
"case_base.add_symbolic_sim(\n",
|
||||||
|
" field = \"street_type\",\n",
|
||||||
|
" similarity_matrix = create_similarity_matrix(\"data/street_type_sim.csv\", \"type_street\")\n",
|
||||||
|
")\n",
|
||||||
|
"\n",
|
||||||
|
"case_base.add_symbolic_sim(\n",
|
||||||
" field = \"time\",\n",
|
" field = \"time\",\n",
|
||||||
" similarity_matrix = create_similarity_matrix(\"data/time_type_sim.csv\", \"type_time\")\n",
|
" similarity_matrix = create_similarity_matrix(\"data/time_type_sim.csv\", \"type_time\")\n",
|
||||||
")\n",
|
")\n",
|
||||||
@ -109,7 +114,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 5,
|
"execution_count": 13,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [
|
"outputs": [
|
||||||
{
|
{
|
||||||
@ -117,45 +122,57 @@
|
|||||||
"output_type": "stream",
|
"output_type": "stream",
|
||||||
"text": [
|
"text": [
|
||||||
"Your Query:\n",
|
"Your Query:\n",
|
||||||
" - v = 28\n",
|
" - v = 22.5\n",
|
||||||
" - v_left = 37\n",
|
" - v_left = 27.5\n",
|
||||||
" - v_front = 22.5\n",
|
" - v_front = 34.5\n",
|
||||||
" - d_left = -20\n",
|
" - d_left = -68\n",
|
||||||
" - d_front = 51\n",
|
" - d_front = 40\n",
|
||||||
" - radius_curve = 2000\n",
|
" - type_left = truck\n",
|
||||||
" - speed_limit = 200\n",
|
|
||||||
" - type_vehicle = motorcycle\n",
|
|
||||||
" - type_left = motorcycle\n",
|
|
||||||
" - type_front = motorcycle\n",
|
" - type_front = motorcycle\n",
|
||||||
|
" - radius_curve = 3285\n",
|
||||||
|
" - slope_street = flat\n",
|
||||||
|
" - street_type = country_road (separated)\n",
|
||||||
|
" - time = day\n",
|
||||||
|
" - weather = rain\n",
|
||||||
|
" - type_vehicle = motorcycle\n",
|
||||||
|
" - speed_limit = 120\n",
|
||||||
"\n",
|
"\n",
|
||||||
"I recommend you this car:\n",
|
"I recommend you this car:\n",
|
||||||
"Accelerated_lane_change\n",
|
"Continue\n",
|
||||||
"\n",
|
"\n",
|
||||||
"Explanation:\n",
|
"Explanation:\n",
|
||||||
" - v_left = 37.0 (similarity: 1.00)\n",
|
" - v_left = 33.0 (similarity: 0.15)\n",
|
||||||
" - v_front = 22.5 (similarity: 1.00)\n",
|
" - v_front = 34.5 (similarity: 1.00)\n",
|
||||||
" - d_left = -17.0 (similarity: 0.25)\n",
|
" - d_left = -120.0 (similarity: 0.02)\n",
|
||||||
" - d_front = 51.0 (similarity: 1.00)\n",
|
" - d_front = 38.0 (similarity: 0.33)\n",
|
||||||
" - radius_curve(m) = 3020.0 (similarity: 0.00)\n",
|
" - type_left = car (similarity: 0.80)\n",
|
||||||
" - speed_limit(km/h) = 120.0 (similarity: 0.01)\n",
|
" - type_front = motorcycle (similarity: 1.00)\n",
|
||||||
" - type_vehicle = car (similarity: 0.50)\n",
|
" - radius_curve(m) = 3606.0 (similarity: 0.00)\n",
|
||||||
" - type_left = truck (similarity: 0.50)\n",
|
" - slope_street = flat (similarity: 1.00)\n",
|
||||||
" - type_front = truck (similarity: 0.50)\n"
|
" - street_type = country_road (separated) (similarity: 1.00)\n",
|
||||||
|
" - time = day (similarity: 1.00)\n",
|
||||||
|
" - weather = rain (similarity: 1.00)\n",
|
||||||
|
" - type_vehicle = truck (similarity: 0.50)\n",
|
||||||
|
" - speed_limit(km/h) = 120.0 (similarity: 1.00)\n"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"source": [
|
"source": [
|
||||||
"query = Query.from_problems(\n",
|
"query = Query.from_problems(\n",
|
||||||
" v = 28,\n",
|
" v = 22.5,\n",
|
||||||
" v_left = 37,\n",
|
" v_left = 27.5,\n",
|
||||||
" v_front = 22.5,\n",
|
" v_front = 34.5,\n",
|
||||||
" d_left = -20,\n",
|
" d_left = -68,\n",
|
||||||
" d_front = 51,\n",
|
" d_front = 40,\n",
|
||||||
" radius_curve = 2000,\n",
|
" type_left = \"truck\",\n",
|
||||||
" speed_limit = 200,\n",
|
|
||||||
" type_vehicle = \"motorcycle\",\n",
|
|
||||||
" type_left = \"motorcycle\",\n",
|
|
||||||
" type_front = \"motorcycle\",\n",
|
" type_front = \"motorcycle\",\n",
|
||||||
|
" radius_curve = 3285,\n",
|
||||||
|
" slope_street = \"flat\",\n",
|
||||||
|
" street_type = \"country_road (separated)\",\n",
|
||||||
|
" time = \"day\",\n",
|
||||||
|
" weather = \"rain\",\n",
|
||||||
|
" type_vehicle = \"motorcycle\",\n",
|
||||||
|
" speed_limit = 120,\n",
|
||||||
")\n",
|
")\n",
|
||||||
"\n",
|
"\n",
|
||||||
"# sim_funcs: manhattan_sim, euclid_sim\n",
|
"# sim_funcs: manhattan_sim, euclid_sim\n",
|
||||||
@ -165,11 +182,15 @@
|
|||||||
" v_front = euclid_sim,\n",
|
" v_front = euclid_sim,\n",
|
||||||
" d_left = euclid_sim,\n",
|
" d_left = euclid_sim,\n",
|
||||||
" d_front = euclid_sim,\n",
|
" d_front = euclid_sim,\n",
|
||||||
" radius_curve = manhattan_sim,\n",
|
|
||||||
" speed_limit = manhattan_sim,\n",
|
|
||||||
" type_vehicle = symbolic_sim,\n",
|
|
||||||
" type_left = symbolic_sim,\n",
|
" type_left = symbolic_sim,\n",
|
||||||
" type_front = symbolic_sim,\n",
|
" type_front = symbolic_sim,\n",
|
||||||
|
" radius_curve = euclid_sim,\n",
|
||||||
|
" slope_street = symbolic_sim,\n",
|
||||||
|
" street_type = symbolic_sim,\n",
|
||||||
|
" time = symbolic_sim,\n",
|
||||||
|
" weather = symbolic_sim,\n",
|
||||||
|
" type_vehicle = symbolic_sim,\n",
|
||||||
|
" speed_limit = euclid_sim,\n",
|
||||||
")\n",
|
")\n",
|
||||||
"\n",
|
"\n",
|
||||||
"print(\"Your Query:\")\n",
|
"print(\"Your Query:\")\n",
|
||||||
@ -206,7 +227,7 @@
|
|||||||
"orig_nbformat": 4,
|
"orig_nbformat": 4,
|
||||||
"vscode": {
|
"vscode": {
|
||||||
"interpreter": {
|
"interpreter": {
|
||||||
"hash": "4c522f398908c053844cc48bcd755f88db468f52081f171c67c4d9e41e8d16a6"
|
"hash": "a5aa7fe267f107423dffd85abeeed3bf0e097b37494d32919cbe32f80338e7f6"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user