Issue 1:
Training models might take considerable amounts of time and energy, but with every upgrade of sklearn one currently might lose the ability to use a model trained with an older release version.

While this is mentioned in the docs, i still find it upsetting, as i can either pin sklearn to some old version or re-train all models and use an up-to-date sklearn. Re-training also might make it necessary to keep large amounts of training data around and ship them to all machines, potentially with parameters found by grid-search on previous versions to at least save grid-search times.

For example, i have a GradientBoostingClassifier model from 0.18.1 that now causes this userwarning:

Trying to unpickle estimator GradientBoostingClassifier from version 0.18.1 when using version 0.19.1. This might lead to breaking code or invalid results. Use at your own risk.

When trying to actually use the model the result is:

AttributeError: 'GradientBoostingClassifier' object has no attribute 'n_features_'

From my guess, this is mainly an issue of using pickle on the model object (which is currently the recommended way to serialize models): every rename of model properties in the source will cause a whole lot of trouble when loading a model object pre-dating that change, as the methods won't find the properties anymore.

At the same time i think that the underlying idea of an estimator changes rather rarely.

Would there be any interest in providing high-level save and load functionality that decouples the run-time model mechanics a bit more from its serialization and focuses more on longevity?

Issue 2:
while running below statement i am getting exception:

for i, c in enumerate(clusters):

print('Cluster {} has {} members: {}...'.format(i, len(c), c[0]))

Exception:

KeyError Traceback (most recent call last)

~/anaconda3/lib/python3.6/site-packages/pandas/core/indexes/base.py in get_loc(self, key, method, tolerance)

3062 try:

-> 3063 return self._engine.get_loc(key)

3064 except KeyError:

pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_loc()

pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_loc()

pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.Int64HashTable.get_item()

pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.Int64HashTable.get_item()

KeyError: 0

During handling of the above exception, another exception occurred:

KeyError Traceback (most recent call last)

in ()

22

23 for i, c in enumerate(clusters): ## To get the values printed along with their index I can use Python's enumerate function

---> 24 print('Cluster {} has {} members: {}...'.format(i, len(c), c[0]))

25

26 # which prints

~/anaconda3/lib/python3.6/site-packages/pandas/core/frame.py in getitem(self, key)

2683 return self._getitem_multilevel(key)

2684 else:

-> 2685 return self._getitem_column(key)

2686

2687 def _getitem_column(self, key):

~/anaconda3/lib/python3.6/site-packages/pandas/core/frame.py in _getitem_column(self, key)

2690 # get column

2691 if self.columns.is_unique:

-> 2692 return self._get_item_cache(key)

2693

2694 # duplicate columns & possible reduce dimensionality

~/anaconda3/lib/python3.6/site-packages/pandas/core/generic.py in _get_item_cache(self, item)

2484 res = cache.get(item)

2485 if res is None:

-> 2486 values = self._data.get(item)

2487 res = self._box_item_values(item, values)

2488 cache[item] = res

~/anaconda3/lib/python3.6/site-packages/pandas/core/internals.py in get(self, item, fastpath)

4113

4114 if not isna(item):

-> 4115 loc = self.items.get_loc(item)

4116 else:

4117 indexer = np.arange(len(self.items))[isna(self.items)]

~/anaconda3/lib/python3.6/site-packages/pandas/core/indexes/base.py in get_loc(self, key, method, tolerance)

3063 return self._engine.get_loc(key)

3064 except KeyError:

-> 3065 return self._engine.get_loc(self._maybe_cast_indexer(key))

3066

3067 indexer = self.get_indexer([key], method=method, tolerance=tolerance)

pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_loc()

pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_loc()

pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.Int64HashTable.get_item()

pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.Int64HashTable.get_item()

KeyError: 0