Data lab#8
Open
anuragkapale wants to merge 31 commits into
Open
Conversation
|
|
||
| # TODO: Further clean the design of this file | ||
| class AutoKaggle(BaseEstimator): | ||
| pipeline = None |
There was a problem hiding this comment.
Move the class variables to instance variables.
| p_hparams_base = None | ||
|
|
||
| def __init__(self, config=None, **kwargs): | ||
| """ |
There was a problem hiding this comment.
Follow autokeras doc string style.
| import hyperopt | ||
| from hyperopt import tpe, hp, fmin, Trials, STATUS_OK, STATUS_FAIL | ||
| from sklearn.model_selection import cross_val_score | ||
| from autokaggle.ensemblers import RankedEnsembler, StackingEnsembler |
There was a problem hiding this comment.
import modules instead of classes.
| m_hparams_base = None | ||
| p_hparams_base = None | ||
|
|
||
| def __init__(self, config=None, **kwargs): |
There was a problem hiding this comment.
Explicitly clarify all the arguments instead of using kwargs.
| x: A numpy.ndarray instance containing the training data. | ||
| y: training label vector. | ||
| time_limit: remaining time budget. | ||
| data_info: meta-features of the dataset, which is an numpy.ndarray describing the |
There was a problem hiding this comment.
A list of strings. (specify the type)
| self.pipeline.fit(x_train, y_train) | ||
|
|
||
| def resample(self, x, y): | ||
| if self.config.balance_class_dist: |
| return x, y | ||
|
|
||
| def subsample(self, x, y, sample_percent): | ||
| # TODO: Add way to balance the subsample |
| return grid_train_x, grid_train_y | ||
|
|
||
| def search(self, x, y, prep_space, model_space): | ||
| grid_train_x, grid_train_y = self.subsample(x, y, sample_percent=self.config.subsample_ratio) |
There was a problem hiding this comment.
set maximum line length to 85, and check with CI using flake 8.
| np.random.shuffle(best_trials) | ||
|
|
||
| if self.config.diverse_ensemble: | ||
| estimator_list = self.pick_diverse_estimators(best_trials, self.config.num_estimators_ensemble) |
| return np.array(data_info) | ||
|
|
||
|
|
||
| class AutoKaggleClassifier(AutoKaggle): |
| return score_metric, skf | ||
|
|
||
|
|
||
| class AutoKaggleRegressor(AutoKaggle): |
| self.ensembling_algo = hyperopt.rand.suggest if ensembling_algo == 'random' else hyperopt.tpe.suggest | ||
| self.num_p_hparams = num_p_hparams | ||
|
|
||
| def update(self, options): |
| setattr(self, k, v) | ||
|
|
||
|
|
||
| knn_classifier_params = { |
There was a problem hiding this comment.
Use all capital letters for constants.
| } | ||
|
|
||
|
|
||
| class RankedEnsembler: |
There was a problem hiding this comment.
Extract a base class , function should raise not implemented error.
- Extend object class.
- Rename to RankEnsembleModel
- Doc strings.
| self.stacking_estimator = self.search(predictions, y_val) | ||
| self.stacking_estimator.fit(predictions, y_val) | ||
|
|
||
| def search(self, x, y): |
| LEVEL_HIGH = 32 | ||
|
|
||
|
|
||
| class TabularPreprocessor(TransformerMixin): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.