Skip to content

Commit

Permalink
Merge pull request #144 from commonsense/mini-changes
Browse files Browse the repository at this point in the history
use a previously unused variable, fix documentation
  • Loading branch information
Rob Speer authored Dec 4, 2017
2 parents 21d7fab + de870b2 commit 9930974
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion conceptnet5/vectors/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ def run_export(input_filename, output_filename, language):
@click.option('-k', default=300, help="Number of columns to reduce to")
def run_miniaturize(input_filename, extra_vocab_filename, output_filename, k):
"""
Save a smaller version of a frame, which includes frequent terms and doesn't include phrases.
Save a smaller version of a frame, which includes frequent terms and phrases.
"""
frame = load_hdf(input_filename)
other_frame = load_hdf(extra_vocab_filename)
Expand Down
3 changes: 2 additions & 1 deletion conceptnet5/vectors/miniaturize.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ def miniaturize(frame, other_vocab=None, k=300, debias=True):
smaller = frame.loc[vocab]
U, _S, _Vt = np.linalg.svd(smaller, full_matrices=False)
redecomposed = pd.DataFrame(U[:, :k], index=vocab, dtype='f')
redecomposed = de_bias_frame(redecomposed)
if debias:
redecomposed = de_bias_frame(redecomposed)
mini = (redecomposed * 64).astype(np.int8)
mini.sort_index(inplace=True)
return mini

0 comments on commit 9930974

Please sign in to comment.