-
Notifications
You must be signed in to change notification settings - Fork 315
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Vladimir Nikolaev
committed
Sep 17, 2017
1 parent
e6b5569
commit b8c88c3
Showing
9 changed files
with
1,179 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
421 changes: 421 additions & 0 deletions
421
...ks-practice/homework-practice-01/.ipynb_checkpoints/homework-practice-01-checkpoint.ipynb
Large diffs are not rendered by default.
Oops, something went wrong.
83 changes: 83 additions & 0 deletions
83
ML17-fall/homeworks-practice/homework-practice-01/functions.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
def prod_non_zero_diag(x): | ||
"""Compute product of nonzero elements from matrix diagonal. | ||
input: | ||
x -- 1-d numpy array | ||
output: | ||
product -- integer number | ||
Not vectorized implementation. | ||
""" | ||
|
||
pass | ||
|
||
|
||
def are_multisets_equal(x, y): | ||
"""Return True if both vectors create equal multisets. | ||
input: | ||
x, y -- 1-d numpy arrays | ||
output: | ||
True if multisets are equal, False otherwise -- boolean | ||
Not vectorized implementation. | ||
""" | ||
|
||
pass | ||
|
||
|
||
def max_after_zero(x): | ||
"""Find max element after zero in array. | ||
input: | ||
x -- 1-d numpy array | ||
output: | ||
maximum element after zero -- integer number | ||
Not vectorized implementation. | ||
""" | ||
|
||
pass | ||
|
||
|
||
def run_length_encoding(x): | ||
"""Make run-length encoding. | ||
input: | ||
x -- 1-d numpy array | ||
output: | ||
elements, counters -- integer iterables | ||
Not vectorized implementation. | ||
""" | ||
|
||
pass | ||
|
||
def convert_image(img, coefs): | ||
"""Sum up image channels with weights from coefs array | ||
input: | ||
img -- 3-d numpy array (H x W x 3) | ||
coefs -- 1-d numpy array (length 3) | ||
output: | ||
img -- 2-d numpy array | ||
Not vectorized implementation. | ||
""" | ||
|
||
pass | ||
|
||
|
||
def pairwise_distance(x, y): | ||
"""Return pairwise object distance. | ||
input: | ||
x, y -- 2d numpy arrays | ||
output: | ||
distance array -- 2d numpy array | ||
Not vectorized implementation. | ||
""" | ||
|
||
pass |
85 changes: 85 additions & 0 deletions
85
ML17-fall/homeworks-practice/homework-practice-01/functions_vectorized.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
import numpy as np | ||
|
||
def prod_non_zero_diag(x): | ||
"""Compute product of nonzero elements from matrix diagonal. | ||
input: | ||
x -- 1-d numpy array | ||
output: | ||
product -- integer number | ||
Vectorized implementation. | ||
""" | ||
|
||
pass | ||
|
||
|
||
def are_multisets_equal(x, y): | ||
"""Return True if both vectors create equal multisets. | ||
input: | ||
x, y -- 1-d numpy arrays | ||
output: | ||
True if multisets are equal, False otherwise -- boolean | ||
Vectorized implementation. | ||
""" | ||
|
||
pass | ||
|
||
|
||
def max_after_zero(x): | ||
"""Find max element after zero in array. | ||
input: | ||
x -- 1-d numpy array | ||
output: | ||
maximum element after zero -- integer number | ||
Vectorized implementation. | ||
""" | ||
|
||
pass | ||
|
||
|
||
def run_length_encoding(x): | ||
"""Make run-length encoding. | ||
input: | ||
x -- 1-d numpy array | ||
output: | ||
elements, counters -- integer iterables | ||
Vectorized implementation. | ||
""" | ||
|
||
pass | ||
|
||
def convert_image(img, coefs): | ||
"""Sum up image channels with weights from coefs array | ||
input: | ||
img -- 3-d numpy array (H x W x 3) | ||
coefs -- 1-d numpy array (length 3) | ||
output: | ||
img -- 2-d numpy array | ||
Vectorized implementation. | ||
""" | ||
|
||
pass | ||
|
||
|
||
def pairwise_distance(x, y): | ||
"""Return pairwise object distance. | ||
input: | ||
x, y -- 2d numpy arrays | ||
output: | ||
distance array -- 2d numpy array | ||
Vctorized implementation. | ||
""" | ||
|
||
pass |
421 changes: 421 additions & 0 deletions
421
ML17-fall/homeworks-practice/homework-practice-01/homework-practice-01.ipynb
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.