Giter Club home page Giter Club logo

crosspy's Introduction

CrossPy

The CrossPy package (short for Cross-validation in Python) is a package for performing cross-validation in Python.

Build Status

Contributors

  • Nazli Ozum Kafaee / @nazliozum
  • Daniel Raff / @raffrica
  • Shun Chi / @ShunChi100

Summary

Cross-validation is an important technique used in model selection and hyper-parameter optimization. Scores from cross-validation are a good estimation of test score of a predictive model in test data or new data as long as the IID assumption approximately holds in data. This package aims to provide a standardized pipeline for performing cross-validation for different modeling functions in Python. In addition, summary statistics of the cross-validation results are provided for users.

Functions

Three main functions in CrossPy:

  • train_test_split(): This function split data according to input train/all ratio returns the split data. A random shuffling option is provided.

  • cross_validation(): This function performs k-fold cross validation using the partitioned data and a selected model. It returns the scores of each validation. Additional methods for cross validation will be implemented (such as "Leave-One-Out" if time allows).

  • summary_cv(): This function outputs summary statistics(mean, standard deviation, mode, median) of cross-validation scores.

Examples

To install the package:

pip install git+https://github.com/UBCMDS/CrossPy.git

Given X (features) and y (targets) as pandas dataframes, one can split the data with default test size 0.25 as the following:

from CrossPy import *
X_train, X_test, y_train, y_test = train_test_split(X, y)

To do cross-validation on X, y using the sklearn LinearRegression() model:

lm = LinearRegression()
scores = cross_validation(lm, X, y)

To see the summary of scores:

summary_cv(scores)

For more options of these functions, please see the documentation and source codes.

Similar packages

The scikit-learn library in Python implements the first two functions we propose in sklearn.model_selection.train_test_split and sklearn.cross_validation.

License

MIT License

Contributing

This is an open source project. So feedback, suggestions and contributions are very welcome. For feedback and suggestions, please open an issue in this repo. If you are willing to contribute this package, please refer Contributing guidelines for details.

crosspy's People

Contributors

shunchi100 avatar nazliozum avatar raffrica avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.