def fetch_movielens(<EOL>data_home=None,<EOL>indicator_features=True,<EOL>genre_features=False,<EOL>min_rating=<NUM_LIT:0.0>,<EOL>download_if_missing=True,<EOL>):
if not (indicator_features or genre_features):<EOL><INDENT>raise ValueError(<EOL>"<STR_LIT>" "<STR_LIT>"<EOL>)<EOL><DEDENT>zip_path = _common.get_data(<EOL>data_home,<EOL>(<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>),<EOL>"<STR_LIT>",<EOL>"<STR_LIT>",<EOL>download_if_missing,<EOL>)<EOL>try:<EOL><INDENT>(train_raw, test_raw, item_metadata_raw, genres_raw) = _read_raw_data(zip_path)<EOL><DEDENT>except zipfile.BadZipFile:<EOL><INDENT>os.unlink(zip_path)<EOL>raise ValueError(<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>)<EOL><DEDENT>num_users, num_items = _get_dimensions(_parse(train_raw), _parse(test_raw))<EOL>train = _build_interaction_matrix(<EOL>num_users, num_items, _parse(train_raw), min_rating<EOL>)<EOL>test = _build_interaction_matrix(num_users, num_items, _parse(test_raw), min_rating)<EOL>assert train.shape == test.shape<EOL>(<EOL>id_features,<EOL>id_feature_labels,<EOL>genre_features_matrix,<EOL>genre_feature_labels,<EOL>) = _parse_item_metadata(num_items, item_metadata_raw, genres_raw)<EOL>assert id_features.shape == (num_items, len(id_feature_labels))<EOL>assert genre_features_matrix.shape == (num_items, len(genre_feature_labels))<EOL>if indicator_features and not genre_features:<EOL><INDENT>features = id_features<EOL>feature_labels = id_feature_labels<EOL><DEDENT>elif genre_features and not indicator_features:<EOL><INDENT>features = genre_features_matrix<EOL>feature_labels = genre_feature_labels<EOL><DEDENT>else:<EOL><INDENT>features = sp.hstack([id_features, genre_features_matrix]).tocsr()<EOL>feature_labels = np.concatenate((id_feature_labels, genre_feature_labels))<EOL><DEDENT>data = {<EOL>"<STR_LIT:train>": train,<EOL>"<STR_LIT:test>": test,<EOL>"<STR_LIT>": features,<EOL>"<STR_LIT>": feature_labels,<EOL>"<STR_LIT>": id_feature_labels,<EOL>}<EOL>return data<EOL>
Fetch the `Movielens 100k dataset <http://grouplens.org/datasets/movielens/100k/>`_.

The dataset contains 100,000 interactions from 1000 users on 1700 movies,
and is exhaustively described in its
`README <http://files.grouplens.org/datasets/movielens/ml-100k-README.txt>`_.

Parameters
----------

data_home: path, optional
    Path to the directory in which the downloaded data should be placed.
    Defaults to ``~/lightfm_data/``.
indicator_features: bool, optional
    Use an [n_items, n_items] identity matrix for item features. When True with genre_features,
    indicator and genre features are concatenated into a single feature matrix of shape
    [n_items, n_items + n_genres].
genre_features: bool, optional
    Use a [n_items, n_genres] matrix for item features. When True with item_indicator_features,
    indicator and genre features are concatenated into a single feature matrix of shape
    [n_items, n_items + n_genres].
min_rating: float, optional
    Minimum rating to include in the interaction matrix.
download_if_missing: bool, optional
    Download the data if not present. Raises an IOError if False and data is missing.

Notes
-----

The return value is a dictionary containing the following keys:

Returns
-------

train: sp.coo_matrix of shape [n_users, n_items]
     Contains training set interactions.
test: sp.coo_matrix of shape [n_users, n_items]
     Contains testing set interactions.
item_features: sp.csr_matrix of shape [n_items, n_item_features]
     Contains item features.
item_feature_labels: np.array of strings of shape [n_item_features,]
     Labels of item features.
item_labels: np.array of strings of shape [n_items,]
     Items' titles.