Skip to content
This repository has been archived by the owner on Dec 6, 2023. It is now read-only.

Commit

Permalink
Made example faster and changed text a little
Browse files Browse the repository at this point in the history
  • Loading branch information
jcrudy committed Aug 10, 2016
1 parent 2fd266c commit dd9bea3
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions examples/return_sympy.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
"""
============================================
Returning a sympy expression for a simple sine function
============================================
=====================================================
Exporting a fitted Earth models as a sympy expression
=====================================================
A simple example returning a sympy expression describing the fit of a sine function computed by Earth.
"""

import numpy
import matplotlib.pyplot as plt

from pyearth import Earth
from pyearth import export

# Create some fake data
numpy.random.seed(2)
m = 1000
n = 10
X = 80 * numpy.random.uniform(size=(m, n)) - 40
X = 10 * numpy.random.uniform(size=(m, n)) - 40
y = 100 * \
(numpy.sin((X[:, 6])) - 4.0) + \
10 * numpy.random.normal(size=m)
Expand All @@ -29,5 +27,6 @@
print(model.summary())

#return sympy expression
print('Resulting sympy expression:')
print(export.export_sympy(model))

0 comments on commit dd9bea3

Please sign in to comment.