On 07/26/2013 10:01 AM, Lars Buitinck wrote: > 2013/7/26 Andreas Mueller <[email protected]>: >> If you are ok with relying on scikit-learn, you can inherit from >> BaseEstimator and ClassifierMixin, then implement fit, predict and >> __init__ (to set the parameters). > We could add some code skeletons to that, like > > class MajorityClassifier(BaseEstimator, ClassifierMixin): > """Predicts the majority class of its training data.""" > > def __init__(self): > pass > > def fit(self, X, y): > self.classes_, indices = np.unique(["foo", "bar", "foo"], > return_inverse=True) > self.majority_ = np.argmax(np.bincount(indices)) > > def predict(self, X): > return np.repeat(self.classes_[self.majority_], len(X)) > +1
------------------------------------------------------------------------------ See everything from the browser to the database with AppDynamics Get end-to-end visibility with application monitoring from AppDynamics Isolate bottlenecks and diagnose root cause in seconds. Start your free trial of AppDynamics Pro today! http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk _______________________________________________ Scikit-learn-general mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/scikit-learn-general
