def fit(self, data_matrix, data_matrix_neg, random_state=None): if random_state is not None: random.seed(random_state) # use eden to fitoooOoO self.estimator = eden_fit_estimator(self.classifier, positive_data_matrix=data_matrix, negative_data_matrix=data_matrix_neg, cv=self.cv, n_jobs=self.n_jobs, n_iter_search=10, random_state=random_state) self.cal_estimator = self.estimator self.status = 'trained' return self
def fit_estimator(self, data_matrix, n_jobs=-1, cv=2, random_state=42): ''' create self.estimator... by inversing the data_matrix set to get a negative set and then using edens fit_estimator ''' # make negative set data_matrix_neg = data_matrix.multiply(-1) return eden_fit_estimator(self.classifier, positive_data_matrix=data_matrix, negative_data_matrix=data_matrix_neg, cv=cv, n_jobs=n_jobs, n_iter_search=10, random_state=random_state)
def fit_estimator(self, data_matrix, n_jobs=-1, cv=2, random_state=42): ''' create self.estimator... by inversing the data_matrix set to get a negative set and then using edens fit_estimator ''' # create negative set: data_matrix_neg = data_matrix.multiply(-1) # i hope loss is log.. not 100% sure.. # probably calibration will fix this# return eden_fit_estimator(SGDClassifier(loss='log'), positive_data_matrix=data_matrix, negative_data_matrix=data_matrix_neg, cv=cv, n_jobs=n_jobs, n_iter_search=10, random_state=random_state)
def make_estimator(pos,neg): pos = vectorizer.transform( pos ) neg = vectorizer.transform( neg ) esti = eden_fit_estimator(SGDClassifier(), positive_data_matrix=pos, negative_data_matrix=neg) return esti
def get_estimator(it_pos, it_neg): pos = vect.transform(it_pos) neg = vect.transform(it_neg) return eden_fit_estimator(SGDClassifier(), pos, neg)
def get_estimator(it_pos, it_neg): pos= vect.transform(it_pos) neg = vect.transform(it_neg) return eden_fit_estimator(SGDClassifier(),pos,neg)