@@ -100,7 +100,7 @@ def _evaluate(self, x, _):
100100 return y
101101
102102 def approximate (self , method , ** kwargs ):
103- r"""Returns a filter which approximates this filter.
103+ r"""Return a filter which approximates this filter.
104104
105105 While approximations might loose accuracy, they allow for much faster
106106 computations.
@@ -114,7 +114,33 @@ def approximate(self, method, **kwargs):
114114
115115 Examples
116116 --------
117- TODO: approx plot from notebook (needs new plotting)
117+
118+ Approximate a filter with Chebyshev polynomials of various orders:
119+
120+ >>> import matplotlib.pyplot as plt
121+ >>> fig, ax = plt.subplots(1, 1)
122+ >>>
123+ >>> G = graphs.Ring()
124+ >>> G.compute_fourier_basis()
125+ >>> f1 = filters.Heat(G)
126+ >>> f1.plot(eigenvalues=True, linewidth=3, label='continuous', ax=ax)
127+ >>>
128+ >>> for order in range(1, 5):
129+ ... f2 = f1.approximate('Chebyshev', order=order)
130+ ... l = 'Chebyshev order {}'.format(order)
131+ ... f2.plot(eigenvalues=False, label=l, linestyle='dashed', ax=ax)
132+ >>>
133+ >>> _ = ax.set_title('Approximation for various polynomial orders')
134+ >>> _ = ax.legend()
135+
136+ Approximate a filterbank with Chebyshev polynomials:
137+
138+ >>> G = graphs.Ring()
139+ >>> G.compute_fourier_basis()
140+ >>> f1 = filters.Itersine(G)
141+ >>> f2 = f1.approximate('Chebyshev', order=20)
142+ >>> f1.plot(title='Continuous filterbank')
143+ >>> f2.plot(title='Approximated filterbank')
118144
119145 """
120146 from . import approximations
@@ -173,7 +199,7 @@ def filter(self, s, method=None, order=30):
173199 s : ndarray
174200 Graph signals, a tensor of shape ``(N_NODES, N_SIGNALS,
175201 N_FEATURES)``, where ``N_NODES`` and ``N_SIGNALS`` are the number
176- of nodes and signals of the signal tensor that pas passed in, and
202+ of nodes and signals of the signal tensor that was passed in, and
177203 ``N_FEATURES`` is either 1 (synthesis) or the number of filters in
178204 the filter bank (analysis).
179205
0 commit comments