  We observe $n$ independent pairs of random variables $(W_{i}, Y_{i})$ for
which the conditional distribution of $Y_{i}$ given $W_{i}=w_{i}$ belongs to a
one-parameter exponential family with parameter
${\mathbf{\gamma}}^{*}(w_{i})\in{\mathbb{R}}$ and our aim is to estimate the
regression function ${\mathbf{\gamma}}^{*}$. Our estimation strategy is as
follows. We start with an arbitrary collection of piecewise constant candidate
estimators based on our observations and by means of the same observations, we
select an estimator among the collection. Our approach is agnostic to the
dependencies of the candidate estimators with respect to the data and can
therefore be unknown. From this point of view, our procedure contrasts with
other alternative selection methods based on data splitting, cross validation,
hold-out etc. To illustrate its theoretical performance, we establish a
non-asymptotic risk bound for the selected estimator. We then explain how to
apply our procedure to the changepoint detection problem in exponential
families. The practical performance of the proposed algorithm is illustrated by
a comparative simulation study under different scenarios and on two real
datasets from the copy numbers of DNA and British coal disasters records.
