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
)
predict with pandas.DataFrame
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sklearn_cv_pandas-0.0.5.tar.gz.
File metadata
- Download URL: sklearn_cv_pandas-0.0.5.tar.gz
- Upload date:
- Size: 6.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/3.4.1 importlib_metadata/4.0.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
42023bc545384e59cd9b47501dd908974a79848e753505d4b425be10700477b3
|
|
| MD5 |
80f0c5588be5219eba7c501b8ab9ce89
|
|
| BLAKE2b-256 |
f034295dc49f8c00d080a9f2ca36b820032d60adfb68825e1999b93b15cc1f1f
|
File details
Details for the file sklearn_cv_pandas-0.0.5-py3-none-any.whl.
File metadata
- Download URL: sklearn_cv_pandas-0.0.5-py3-none-any.whl
- Upload date:
- Size: 7.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/3.4.1 importlib_metadata/4.0.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e8af1cdd64ed4beb774fbfb303dfc5cf6d2c71c0061bba89af722b83b63b7130
|
|
| MD5 |
3f29066a17c335f97caedee3728d1013
|
|
| BLAKE2b-256 |
cc2d2fa95daba3e86652fb9ffbc49430d5db2d4ba012670d3c966319f0f28bd8
|