a python library for quickly building and evaluating models
Project description
litelearn
a python library for building models without fussing over the nitty gritty details for data munging
installation
pip install litelearn
usage
once you have a pandas
dataframe you can create a model
for your dataset in 3 lines of code:
Regression
# load some dataset
import seaborn as sns
dataset = "penguins"
target = "body_mass_g"
df = sns.load_dataset(dataset).dropna(subset=[target])
# just 3 lines of code to create and evaluate a model
import litelearn as ll
model = ll.regress_df(df, target)
model.display_evaluation()
Classification
# load some dataset
import seaborn as sns
dataset = "penguins"
target = "species"
df = sns.load_dataset(dataset).dropna(subset=[target])
# just 3 lines of code to create and evaluate a model
import litelearn as ll
model = ll.classify_df(df, target)
model.display_evaluation()
Prediction
prediction is easy too, it will work on any data that resembles the training data. dtypes don't have to match, and you can even have extra columns in your prediction data. missing values and unknown categories will be imputed with the training data's values.
df = ... # load some dataframe
split = int(len(df) * 0.8)
train_df, val_df = df[:split], df[split:]
model = ... # build some model
pred = model.predict(val) # predict on unseen data
features
- does all the data munging for you, including missing data, categorical data handling
- uses the robust catboost library for gradient boosting, which is known for generating high quality models with little tuning
- supports shap for explainability.
call
model.display_shap()
ormodel.get_shap()
to get the shap values for your model - supports sklearn's permutation importance
call
model.display_permutation_importance()
ormodel.get_permutation_importance()
to get feature importances that are biased towards the model's performance on test data. - supports easy pickling: to save your model simply call
model.save("path/to/model.pkl")
and to load your model callmodel.load("path/to/model.pkl")
- for regression models, you can call
model.display_residuals()
to see the residuals of your model - it also supports segmeents for your data using the
model.set_segments()
method. this will create a new column in your dataframe calledsegment
which you can use to group your data. this is useful for seeing how your model performs on different segments of your data.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
litelearn-0.3.0.tar.gz
(12.9 kB
view details)
Built Distribution
litelearn-0.3.0-py3-none-any.whl
(15.2 kB
view details)
File details
Details for the file litelearn-0.3.0.tar.gz
.
File metadata
- Download URL: litelearn-0.3.0.tar.gz
- Upload date:
- Size: 12.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.4.2 CPython/3.9.15 Windows/10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 80f0d56c30b624c62b51c294ee05bd312d9f4ced362976fbc10a52e934f6409c |
|
MD5 | 951a2a910ec04c0d81510cc133599a1e |
|
BLAKE2b-256 | eeb4c7e2d27a8d6fa28e39d1c4c96b17051fa5522ee26b8dba83f056fd9a6252 |
File details
Details for the file litelearn-0.3.0-py3-none-any.whl
.
File metadata
- Download URL: litelearn-0.3.0-py3-none-any.whl
- Upload date:
- Size: 15.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.4.2 CPython/3.9.15 Windows/10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4a065fed8cd07ce8804d489361792bbb6029b15a30af1719f18744042198e9f3 |
|
MD5 | 3f8cdea323be31a299427d55ac10d6ad |
|
BLAKE2b-256 | 72b6dccea9ec4fda687a8eabba4eca3b42d42d86ba49327f8fe4343ec6ebb23f |