|
| 1 | +// Licensed to the Apache Software Foundation (ASF) under one |
| 2 | +// or more contributor license agreements. See the NOTICE file |
| 3 | +// distributed with this work for additional information |
| 4 | +// regarding copyright ownership. The ASF licenses this file |
| 5 | +// to you under the Apache License, Version 2.0 (the |
| 6 | +// "License"); you may not use this file except in compliance |
| 7 | +// with the License. You may obtain a copy of the License at |
| 8 | +// |
| 9 | +// http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +// |
| 11 | +// Unless required by applicable law or agreed to in writing, |
| 12 | +// software distributed under the License is distributed on an |
| 13 | +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 14 | +// KIND, either express or implied. See the License for the |
| 15 | +// specific language governing permissions and limitations |
| 16 | +// under the License. |
| 17 | + |
| 18 | +//! Density sketch implementation for density estimation from streaming data. |
| 19 | +//! |
| 20 | +//! The sketch maintains a coreset of points using a compaction scheme and |
| 21 | +//! provides density estimates at query points via a kernel function. |
| 22 | +//! |
| 23 | +//! # Usage |
| 24 | +//! |
| 25 | +//! ```rust |
| 26 | +//! # use datasketches::density::DensitySketch; |
| 27 | +//! let mut sketch: DensitySketch<f64> = DensitySketch::new(10, 3); |
| 28 | +//! sketch.update(vec![0.0, 0.0, 0.0]); |
| 29 | +//! sketch.update(vec![1.0, 2.0, 3.0]); |
| 30 | +//! let estimate = sketch.estimate(&[0.0, 0.0, 0.0]); |
| 31 | +//! assert!(estimate > 0.0); |
| 32 | +//! ``` |
| 33 | +
|
| 34 | +mod serialization; |
| 35 | +mod sketch; |
| 36 | + |
| 37 | +pub use self::sketch::DensityItem; |
| 38 | +pub use self::sketch::DensityKernel; |
| 39 | +pub use self::sketch::DensitySketch; |
| 40 | +pub use self::sketch::DensityValue; |
| 41 | +pub use self::sketch::GaussianKernel; |
0 commit comments