Skip to content

Commit

Permalink
Update version, readme, added changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
Nate Kupp committed Dec 20, 2019
1 parent fa0bac2 commit 0e1552a
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 28 deletions.
10 changes: 10 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Changes

## 2.0.0

- Added a Makefile
- Substantially refactored FFX to modernize the codebase. Broke up `core.py` into a module.
- Replaced custom CLI tooling with Click
- Adopted pytest for tests; improved test coverage
- Updated Travis CI to use a modern Python build matrix
- Added pylint, isort, black. See the `make validate` command
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ isort:
validate: pylint isort black

pypi:
rm dist/*
rm -rf dist/*
python setup.py sdist bdist_egg bdist_wheel
twine upload dist/*
#twine upload --repository-url https://test.pypi.org/legacy/ dist/* # testpypi
Expand Down
60 changes: 34 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#FFX: Fast Function Extraction
# FFX: Fast Function Extraction

[![Build Status at Travis CI](https://travis-ci.org/natekupp/ffx.svg?branch=master)](https://travis-ci.org/natekupp/ffx)
[![Coverage Status](https://coveralls.io/repos/github/natekupp/ffx/badge.svg?branch=master)](https://coveralls.io/github/natekupp/ffx?branch=master)
Expand All @@ -13,54 +13,62 @@ FFX is a technique for symbolic regression. It is:

To install from PyPI, simply run:

pip install ffx
```shell
pip install ffx
```

## Usage

FFX can either be run in stand-alone mode, or within your existing Python code using its own API or a Scikit-learn style API. It installs both a command-line utility `runffx` and the Python module `ffx`.
FFX can either be run in stand-alone mode, or within your existing Python code using its own API or a Scikit-learn style API. It installs both a command-line utility `ffx` and the Python module `ffx`.

**Standalone**

runffx test train_X.csv train_y.csv test_X.csv test_y.csv
```shell
ffx test train_X.csv train_y.csv test_X.csv test_y.csv
```

Use `runffx help` for more information on using the command-line utility.
Use `ffx help` for more information on using the command-line utility.

**Python Module (run interface)**

The FFX Python module exposes a function, `ffx.run()`. The following snippet is a simple example of how to use FFX this way. Note that all arguments are expected to be of type `numpy.ndarray` or `pandas.DataFrame`.

import numpy as np
import ffx
```python
import numpy as np
import ffx

train_X = np.array( [ (1.5,2,3), (4,5,6) ] ).T
train_y = np.array( [1,2,3])
train_X = np.array( [ (1.5,2,3), (4,5,6) ] ).T
train_y = np.array( [1,2,3])

test_X = np.array( [ (5.241,1.23, 3.125), (1.1,0.124,0.391) ] ).T
test_y = np.array( [3.03,0.9113,1.823])
test_X = np.array( [ (5.241,1.23, 3.125), (1.1,0.124,0.391) ] ).T
test_y = np.array( [3.03,0.9113,1.823])

models = ffx.run(train_X, train_y, test_X, test_y, ["predictor_a", "predictor_b"])
for model in models:
yhat = model.simulate(test_X)
print(model)
models = ffx.run(train_X, train_y, test_X, test_y, ["predictor_a", "predictor_b"])
for model in models:
yhat = model.simulate(test_X)
print(model)
```

**Scikit-Learn interface**

The FFX Python module also exposes a class, `ffx.FFXRegressor` which provides a Scikit-learn API, in particular `fit(X, y)`, `predict(X)`, and `score(X, y)` methods. In this API, all of the models produced by FFX (the whole Pareto front) are accessible after `fit()`ing as `_models`, but `predict()` and `score()` will use only the model of highest accuracy and highest complexity. Here is an example of usage.

import numpy as np
import ffx
```python
import numpy as np
import ffx

# This creates a dataset of 2 predictors
X = np.random.random((20, 2))
y = 0.1 * X[:, 0] + 0.5 * X[:, 1]
# This creates a dataset of 2 predictors
X = np.random.random((20, 2))
y = 0.1 * X[:, 0] + 0.5 * X[:, 1]

train_X, test_X = X[:10], X[10:]
train_y, test_y = y[:10], y[10:]
train_X, test_X = X[:10], X[10:]
train_y, test_y = y[:10], y[10:]

FFX = ffx.FFXRegressor()
FFX.fit(train_X, train_y)
print("Prediction:", FFX.predict(test_X))
print("Score:", FFX.score(test_X, test_y))
FFX = ffx.FFXRegressor()
FFX.fit(train_X, train_y)
print("Prediction:", FFX.predict(test_X))
print("Score:", FFX.score(test_X, test_y))
```

## Technical details

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name='ffx',
version='1.4.0',
version='2.0.0',
author='Trent McConaghy',
author_email='gtrent@gmail.com',
maintainer='Nate Kupp',
Expand Down

0 comments on commit 0e1552a

Please sign in to comment.