class KernelDensity extends Serializable
Kernel density estimation. Given a sample from a population, estimate its probability density function at each of the given evaluation points using kernels. Only Gaussian kernel is supported.
Scala example:
val sample = sc.parallelize(Seq(0.0, 1.0, 4.0, 4.0)) val kd = new KernelDensity() .setSample(sample) .setBandwidth(3.0) val densities = kd.estimate(Array(-1.0, 2.0, 5.0))
- Annotations
- @Since( "1.4.0" )
- Source
- KernelDensity.scala
- Alphabetic
- By Inheritance
- KernelDensity
- Serializable
- Serializable
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
- new KernelDensity()
Value Members
-
def
estimate(points: Array[Double]): Array[Double]
Estimates probability density function at the given array of points.
Estimates probability density function at the given array of points.
- Annotations
- @Since( "1.4.0" )
-
def
setBandwidth(bandwidth: Double): KernelDensity.this.type
Sets the bandwidth (standard deviation) of the Gaussian kernel (default:
1.0
).Sets the bandwidth (standard deviation) of the Gaussian kernel (default:
1.0
).- Annotations
- @Since( "1.4.0" )
-
def
setSample(sample: JavaRDD[Double]): KernelDensity.this.type
Sets the sample to use for density estimation (for Java users).
Sets the sample to use for density estimation (for Java users).
- Annotations
- @Since( "1.4.0" )
-
def
setSample(sample: RDD[Double]): KernelDensity.this.type
Sets the sample to use for density estimation.
Sets the sample to use for density estimation.
- Annotations
- @Since( "1.4.0" )