https://github.com/amueller/patsylearn

Patsy Adaptors for Scikit-learn

https://github.com/amueller/patsylearn

Science Score: 23.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
    1 of 5 committers (20.0%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (5.0%) to scientific vocabulary

Keywords from Contributors

version
Last synced: 11 months ago · JSON representation

Repository

Patsy Adaptors for Scikit-learn

Basic Info
  • Host: GitHub
  • Owner: amueller
  • License: gpl-2.0
  • Language: Python
  • Default Branch: master
  • Size: 22.5 KB
Statistics
  • Stars: 48
  • Watchers: 4
  • Forks: 11
  • Open Issues: 5
  • Releases: 1
Created almost 11 years ago · Last pushed over 7 years ago
Metadata Files
Readme License

README.md

Patsy-Learn

A simple patsy to scikit-learn adaptor. Be aware that the content of this package is pretty experimental. Feedback welcome.

This package provides two classes:

  • A scikit-learn meta-estimator PatsyModel, that feeds the design matrix created by patsy into a scikit-learn estimator.
  • A scikit-learn transformer, that uses a patsy formula to transform and select features.

Both classes work on pandas DataFrames. If you want to use PatsyModel for a supervised estimator, the input dataframe is expected to contain both the data and the target.

Example

```python

put the iris dataset into a pandas dataframe

from sklearn.datasets import load_iris import pandas as pd

iris = loadiris() names = [fname.replace(" ", "").strip("(cm)") for fname in iris.featurenames] irisdf = pd.DataFrame(iris.data, columns=names) irisdf['species'] = iris.target

create logistic regression with two features

from patsylearn import PatsyModel from sklearn.linearmodel import LogisticRegression model = PatsyModel(LogisticRegression(), "species ~ sepallength + petal_length")

model is an sklearn estimator.

from sklearn.crossvalidation import traintestsplit datatrain, datatest = traintestsplit(irisdf) model.fit(datatrain) print(model.score(datatest))

use PatsyTransformer to just select and transform features

transformer = PatsyTransformer("sepallength + np.log(petallength) + petallength:sepalwidth")

transformer is a scikit-learn transformer

transformer.fit(data) print(transformer.transform(data).shape) ```

Owner

  • Name: Andreas Mueller
  • Login: amueller
  • Kind: user
  • Location: Los Gatos
  • Company: Microsoft

Scikit-learn core-developer, Principal Research SDE @microsoft

GitHub Events

Total
Last Year

Committers

Last synced: about 1 year ago

All Time
  • Total Commits: 17
  • Total Committers: 5
  • Avg Commits per committer: 3.4
  • Development Distribution Score (DDS): 0.235
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Andreas Mueller a****r@n****u 13
scls19fr s****r 1
giorgiop g****i@n****u 1
Pierre Navaro p****o 1
root a****v@g****m 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: about 1 year ago

All Time
  • Total issues: 9
  • Total pull requests: 7
  • Average time to close issues: 8 months
  • Average time to close pull requests: about 1 year
  • Total issue authors: 4
  • Total pull request authors: 5
  • Average comments per issue: 1.11
  • Average comments per pull request: 2.14
  • Merged pull requests: 4
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • amueller (5)
  • jnothman (2)
  • pnavaro (1)
  • sashaostr (1)
Pull Request Authors
  • sashaostr (3)
  • ceholden (2)
  • giorgiop (1)
  • pnavaro (1)
  • scls19fr (1)
Top Labels
Issue Labels
Pull Request Labels

Dependencies

requirements.txt pypi
  • patsy >=0.4
  • scikit-learn >=0.16
setup.py pypi