3rd meeting

This commit is contained in:
Robert Kwiecinski 2021-05-07 22:16:28 +02:00
parent 7838e0c156
commit 0fc50ca6cc
6 changed files with 3876 additions and 691 deletions

View File

@ -9,12 +9,12 @@
"data": { "data": {
"text/plain": [ "text/plain": [
"['dimensions: 1, cases when observation is the nearest: 0.0%',\n", "['dimensions: 1, cases when observation is the nearest: 0.0%',\n",
" 'dimensions: 2, cases when observation is the nearest: 0.0%',\n", " 'dimensions: 2, cases when observation is the nearest: 1.0%',\n",
" 'dimensions: 3, cases when observation is the nearest: 0.0%',\n", " 'dimensions: 3, cases when observation is the nearest: 1.0%',\n",
" 'dimensions: 10, cases when observation is the nearest: 13.0%',\n", " 'dimensions: 10, cases when observation is the nearest: 8.0%',\n",
" 'dimensions: 20, cases when observation is the nearest: 61.0%',\n", " 'dimensions: 20, cases when observation is the nearest: 68.0%',\n",
" 'dimensions: 30, cases when observation is the nearest: 96.0%',\n", " 'dimensions: 30, cases when observation is the nearest: 93.0%',\n",
" 'dimensions: 40, cases when observation is the nearest: 98.0%',\n", " 'dimensions: 40, cases when observation is the nearest: 100.0%',\n",
" 'dimensions: 50, cases when observation is the nearest: 100.0%',\n", " 'dimensions: 50, cases when observation is the nearest: 100.0%',\n",
" 'dimensions: 60, cases when observation is the nearest: 100.0%',\n", " 'dimensions: 60, cases when observation is the nearest: 100.0%',\n",
" 'dimensions: 70, cases when observation is the nearest: 100.0%',\n", " 'dimensions: 70, cases when observation is the nearest: 100.0%',\n",
@ -46,15 +46,15 @@
" i1, i2 = random.sample(range(nb_vectors), 2)\n", " i1, i2 = random.sample(range(nb_vectors), 2)\n",
" target = (vectors[i1] + vectors[i2]) / 2\n", " target = (vectors[i1] + vectors[i2]) / 2\n",
"\n", "\n",
" distances = pd.DataFrame(\n", " similarities = pd.DataFrame(\n",
" enumerate(\n", " enumerate(\n",
" np.dot(target, vectors.transpose())\n", " np.dot(target, vectors.transpose())\n",
" / norm(target)\n", " / norm(target)\n",
" / norm(vectors.transpose(), axis=0)\n", " / norm(vectors.transpose(), axis=0)\n",
" )\n", " )\n",
" )\n", " )\n",
" distances = distances.sort_values(by=[1], ascending=False)\n", " similarities = similarities.sort_values(by=[1], ascending=False)\n",
" if (i1 in (list(distances[0][:k]))) | (i2 in (list(distances[0][:k]))):\n", " if (i1 in (list(similarities[0][:k]))) | (i2 in (list(similarities[0][:k]))):\n",
" successes += 1\n", " successes += 1\n",
" result.append(successes / trials)\n", " result.append(successes / trials)\n",
"\n", "\n",
@ -63,13 +63,6 @@
" for i, j in zip(dimensions, result)\n", " for i, j in zip(dimensions, result)\n",
"]" "]"
] ]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
} }
], ],
"metadata": { "metadata": {

File diff suppressed because one or more lines are too long

BIN
P5. Graph-based models.pdf Normal file

Binary file not shown.

1431
P5. Graph-based.ipynb Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

BIN
P6. WRMF (Implicit_ALS).pdf Normal file

Binary file not shown.