msmbuilder / osprey

🦅Hyperparameter optimization for machine learning pipelines 🦅
http://msmbuilder.org/osprey
Apache License 2.0
74 stars 26 forks source link

int with warp: log not working again #209

Closed brookehus closed 7 years ago

brookehus commented 7 years ago

@cxhernandez, cf. #109

With the latest version of osprey, when passing something like this:

  cluster__n_clusters:
     min: 10
     max: 100
     type: int
     warp: log

I get an error (see below). This is the case for both random and gp search, with or without jump. cc: @hannahw1

------------------------------------------------------------------------------
Exception encountered while fitting model
------------------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/bhusic/source/osprey/osprey/execute_worker.py", line 136, in run_single_trial
    estimator, params, cv=cv, scoring=scoring, X=X, y=y, verbose=1)
  File "/home/bhusic/source/osprey/osprey/fit_estimator.py", line 61, in fit_and_score_estimator
    for train, test in cv.split(X, y))
  File "/home/bhusic/miniconda3/lib/python3.5/site-packages/sklearn/externals/joblib/parallel.py", line 758, in __call__
    while self.dispatch_one_batch(iterator):
  File "/home/bhusic/miniconda3/lib/python3.5/site-packages/sklearn/externals/joblib/parallel.py", line 608, in dispatch_one_batch
    self._dispatch(tasks)
  File "/home/bhusic/miniconda3/lib/python3.5/site-packages/sklearn/externals/joblib/parallel.py", line 571, in _dispatch
    job = self._backend.apply_async(batch, callback=cb)
  File "/home/bhusic/miniconda3/lib/python3.5/site-packages/sklearn/externals/joblib/_parallel_backends.py", line 109, in apply_async
    result = ImmediateResult(func)
  File "/home/bhusic/miniconda3/lib/python3.5/site-packages/sklearn/externals/joblib/_parallel_backends.py", line 326, in __init__
    self.results = batch()
  File "/home/bhusic/miniconda3/lib/python3.5/site-packages/sklearn/externals/joblib/parallel.py", line 131, in __call__
    return [func(*args, **kwargs) for func, args, kwargs in self.items]
  File "/home/bhusic/miniconda3/lib/python3.5/site-packages/sklearn/externals/joblib/parallel.py", line 131, in <listcomp>
    return [func(*args, **kwargs) for func, args, kwargs in self.items]
  File "/home/bhusic/source/osprey/osprey/fit_estimator.py", line 131, in _fit_and_score
    estimator.fit(X_train, **fit_params)
  File "/home/bhusic/miniconda3/lib/python3.5/site-packages/sklearn/pipeline.py", line 268, in fit
    Xt, fit_params = self._fit(X, y, **fit_params)
  File "/home/bhusic/miniconda3/lib/python3.5/site-packages/sklearn/pipeline.py", line 234, in _fit
    Xt = transform.fit_transform(Xt, y, **fit_params_steps[name])
  File "/home/bhusic/source/msmbuilder/msmbuilder/cluster/base.py", line 173, in fit_transform
    return self.fit_predict(sequences, y)
  File "/home/bhusic/source/msmbuilder/msmbuilder/cluster/base.py", line 154, in fit_predict
    labels = super(MultiSequenceClusterMixin, self).fit_predict(sequences)
  File "/home/bhusic/miniconda3/lib/python3.5/site-packages/sklearn/cluster/k_means_.py", line 898, in fit_predict
    return self.fit(X).labels_
  File "/home/bhusic/source/msmbuilder/msmbuilder/cluster/base.py", line 48, in fit
    super(MultiSequenceClusterMixin, self).fit(self._concat(sequences))
  File "/home/bhusic/miniconda3/lib/python3.5/site-packages/sklearn/cluster/k_means_.py", line 1381, in fit
    init_size=init_size)
  File "/home/bhusic/miniconda3/lib/python3.5/site-packages/sklearn/cluster/k_means_.py", line 681, in _init_centroids
    x_squared_norms=x_squared_norms)
  File "/home/bhusic/miniconda3/lib/python3.5/site-packages/sklearn/cluster/k_means_.py", line 106, in _k_init
    for c in range(1, n_clusters):
TypeError: 'numpy.float64' object cannot be interpreted as an integer
------------------------------------------------------------------------------
brookehus commented 7 years ago

Done in #210