def get_movielens_item_metadata(use_item_ids):
features = {}<EOL>genre_set = set()<EOL>for line in _get_movie_raw_metadata():<EOL><INDENT>if not line:<EOL><INDENT>continue<EOL><DEDENT>splt = line.split('<STR_LIT:|>')<EOL>item_id = int(splt[<NUM_LIT:0>])<EOL>genres = [idx for idx, val in<EOL>zip(range(len(splt[<NUM_LIT:5>:])), splt[<NUM_LIT:5>:])<EOL>if int(val) > <NUM_LIT:0>]<EOL>if use_item_ids:<EOL><INDENT>genres.append(item_id)<EOL><DEDENT>for genre_id in genres:<EOL><INDENT>genre_set.add(genre_id)<EOL><DEDENT>features[item_id] = genres<EOL><DEDENT>mat = sp.lil_matrix((len(features) + <NUM_LIT:1>,<EOL>len(genre_set)),<EOL>dtype=np.int32)<EOL>for item_id, genre_ids in features.items():<EOL><INDENT>for genre_id in genre_ids:<EOL><INDENT>mat[item_id, genre_id] = <NUM_LIT:1><EOL><DEDENT><DEDENT>return mat<EOL>
Build a matrix of genre features (no_items, no_features).

If use_item_ids is True, per-item features will also be used.