Skip to content

Commit edc17e2

Browse files
committed
updated readme
1 parent 99f4833 commit edc17e2

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,11 +154,11 @@
154154

155155
- [Shell script](./useful_scripts/prepend_python_shebang.sh) For prepending Python-shebangs to .py files.
156156

157-
- Convert 'tab-delimited' to 'comma-separated' CSV files [[IPython nb](http://nbviewer.ipython.org/github/rasbt/python_reference/blob/master/useful_scripts/fix_tab_csv.ipynb)]
158-
159-
- A random string generator [function](./useful_scripts/random_string_generator.py)
157+
- A random string generator [function](./useful_scripts/random_string_generator.py).
160158

159+
- [Converting large CSV files](https://github.com/rasbt/python_reference/blob/master/useful_scripts/large_csv_to_sqlite.py) to SQLite databases using pandas.
161160

161+
- [Sparsifying a matrix](https://github.com/rasbt/python_reference/blob/master/useful_scripts/sparsify_matrix.py) by zeroing out all elements but the top k elements in a row using NumPy.
162162

163163
<br>
164164

useful_scripts/sparsify_matrix.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
# The matrix could be a distance or similarity matrix (e.g., kernel matrix in kernel PCA),
55
# where we are interested to keep the top k neighbors.
66

7+
import numpy as np
8+
79
print('Sparsify a matrix by zeroing all elements but the top 2 values in a row.\n')
810

911
A = np.array([[1,2,3,4,5],[9,8,6,4,5],[3,1,7,8,9]])

0 commit comments

Comments
 (0)