Initial commit

This commit is contained in:
Alexander Nozik 2022-09-24 11:25:54 +03:00
commit 8eec9e65b2
No known key found for this signature in database
GPG Key ID: F7FCF2DD25C71357
9 changed files with 3855 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.idea/

BIN
Task 1/Assignment_1.pdf Normal file

Binary file not shown.

BIN
Task 1/Assignment_1_ru.pdf Normal file

Binary file not shown.

2056
Task 1/Lecture 1.ipynb Normal file

File diff suppressed because one or more lines are too long

113
Task 1/convolutions.ipynb Normal file
View File

@ -0,0 +1,113 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"import itertools"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"c = 3"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"# Generate some data\n",
"np.random.seed(42)\n",
"lambda1 = np.random.normal(size=(c, c))\n",
"lambda2 = np.random.normal(size=(c, c))\n",
"lambda3 = np.random.normal(size=(c, c))\n",
"G1 = np.random.normal(size=(c, c, c))\n",
"G2 = np.random.normal(size=(c, c, c))\n",
"U = np.random.normal(size=(c, c, c, c))"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"def Z_naive(lambda1, lambda2, lambda3, G1, G2, U):\n",
" c = lambda1.shape[0]\n",
" Z = np.zeros(shape=(c, c, c, c))\n",
" for a, b, c, d, e, f, g, h, i, j in itertools.product(*([range(c)]*10)):\n",
" Z[a, h, i, j] += lambda1[a, b]*lambda2[d, e]*lambda3[g, h]*G1[c, b, d]*G2[f, e, g]*U[i, j, c, f]\n",
" return Z"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"198 ms ± 30.6 ms per loop (mean ± std. dev. of 7 runs, 10 loops each)\n"
]
}
],
"source": [
"%%timeit\n",
"Z = Z_naive(lambda1, lambda2, lambda3, G1, G2, U)"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(3, 3, 3, 3)"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"Z = Z_naive(lambda1, lambda2, lambda3, G1, G2, U)\n",
"Z.shape"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.3"
}
},
"nbformat": 4,
"nbformat_minor": 2
}

213
Task 1/kmeans.ipynb Normal file

File diff suppressed because one or more lines are too long

BIN
Task 2/A.npy Normal file

Binary file not shown.

BIN
Task 2/Assignment_2.pdf Normal file

Binary file not shown.

1472
Task 2/Lecture 2.ipynb Normal file

File diff suppressed because one or more lines are too long