Skip to content

Commit 9789ac2

Browse files
committed
Add intro to README
1 parent e88e2ce commit 9789ac2

File tree

2 files changed

+76
-0
lines changed

2 files changed

+76
-0
lines changed

README.rst

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,82 @@ PySensors
66

77
.. contents:: Table of contents
88

9+
Sparse sensor placement
10+
-----------------------
11+
12+
Sparse sensor placement concerns the problem of selecting a small subset
13+
of sensor or measurement locations in a way that allows one to perform
14+
some task nearly as well as if one had access to measurements at *every*
15+
location.
16+
17+
PySensors provides objects designed for the tasks of *reconstruction* and
18+
*classification*.
19+
20+
21+
Reconstruction
22+
^^^^^^^^^^^^^^
23+
Reconstruction deals with predicting the values of a quantity of interest at different locations other than those where sensors are located.
24+
For example, one might predict the temperature at a point in the middle of a lake based on temperature readings taken at various other positions in the lake.
25+
26+
PySensors provides the `SensorSelector` class to aid in the solution of
27+
reconstruction problems.
28+
29+
Take representative examples of the types of data to be reconstructed (in this case polynomials)
30+
31+
..code-block:: python
32+
33+
x = numpy.linspace(0, 1, 1001)
34+
data = numpy.vander(x, 11).T # Select
35+
36+
and feed them into a `SensorSelector`
37+
38+
..code-block:: python
39+
40+
model = pysensors.Sensorselector(n_sensors=10)
41+
model.fit(x)
42+
43+
Use the `predict` method to reconstruct a new function sampled at the chosen sensor locations:
44+
45+
..code-block:: python
46+
47+
f = numpy.abs(x[method.selected_sensors]**2 - 0.5)
48+
f_pred = model.predict(f)
49+
50+
.. figure:: ../docs/figures/vandermonde.png
51+
:align: center
52+
:alt: A plot showing the function to be reconstructed, the learned sensor locations, and the reconstruction.
53+
:figclass: align-center
54+
55+
A plot showing the function to be reconstructed (black, dashed), the learned sensor locations (blue, circles), and the reconstruction (blue, solid).
56+
57+
Classification
58+
^^^^^^^^^^^^^^
59+
Classification is the problem of predicting which category an example belongs to, given a set of training data (e.g. determining whether digital photos are of dogs or cats).
60+
The `SSPOC` class is used to solve classification problems.
61+
Users familiar with Scikit-learn will find it intuitive:
62+
63+
.. code-block:: python
64+
65+
model = pysensors.classification.SSPOC()
66+
model.fit(x, y) # Learn sensor locations and fit a linear classifier
67+
y_pred = model.predict(x_test[:, model.selected_sensors]) # Get predictions
68+
69+
See our set of `classification examples <https://python-sensors.readthedocs.io/en/latest/examples/classification.html>`__ for more information.
70+
71+
Bases
72+
^^^^^
73+
The basis in which measurement data are represented can have a dramatic
74+
effect on performance. PySensors implements the three bases most commonly
75+
used for sparse sensor placement: raw measurements, SVD/POD/PCA modes, and random projections. Bases can be easily incorporated into `SensorSelector` and `SSPOC` classes:
76+
77+
.. code-block:: python
78+
79+
basis = pysensors.basis.SVD(n_basis_modes=20)
80+
recon_model = pysensors.SensorSelector(basis=basis)
81+
class_model = pysensors.classification.SSPOC(basis=basis)
82+
83+
See `this example <https://python-sensors.readthedocs.io/en/latest/examples/basis_comparison.html>`__ for further discussion of these options.
84+
985
Installation
1086
-------------
1187

docs/figures/vandermonde.png

18.3 KB
Loading

0 commit comments

Comments
 (0)