SamplePartition¶
- class SamplePartition(*args)¶
Select partition of samples.
Class to define subset of points, and select new ones, see
getPeakOverThreshold()
.Warning
This class is experimental and likely to be modified in future releases. To use it, import the
openturns.experimental
submodule.- Parameters:
- sample2-d sequence of float
A sample of dimension 1.
- indicessequence of int 2-tuple or sequence of int, optional
Flat indices of population in the partition or list of (start,end) ranges. If not provided the default is to consider one single group with all the sample values.
Methods
ExtractFromDataFrame
(partial)Extract a partition from a pandas dataframe as a SamplePartition.
draw
(threshold)Draw clusters and peaks.
Accessor to the object's name.
Partition indices accessor.
getName
()Accessor to the object's name.
getPeakOverThreshold
(threshold, r)Compute extreme values using Peaks Over Threshold (POT) method.
Sample accessor.
hasName
()Test if the object is named.
setName
(name)Accessor to the object's name.
Examples
>>> import openturns as ot >>> import openturns.experimental as otexp >>> ref = ot.Uniform().getSample(10) >>> sp1 = otexp.SamplePartition(ref, [[0, 3], [5, 9]]) >>> sp2 = otexp.SamplePartition(ref, [0, 1, 2, 3])
- __init__(*args)¶
- ExtractFromDataFrame(partial)¶
Extract a partition from a pandas dataframe as a SamplePartition.
- Parameters:
- fullpandas DataFrame
Full data
- partialpandas DataFrame
Filtered data from the full Dataframe
- Returns:
- partition
openturns.experimental.SamplePartition
The resulting partition
- partition
- draw(threshold)¶
Draw clusters and peaks.
- Parameters:
- thresholdfloat
The threshold value
- Returns:
- graph
Graph
Graph of clusters, peaks.
- graph
- getClassName()¶
Accessor to the object’s name.
- Returns:
- class_namestr
The object class name (object.__class__.__name__).
- getIndicesCollection()¶
Partition indices accessor.
- Returns:
- indicesCollection
IndicesCollection
List of partitions ranges as (start,end) indices.
- indicesCollection
- getName()¶
Accessor to the object’s name.
- Returns:
- namestr
The name of the object.
- getPeakOverThreshold(threshold, r)¶
Compute extreme values using Peaks Over Threshold (POT) method.
- Parameters:
- sample2-d sequence of float
A sample of dimension 1.
- thresholdfloat
The threshold value
- rint
Minimum number of consecutive values below the threshold between clusters
- Returns:
- peaks
Sample
The peaks for each cluster
- clusters
openturns.experimental.SamplePartition
The clusters partition
- peaks
- hasName()¶
Test if the object is named.
- Returns:
- hasNamebool
True if the name is not empty.
- setName(name)¶
Accessor to the object’s name.
- Parameters:
- namestr
The name of the object.
Examples using the class¶
Estimate a GPD on the Wooster temperature data
Estimate a GPD on the Dow Jones Index data