Skip to main content

sklearn-cv-pandas

RandomizedSearchCV/GridSearchCV with pandas.DataFrame interface

Installation

pip install sklearn_cv_pandas

Usage

Configure CV object

Instantiate CV in the same manner as original ones.

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")

Fit with pandas.DataFrame

Our CV object has new methods fit_sv_pandas and fit_cv_pandas. Original ones requires x and y as numpy.array. Instead of numpy array, you can specify one pandas.DataFrame and column names for x (feature_columns), and column name of y (target_column).

model = cv.fit_cv_pandas(
    df, target_column="y", feature_columns=["x{}".format(i) for i in range(100)], n_fold=5
)

You can run prediction with pandas.DataFrame interface as well. Output of fit_sv_pandas and fit_cv_pandas stores feature_columns and target_column. You can just input pandas.DataFrame for prediction into the method predict.

model.predict(df)

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.4.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sklearn_cv_pandas-0.0.4-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file sklearn_cv_pandas-0.0.4.tar.gz.

File metadata

  • Download URL: sklearn_cv_pandas-0.0.4.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.1 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.8.2

File hashes

Hashes for sklearn_cv_pandas-0.0.4.tar.gz
Algorithm Hash digest
SHA256 14183a8f4728161105ef89d7bf7cde31f14333c91ef24d3f71719f336aad6fbf
MD5 acf28f3adad01a6971ddc5ff8267d33d
BLAKE2b-256 05a8bc80cc4bedcc8d52f0d150e28cd3069713324832a3e7fa7ec46a73b96a2b

See more details on using hashes here.

File details

Details for the file sklearn_cv_pandas-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: sklearn_cv_pandas-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 7.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.1 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.8.2

File hashes

Hashes for sklearn_cv_pandas-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 9e5e35a74f171845a6ce9b126148444103a344de7033a955d154747c04bca570
MD5 f8ab7a5bd37d72b07f5ec0645a177ab8
BLAKE2b-256 40181b754bda36eb866b65f4365d66d6452e033788fa037a1ed42f751286c8d5

See more details on using hashes here.

Release history Release notifications | RSS feed

0.1.0

2 files

0.0.12

2 files

0.0.11

2 files

0.0.10

2 files

0.0.9

2 files

0.0.7

2 files

0.0.6

2 files

0.0.5

2 files

This release

0.0.4 This release

2 files

0.0.3

2 files

0.0.2

2 files

0.0.1

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page