Skip to content

Commit

Permalink
Merge pull request #29 from Zsailer/ridge
Browse files Browse the repository at this point in the history
Add Ridge model.
  • Loading branch information
Zsailer committed Apr 10, 2018
2 parents 038afd9 + b2890ff commit 2e52c50
Show file tree
Hide file tree
Showing 29 changed files with 627 additions and 306 deletions.
7 changes: 7 additions & 0 deletions docs/api/epistasis.mapping.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
epistasis\.mapping module
-------------------------

.. automodule:: epistasis.mapping
:members:
:undoc-members:
:show-inheritance:
7 changes: 7 additions & 0 deletions docs/api/epistasis.matrix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
epistasis\.matrix module
------------------------

.. automodule:: epistasis.matrix
:members:
:undoc-members:
:show-inheritance:
26 changes: 26 additions & 0 deletions docs/api/epistasis.models.linear.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
epistasis\.models\.linear package
=================================

epistasis\.models\.linear\.lasso module
---------------------------------------

.. automodule:: epistasis.models.linear.lasso
:members:
:undoc-members:
:show-inheritance:

epistasis\.models\.linear\.ordinary module
------------------------------------------

.. automodule:: epistasis.models.linear.ordinary
:members:
:undoc-members:
:show-inheritance:

epistasis\.models\.linear\.ridge module
---------------------------------------

.. automodule:: epistasis.models.linear.ridge
:members:
:undoc-members:
:show-inheritance:
27 changes: 27 additions & 0 deletions docs/api/epistasis.models.nonlinear.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
epistasis\.models\.nonlinear package
====================================

epistasis\.models\.nonlinear\.ordinary module
---------------------------------------------

.. automodule:: epistasis.models.nonlinear.ordinary
:members:
:undoc-members:
:show-inheritance:

epistasis\.models\.nonlinear\.power module
------------------------------------------

.. automodule:: epistasis.models.nonlinear.power
:members:
:undoc-members:
:show-inheritance:


Module contents
---------------

.. automodule:: epistasis.models.nonlinear
:members:
:undoc-members:
:show-inheritance:
32 changes: 15 additions & 17 deletions docs/api/epistasis.models.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
epistasis\.models package
=========================

.. automodule:: epistasis.models.__init__
See subpackages for specific models.

.. toctree::

epistasis.models.linear
epistasis.models.nonlinear

epistasis\.models\.base module
------------------------------
Expand All @@ -19,18 +24,10 @@ epistasis\.models\.classifiers module
:undoc-members:
:show-inheritance:

epistasis\.models\.linear module
--------------------------------

.. automodule:: epistasis.models.linear
:members:
:undoc-members:
:show-inheritance:

epistasis\.models\.nonlinear module
-----------------------------------
epistasis\.models\.ensemble module
----------------------------------

.. automodule:: epistasis.models.nonlinear
.. automodule:: epistasis.models.ensemble
:members:
:undoc-members:
:show-inheritance:
Expand All @@ -43,18 +40,19 @@ epistasis\.models\.pipeline module
:undoc-members:
:show-inheritance:

epistasis\.models\.power module
epistasis\.models\.utils module
-------------------------------

.. automodule:: epistasis.models.power
.. automodule:: epistasis.models.utils
:members:
:undoc-members:
:show-inheritance:

epistasis\.models\.utils module
-------------------------------

.. automodule:: epistasis.models.utils
Module contents
---------------

.. automodule:: epistasis.models
:members:
:undoc-members:
:show-inheritance:
5 changes: 1 addition & 4 deletions docs/api/epistasis.pyplot.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
epistasis\.pyplot package
=======================

.. automodule:: epistasis.pyplot.__init__

=========================

epistasis\.pyplot\.coefs module
-------------------------------
Expand Down
2 changes: 0 additions & 2 deletions docs/api/epistasis.sampling.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
epistasis\.sampling package
===========================

.. automodule:: epistasis.sampling.__init__

epistasis\.sampling\.bayesian module
------------------------------------

Expand Down
9 changes: 8 additions & 1 deletion docs/api/epistasis.simulate.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
epistasis\.simulate package
===========================

.. automodule:: epistasis.simulate.__init__

epistasis\.simulate\.base module
--------------------------------
Expand All @@ -18,3 +17,11 @@ epistasis\.simulate\.linear module
:members:
:undoc-members:
:show-inheritance:

epistasis\.simulate\.power module
---------------------------------

.. automodule:: epistasis.simulate.power
:members:
:undoc-members:
:show-inheritance:
7 changes: 7 additions & 0 deletions docs/api/epistasis.stats.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
epistasis\.stats module
-----------------------

.. automodule:: epistasis.stats
:members:
:undoc-members:
:show-inheritance:
13 changes: 8 additions & 5 deletions docs/api/main.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@ This page lists all modules in the epitasis library. If you find missing documen
feel free to open an issue or (better yet) submit a pull request!

.. toctree::
:maxdepth: 2
:maxdepth: 2

epistasis.models
epistasis.pyplot
epistasis.sampling
epistasis.simulate
epistasis.models
epistasis.pyplot
epistasis.sampling
epistasis.simulate
epistasis.mapping
epistasis.matrix
epistasis.stats
Binary file modified docs/gallery/gallery_jupyter.zip
Binary file not shown.
Binary file modified docs/gallery/gallery_python.zip
Binary file not shown.
33 changes: 32 additions & 1 deletion docs/pages/models.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Detailed list of models
This page lists all models included in the Epistasis Package.

* EpistasisLinearRegression_: estimate epistatic coefficents in a linear genotype-phenotype map.
* EpistasisRidge_: estimate *sparse* epistatic coefficients in a linear genotype-phenotype map
* EpistasisLasso_: estimate *sparse* epistatic coefficients in a linear genotype-phenotype map
* EpistasisNonlinearRegression_: estimates high-order epistatic coefficients in a nonlinear genotype-phenotype map.
* EpistasisNonlinearLasso_: estimate *sparse* epistatic coefficients in a nonlinear genotype-phenotype map.
Expand All @@ -13,6 +14,7 @@ This page lists all models included in the Epistasis Package.
* EpistasisEnsembleRegression_: use a statistical ensemble of "states" to decompose variation in a genotype-phenotype map.

.. _EpistasisLinearRegression: models.html#epistasislinearregression
.. _EpistasisRidge: models.html#epistasisridge
.. _EpistasisLasso: models.html#epistasislasso
.. _EpistasisNonlinearRegression: models.html#epistasisnonlinearregression
.. _EpistasisNonlinearLasso: models.html#epistasisnonlinearlasso
Expand Down Expand Up @@ -51,6 +53,35 @@ genotype-phenotype map. Simple define the order of the model.
# Fit the model.
model.fit()
EpistasisRidge
--------------

A L2-norm epistasis model for estimating sparse epistatic coefficients. The
optimization function imposes a penalty on the number of coefficients and finds
the model that maximally explains the data while using the fewest coefficients.

.. code-block:: python
from gpmap import GenotypePhenotypeMap
from epistasis.models import EpistasisRidge
wildtype = 'AA'
genotypes = ['AA', 'AT', 'TA', 'TT']
phenotypes = [0.1, 0.2, 0.7, 1.2]
# Read genotype-phenotype map.
gpm = GenotypePhenotypeMap(wildtype, genotypes, phenotypes)
# Initialize the data.
model = EpistasisRidge(order=2)
# Add Genotype-phenotype map data.
model.add_gpm(gpm)
# Fit the model.
model.fit()
EpistasisLasso
--------------

Expand All @@ -61,7 +92,7 @@ the model that maximally explains the data while using the fewest coefficients.
.. code-block:: python
from gpmap import GenotypePhenotypeMap
from epistasis.models import EpistasisLinearRegression
from epistasis.models import EpistasisLasso
wildtype = 'AA'
genotypes = ['AA', 'AT', 'TA', 'TT']
Expand Down
7 changes: 2 additions & 5 deletions epistasis/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,8 @@
A library of models to decompose high-order epistasis in genotype-phenotype
maps.
"""
from .linear import EpistasisLinearRegression, EpistasisLasso
from .power import EpistasisPowerTransform, EpistasisPowerTransformLasso
from .linear import EpistasisLinearRegression, EpistasisLasso, EpistasisRidge
from .nonlinear import (EpistasisNonlinearRegression,
EpistasisNonlinearLasso,
Parameter,
Parameters)
EpistasisPowerTransform)
from .classifiers import EpistasisLogisticRegression
from .pipeline import EpistasisPipeline
3 changes: 3 additions & 0 deletions epistasis/models/linear/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from .ordinary import EpistasisLinearRegression
from .lasso import EpistasisLasso
from .ridge import EpistasisRidge

0 comments on commit 2e52c50

Please sign in to comment.