Skip to main content

RandomizedSearchCV/GridSearchCV with pandas.DataFrame interface

Project description

sklearn-cv-pandas

RandomizedSearchCV/GridSearchCV with pandas.DataFrame interface

Installation

pip install sklearn_cv_pandas

Usage

To tune hyper parameters, instantiate CV as the same as original ones, and use methods fit_sv_pandas or fit_cv_pandas

from scipy import stats
from sklearn import linear_model
from sklearn_cv_pandas import RandomizedSearchCV

estimator = linear_model.Lasso()
param_dist = dict(alpha=stats.loguniform(1e-5, 10))
cv = RandomizedSearchCV(estimator, param_dist, scoring="mean_absolute_error")
model = cv.fit_cv_pandas(
    df, target_column="y", feature_columns=["x{}".format(i) for i in range(100)], n_fold=5
)

To make prediction, use method predict of the output of fit_sv_pandas or fit_cv_pandas

model.predict(df)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sklearn_cv_pandas-0.0.1.tar.gz (5.0 kB view hashes)

Uploaded Source

Built Distribution

sklearn_cv_pandas-0.0.1-py3-none-any.whl (7.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page