File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change 1
1
"""Assignment - using numpy and making a PR.
2
+
2
3
The goals of this assignment are:
3
4
* Use numpy in practice with two easy exercises.
4
5
* Use automated tools to validate the code (`pytest` and `flake8`)
14
15
This will be enforced with `flake8`. You can check that there is no flake8
15
16
errors by calling `flake8` at the root of the repo.
16
17
"""
17
-
18
18
import numpy as np
19
19
20
20
21
21
def max_index (X ):
22
22
23
23
"""Return the index of the maximum in a numpy array.
24
+
24
25
Parameters
25
26
----------
26
27
X : ndarray of shape (n_samples, n_features)
@@ -35,7 +36,6 @@ def max_index(X):
35
36
If the input is not a numpy array or
36
37
if the shape is not 2D.
37
38
"""
38
-
39
39
i = 0
40
40
j = 0
41
41
# TODO
@@ -51,6 +51,7 @@ def max_index(X):
51
51
def wallis_product (n_terms ):
52
52
53
53
"""Implement the Wallis product to compute an approximation of pi.
54
+
54
55
See:
55
56
https://en.wikipedia.org/wiki/Wallis_product
56
57
Parameters
@@ -63,7 +64,6 @@ def wallis_product(n_terms):
63
64
pi : float
64
65
The approximation of order `n_terms` of pi using the Wallis product.
65
66
"""
66
-
67
67
# XXX : The n_terms is an int that corresponds to the number of
68
68
# terms in the product. For example 10000.
69
69
You can’t perform that action at this time.
0 commit comments