Skip to content

Commit bca39d0

Browse files
committed
docs:Example script.
1 parent 8b82bd9 commit bca39d0

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

examples/Random-data-regressions.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
from Regressionizer.Regressionizer import Regressionizer
3+
4+
import numpy
5+
from scipy.stats import norm
6+
7+
numpy.random.seed(0)
8+
x = numpy.linspace(0, 2, 240)
9+
y = numpy.sin(2 * numpy.pi * x) + numpy.random.normal(0, 0.4, x.shape)
10+
data = numpy.column_stack((x, y))
11+
12+
dist_data = numpy.array([[x, numpy.exp(-x ** 2) + norm.rvs(scale=0.15)] for x in numpy.arange(-3, 3.2, 0.2)])
13+
funcs = [lambda x: 1, lambda x: x, lambda x: numpy.cos(x), lambda x: numpy.cos(3 * x), lambda x: numpy.cos(6 * x)]
14+
15+
obj = Regressionizer(data).quantile_regression(knots=5, probs=[0.2, 0.5, 0.8])
16+
17+
print(obj.take_value())
18+
19+
print(obj.outliers().take_value())
20+
21+
print(obj.outliers_plot(date_list_plot=True))
22+

0 commit comments

Comments
 (0)