Skip to content

Commit

Permalink
Merge pull request scikit-learn#3795 from dsullivan7/svm_doc
Browse files Browse the repository at this point in the history
[MRG+1] adding example for memory wrapper for load_svm_light
  • Loading branch information
agramfort committed Oct 23, 2014
2 parents a0e5fcb + 92a02ad commit 2c2e1e2
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions sklearn/datasets/svmlight_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,21 @@ def load_svmlight_file(f, n_features=None, dtype=np.float64,
--------
load_svmlight_files: similar function for loading multiple files in this
format, enforcing the same number of features/columns on all of them.
Examples
--------
To use joblib.Memory to cache the svmlight file::
from sklearn.externals.joblib import Memory
from sklearn.datasets import load_svmlight_file
mem = Memory("./mycache")
@mem.cache
def get_data():
data = load_svmlight_file("mysvmlightfile")
return data[0], data[1]
X, y = get_data()
"""
return tuple(load_svmlight_files([f], n_features, dtype, multilabel,
zero_based, query_id))
Expand Down

0 comments on commit 2c2e1e2

Please sign in to comment.