title: sklearn encode hierarchical feature for learning
body: <p>Does sklearn have an efficient way to encode hierarchical features with many unique values?</p>
  
  <p>Here is the context: I have a car price dataset and I want to build a (regression and random forest) model to predict car price. In the dataset, two of the features are categorical: maker and model. For example, the maker includes Nissian, Honda, etc., and the model includes Skyline, Accord, etc.. Each model belongs to a maker, so it forms a hierarchy between these two features.</p>
  
  <p>There are 50 different makes and 900 different models in the dataset. I tried to use sklearn's LabelEncoder and OneHotEncoder to encode these two features, which results in a very large sparse matrix with more than 900 dummy variables in each row. Obviously this does use the hierarchy between maker and model, and it would lead to the learning model inefficient. Is there a better way to encode these two features by sklearn?</p>