Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Usage instructions #15

Open
ohadle opened this issue Nov 28, 2016 · 1 comment
Open

Usage instructions #15

ohadle opened this issue Nov 28, 2016 · 1 comment

Comments

@ohadle
Copy link

ohadle commented Nov 28, 2016

I'm on the current master (the release pip version failed on import), trying to define a callback.
Trying to imitate the example in readme.md didn't work out:

hera = HeraCallback('bla', 'localhost', '4000')

...

/Users/olevinkr/anaconda/lib/python2.7/site-packages/sklearn/model_selection/_validation.pyc in cross_val_score(estimator, X, y, groups, scoring, cv, n_jobs, verbose, fit_params, pre_dispatch)
    138                                               train, test, verbose, None,
    139                                               fit_params)
--> 140                       for train, test in cv_iter)
    141     return np.array(scores)[:, 0]
    142

/Users/olevinkr/anaconda/lib/python2.7/site-packages/sklearn/externals/joblib/parallel.pyc in __call__(self, iterable)
    756             # was dispatched. In particular this covers the edge
    757             # case of Parallel used with an exhausted iterator.
--> 758             while self.dispatch_one_batch(iterator):
    759                 self._iterating = True
    760             else:

/Users/olevinkr/anaconda/lib/python2.7/site-packages/sklearn/externals/joblib/parallel.pyc in dispatch_one_batch(self, iterator)
    606                 return False
    607             else:
--> 608                 self._dispatch(tasks)
    609                 return True
    610

/Users/olevinkr/anaconda/lib/python2.7/site-packages/sklearn/externals/joblib/parallel.pyc in _dispatch(self, batch)
    569         dispatch_timestamp = time.time()
    570         cb = BatchCompletionCallBack(dispatch_timestamp, len(batch), self)
--> 571         job = self._backend.apply_async(batch, callback=cb)
    572         self._jobs.append(job)
    573

/Users/olevinkr/anaconda/lib/python2.7/site-packages/sklearn/externals/joblib/_parallel_backends.pyc in apply_async(self, func, callback)
    107     def apply_async(self, func, callback=None):
    108         """Schedule a func to be run"""
--> 109         result = ImmediateResult(func)
    110         if callback:
    111             callback(result)

/Users/olevinkr/anaconda/lib/python2.7/site-packages/sklearn/externals/joblib/_parallel_backends.pyc in __init__(self, batch)
    324         # Don't delay the application, to avoid keeping the input
    325         # arguments in memory
--> 326         self.results = batch()
    327
    328     def get(self):

/Users/olevinkr/anaconda/lib/python2.7/site-packages/sklearn/externals/joblib/parallel.pyc in __call__(self)
    129
    130     def __call__(self):
--> 131         return [func(*args, **kwargs) for func, args, kwargs in self.items]
    132
    133     def __len__(self):

/Users/olevinkr/anaconda/lib/python2.7/site-packages/sklearn/model_selection/_validation.pyc in _fit_and_score(estimator, X, y, scorer, train, test, verbose, parameters, fit_params, return_train_score, return_parameters, return_n_test_samples, return_times, error_score)
    236             estimator.fit(X_train, **fit_params)
    237         else:
--> 238             estimator.fit(X_train, y_train, **fit_params)
    239
    240     except Exception as e:

/Users/olevinkr/anaconda/lib/python2.7/site-packages/keras/wrappers/scikit_learn.pyc in fit(self, X, y, **kwargs)
    146         fit_args.update(kwargs)
    147
--> 148         history = self.model.fit(X, y, **fit_args)
    149
    150         return history

/Users/olevinkr/anaconda/lib/python2.7/site-packages/keras/models.pyc in fit(self, x, y, batch_size, nb_epoch, verbose, callbacks, validation_split, validation_data, shuffle, class_weight, sample_weight, **kwargs)
    650                               shuffle=shuffle,
    651                               class_weight=class_weight,
--> 652                               sample_weight=sample_weight)
    653
    654     def evaluate(self, x, y, batch_size=32, verbose=1,

/Users/olevinkr/anaconda/lib/python2.7/site-packages/keras/engine/training.pyc in fit(self, x, y, batch_size, nb_epoch, verbose, callbacks, validation_split, validation_data, shuffle, class_weight, sample_weight, initial_epoch)
   1109                               val_f=val_f, val_ins=val_ins, shuffle=shuffle,
   1110                               callback_metrics=callback_metrics,
-> 1111                               initial_epoch=initial_epoch)
   1112
   1113     def evaluate(self, x, y, batch_size=32, verbose=1, sample_weight=None):

/Users/olevinkr/anaconda/lib/python2.7/site-packages/keras/engine/training.pyc in _fit_loop(self, f, ins, out_labels, batch_size, nb_epoch, verbose, callbacks, val_f, val_ins, shuffle, callback_metrics, initial_epoch)
    795             'metrics': callback_metrics,
    796         })
--> 797         callbacks.on_train_begin()
    798         callback_model.stop_training = False
    799         self.validation_data = val_ins

/Users/olevinkr/anaconda/lib/python2.7/site-packages/keras/callbacks.pyc in on_train_begin(self, logs)
     72     def on_train_begin(self, logs={}):
     73         for callback in self.callbacks:
---> 74             callback.on_train_begin(logs)
     75
     76     def on_train_end(self, logs={}):

/Users/olevinkr/anaconda/lib/python2.7/site-packages/heraspy/callback.pyc in on_train_begin(self, *args)
     37             {
     38                 'params': self.params,
---> 39                 'modelJson': json.loads(self.model.to_json()),
     40             }
     41         )

TypeError: 'str' object is not callable
@jakebian
Copy link
Member

jakebian commented Nov 28, 2016

Oops forgot to update the release pypi version when I changed the API in the master branch. Will update later this morning.

In the meantime if you're installing from pip, follow the instructions in an older commit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants