Skip to content

Instantly share code, notes, and snippets.

View bmcfee's full-sized avatar

Brian McFee bmcfee

View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@bmcfee
bmcfee / Instrument tag extraction.ipynb
Created July 23, 2014 20:35
Instrument keyword extraction heuristics
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@bmcfee
bmcfee / gist:dd267dae2f02bfc58752
Created July 24, 2014 21:27
OVR-friendly grid search
# SKLearn's one-vs-rest class requires that the (binary) estimator object implements decision_function() or predict_proba().
# If you want the internal estimator to contain a parameter sweeping layer (so that each ovr classifier gets optimized separately),
# this fails due to the following chain of events:
#
# 1. OVR checks `hasattr(estimator, 'predict_proba')` at construction time
# 2. `hasattr()` tries to call `getattr(estimator, 'predict_proba')` and fails if an exception is thrown
# 3. Because the estimator has not yet been fit, it has no `best_estimator_` property, so it throws an exception and fails
# 4. `hasattr()` misinterprets this exception, and returns false.
#
# We can circumvent this probelm by putting a wrapper on the predict_proba and decision_function methods, but this is a dirty, dirty hack.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.