# cvopt.model_selection.SimpleoptCV¶

class `SimpleoptCV`(estimator, param_distributions, scoring=None, cv=5, max_iter=32, random_state=None, n_jobs=1, pre_dispatch='2*n_jobs', verbose=0, logdir=None, save_estimator=0, saver='sklearn', model_id=None, cloner='sklearn', refit=True, backend='hyperopt', **kwargs)[source]

Each cross validation optimizer class’s wrapper.

This class allow unified handling in different type backend.

For each backend optimizer class, refer to each class`s page.

Parameters: estimator – scikit-learn estimator like. param_distributions (dict.) – Search space. scoring (string or sklearn.metrics.make_scorer.) – Evaluation index of search. When scoring is None, use stimator default scorer and this score greater is better. cv (scikit-learn cross-validator or int(number of folds), default=5.) – Cross validation setting. max_iter (int, default=32.) – Number of search. random_state (int or None, default=None.) – The seed used by the random number generator. n_jobs (int, default=1.) – Number of jobs to run in parallel. pre_dispatch (int or string, default="2*n_jobs".) – Controls the number of jobs that get dispatched during parallel. verbose (int(0, 1 or 2), default=0.) – Controls the verbosity 0: don’t display status. 1: display status by stdout. 2: display status by graph. logdir (str or None, default=None.) – Path of directory to save log file. When logdir is None, log is not saved. [directory structure] logdir |-cv_results |-{model_id}.csv : search log … |-cv_results_graph |-{model_id}.html : search log(graph) … |-estimators_{model_id} |-{model_id}_index{search count}_split{fold count}.pkl: an estimator which is fitted fold train data… |-{model_id}_index{search count}_test.pkl : an estimator which is fitted whole train data. save_estimator (int, default=0.) – estimator save setting. 0: An estimator is not saved. 1: An estimator which is fitted fold train data is saved per cv-fold. 2: In addition to 1, an estimator which is fitted whole train data is saved per cv. saver (str or function, default="sklearn".) – estimator`s saver. sklearn: use sklearn.externals.joblib.dump. Basically for scikit-learn. function: function whose variable are model class and save path. Examples ```>>> def saver(model, path): >>> save_model(model, path+".h5") ``` model_id (str or None, default=None.) – This is used to log filename. When model_id is None, this is generated by date time. cloner (str or function, default="sklearn".) – estimator`s cloner. sklearn: use try:sklearn.base.clone, except:copy.deepcopy. Basically for scikit-learn. function: function whose variable is model. Examples ```>>> def cloner(model): >>> clone_model(model) ``` refit (bool, default=True.) – Refit an estimator using the best found parameters on all train data(=X). backend (str, default="hyperopt".) – backend optimeizer. Supports the following back ends. hyperopt: Sequential Model Based Global Optimization bayesopt: Bayesian Optimization gaopt: Genetic Algorithm randomopt: Random Search
`cv_results_`

dict of numpy (masked) ndarrays – A dict with keys as column headers and values as columns, that can be imported into a pandas `DataFrame`.

`best_estimator_`

estimator or dict – Estimator that was chosen by the search.

`best_score_`

float – Cross-validated score of the best_estimator.

`best_params_`

dict – Parameter setting that gave the best results on the hold out data.

Methods

 `__init__`(estimator, param_distributions[, …])
{"ft_lang_label":"__label__en","ft_lang_prob":0.61252475,"math_prob":0.81332064,"size":3297,"snap":"2020-24-2020-29","text_gpt3_token_len":829,"char_repetition_ratio":0.13179472,"word_repetition_ratio":0.0349345,"special_character_ratio":0.25993326,"punctuation_ratio":0.21440536,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9770874,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2020-07-15T00:54:53Z\",\"WARC-Record-ID\":\"<urn:uuid:c248d7c4-9078-4b9e-b88d-57e7b1fbc7fe>\",\"Content-Length\":\"16009\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:000bce94-8287-4f5a-bb70-6d8d26262a04>\",\"WARC-Concurrent-To\":\"<urn:uuid:079ac376-4ed2-4fc9-8e9e-3bb053bbb646>\",\"WARC-IP-Address\":\"185.199.110.153\",\"WARC-Target-URI\":\"https://genfifth.github.io/cvopt/modules/model_selection/cvopt.model_selection.SimpleoptCV.html\",\"WARC-Payload-Digest\":\"sha1:OH3W7OEE5PTXA2CJRH7GONOT6DMN73VY\",\"WARC-Block-Digest\":\"sha1:4GEB3RP4Y777JKJ6NH2VD4UW3FOZHRNL\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2020/CC-MAIN-2020-29/CC-MAIN-2020-29_segments_1593657154789.95_warc_CC-MAIN-20200715003838-20200715033838-00040.warc.gz\"}"}