Preprocessing¶
Raw sensor numbers come in different sizes and units. These tools put them on a common scale and turn them into the numbers that matter (such as speed or power), one reading at a time, so that a model can learn from them.
The map of preprocessing¶
Click a page to open it, or the job on the left (or the button at the top) to go back to the map of the library.
Raw sensor numbers come in different units and sizes — a joint position in radians, a torque in newton-metres, a word in a sentence. Before a model can learn from them they are put on a common scale, turned into the quantities that matter (speed, power, word weights), filtered, and balanced. Everything here works one sample at a time: the estimator sees a sample, updates its own state, and is ready for the next one, without keeping the whole history in memory.
Nine steps follow. The first four are about numbers, the next three about text, the last two about which features to keep and how to handle rare events.
- Scaling features and joints (steps 1-3)
- Speed, acceleration, jerk and power (steps 4-5)
- Text: words, counts, weights and hashing (steps 6-7)
- Choosing features and rare events (steps 8-9)
Classes documented on other pages¶
These classes of the folder have no guide page of this group; they are in the API reference below.
EWScaler: per-feature standardisation with exponentially weighted statistics.MinMaxScaler: rescales each feature to[0, 1]with the running minimum and maximum.
API reference¶
scale ¶
Online per-feature scalers, one sample at a time.
Each scaler is a :class:~dense_armor.roles.Transformer: learn_one
updates the running state, transform_one uses the current state.
Scalars and vectors are both supported: a scalar keeps one statistic,
a vector keeps one statistic per joint. A feature never seen, or with
zero spread, passes through unchanged.
Features and joints are learned as they appear: a feature that shows up later, or a vector longer than before, gets its statistics from that sample on, and a shorter vector updates its first joints. A joint that has no statistics yet passes through unchanged. A vector of another length never raises and never warns.
The running mean and variance are updated incrementally with the stable one-pass formulas of running moments. The exponentially weighted mean and variance follow the recursive form of exponentially weighted statistics, where recent samples carry more weight. The rolling median and median absolute deviation come from a bounded FIFO window. None of these carries a reference entry: the methods are standard and the code documents them.
StandardScaler ¶
Bases: Transformer
Per-feature standardization with running mean and std.
z_i = (x_i - mean_i) / std_i for each feature and, when the
value is a vector, for each joint. A feature (or a joint) seen
fewer than twice, or whose std is below eps, passes through
unchanged.
Memory grows with the number of features (and per-feature joints):
each feature keeps two floats, so the total is O(d) for d
scalar features.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
features
|
list[str] | None
|
the features to follow. |
None
|
eps
|
float
|
std floor below which the feature is left alone. |
1e-12
|
Nothing raises: a non-positive eps is replaced by 1e-12.
Examples:
>>> from dense_armor.core.signals.preprocessing.scale import StandardScaler
>>> sc = StandardScaler()
>>> for v in [1.0, 2.0, 3.0, 4.0, 5.0]:
... _ = sc.learn_one({"x": v})
>>> round(sc.transform_one({"x": 5.0})["x"], 4)
1.2649
>>> sc2 = StandardScaler()
>>> for q in ([0.0, 1.0], [1.0, 2.0], [2.0, 3.0]):
... _ = sc2.learn_one({"q": q})
>>> [round(v, 4) for v in sc2.transform_one({"q": [2.0, 3.0]})["q"]]
[1.0, 1.0]
Source code in dense_armor/core/signals/preprocessing/scale.py
learn_one ¶
Update the running mean and std for each feature in x.
learn_many ¶
Update the running mean and std with a block of samples at once.
With a dict of arrays (one array per feature, one row per sample,
or (n, d) for a vector feature) each column goes through
:meth:RunningMoments.learn_many, which summarises the block in
one numpy pass and merges it with the pairwise formula of Chan,
Golub and LeVeque (1979), Eq. (2.1b), report page 4 (PDF page 8),
and Pebay (2008), Eq. (1.3) and (1.4), PDF page 8. The state
equals the one of the loop over
:meth:learn_one within floating-point tolerance, and no sum of
the samples is rebuilt, so a block of large values does not
overflow the mean. With anything else (a list of dicts) the loop
of :meth:learn_one is used. A NaN or infinite value is counted
as missing and skipped, as in :meth:learn_one.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
X
|
Any
|
a dict of arrays, or an iterable of samples. |
required |
t
|
float | None
|
unused, kept for the Transformer signature. |
None
|
Returns:
| Type | Description |
|---|---|
StandardScaler
|
The scaler itself. |
Source code in dense_armor/core/signals/preprocessing/scale.py
transform_one ¶
Standardize each feature using the current state.
Source code in dense_armor/core/signals/preprocessing/scale.py
EWScaler ¶
Bases: Transformer
Per-feature standardization with exponentially weighted stats.
Same shape as :class:StandardScaler but the mean and variance
follow the recursive exponential weighting, so recent samples
weigh more and a slow drift is tracked instead of averaged out.
Memory grows with the number of features (O(d) for d
scalar features); each feature keeps one mean and one variance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
alpha
|
float
|
weight of the new sample in |
0.1
|
features
|
list[str] | None
|
explicit feature order. |
None
|
eps
|
float
|
std floor. |
1e-12
|
Nothing raises: an alpha outside (0, 1] is clipped into it and a
non-positive eps is replaced by 1e-12.
Examples:
>>> from dense_armor.core.signals.preprocessing.scale import EWScaler
>>> sc = EWScaler(alpha=0.5)
>>> for v in [1.0, 2.0, 3.0]:
... _ = sc.learn_one({"x": v})
>>> got = sc.transform_one({"x": 3.0})["x"]
>>> round(got, 6)
0.904534
Source code in dense_armor/core/signals/preprocessing/scale.py
learn_one ¶
Update the exponentially weighted stats per feature.
transform_one ¶
Standardize with the current exponentially weighted state.
Source code in dense_armor/core/signals/preprocessing/scale.py
RobustScaler ¶
Bases: Transformer
Robust per-feature standardization with rolling median and MAD.
z_i = (x_i - median_i) / MAD_i for each feature and, when the
value is a vector, for each joint. A feature with MAD below
eps passes through unchanged.
Memory grows with the number of features and the window length:
each feature keeps window samples, so the total is O(d*w).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
window
|
int
|
rolling window length in samples. |
20
|
features
|
list[str] | None
|
explicit feature order. |
None
|
eps
|
float
|
MAD floor. |
1e-12
|
Nothing raises: a window below 1 is taken as 1 and a non-positive
eps is replaced by 1e-12.
Examples:
>>> from dense_armor.core.signals.preprocessing.scale import RobustScaler
>>> sc = RobustScaler(window=5)
>>> for v in [1.0, 2.0, 3.0, 4.0, 5.0]:
... _ = sc.learn_one({"x": v})
>>> round(sc.transform_one({"x": 5.0})["x"], 4)
1.349
Source code in dense_armor/core/signals/preprocessing/scale.py
learn_one ¶
Push one sample into both rolling windows per feature.
Source code in dense_armor/core/signals/preprocessing/scale.py
transform_one ¶
Center by the median and scale by the MAD.
Source code in dense_armor/core/signals/preprocessing/scale.py
MinMaxScaler ¶
Bases: Transformer
Rescale each feature to [0, 1] with running min and max.
z_i = (x_i - min_i) / (max_i - min_i) for each feature and,
when the value is a vector, for each joint. A feature with
max == min passes through unchanged. The result is in [0, 1]
for a value inside the range seen so far; a value beyond it is not
clipped and gives a result below 0 or above 1 (7.0 after 1 to 5 gives
1.5).
Memory grows with the number of features: each keeps one
:class:~dense_armor.core.signals.stats.moments.RunningMoments, of
which only the minimum and the maximum are read, so the total is
O(d) for d scalar features.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
features
|
list[str] | None
|
explicit feature order. |
None
|
eps
|
float
|
spread floor below which the feature is left alone. |
1e-12
|
Nothing raises: a non-positive eps is replaced by 1e-12.
Examples:
>>> from dense_armor.core.signals.preprocessing.scale import MinMaxScaler
>>> sc = MinMaxScaler()
>>> for v in [1.0, 2.0, 3.0, 4.0, 5.0]:
... _ = sc.learn_one({"x": v})
>>> sc.transform_one({"x": 5.0})["x"]
1.0
Source code in dense_armor/core/signals/preprocessing/scale.py
learn_one ¶
Update the running min and max for each feature.
Source code in dense_armor/core/signals/preprocessing/scale.py
transform_one ¶
Shift and rescale each feature to [0, 1].
Source code in dense_armor/core/signals/preprocessing/scale.py
joints ¶
Joint kinematics by finite differences on real timestamps.
JointDerivatives turns joint positions q into velocity,
acceleration and jerk. The derivatives are computed on the real
timestamps t, so non-uniform sampling is handled exactly. Missing
samples (NaN in any element of q or in t) are skipped and
counted; the next derivative uses the last valid sample with its own
t.
The formulas come from Newton divided differences over the last
order + 1 valid points, which are exact on any polynomial of
degree at most order. transform_one(x, t) uses the current
sample x at time t together with the buffer, so in a pipeline
(transform first, then learn) the derivative returned at time t
refers to the sample at time t, not to the last stored one.
learn_one stores the sample in the buffer.
JointPower gives the mechanical power tau * qd per joint and
its total.
JointDerivatives ¶
Bases: Transformer
Velocity, acceleration and jerk from joint positions.
Input: a dict with the joint positions under q_key (a vector)
and the timestamp t passed to learn_one and to
transform_one. Output: a dict with qd, qdd and jerk
keys, each a vector of the same length as q. order selects
how many derivatives are produced (1, 2 or 3).
In a pipeline, call transform_one(x, t) first and
learn_one(x, t) after: the derivative returned at time t
refers to the sample at time t.
Memory grows with the number of joints and the derivative order:
the buffer holds order + 1 past samples, one per joint, so the
total is O(d * order).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
order
|
int
|
number of derivatives to emit. |
3
|
q_key
|
str
|
input key holding the joint positions. |
'q'
|
Examples:
>>> from dense_armor.core.signals.preprocessing.joints import JointDerivatives
>>> jd = JointDerivatives(order=3)
>>> for t in [0.0, 1.0, 2.0, 3.0]:
... _ = jd.learn_one({"q": [t ** 3]}, t=t)
>>> round(jd.transform_one({})["qd"][0], 6)
27.0
>>> round(jd.transform_one({})["qdd"][0], 6)
18.0
Source code in dense_armor/core/signals/preprocessing/joints.py
learn_one ¶
Append one valid pair of timestamp and positions to the buffer.
Source code in dense_armor/core/signals/preprocessing/joints.py
transform_one ¶
Return the derivative vectors at time t.
Uses the buffer together with the current sample x at time
t. If t is None, or x lacks the positions, the
last stored derivatives are returned.
Source code in dense_armor/core/signals/preprocessing/joints.py
JointPower ¶
Bases: Transformer
Mechanical power tau * qd per joint and its total.
Memory grows with the number of joints only, since no state is kept.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tau_key
|
str
|
input key holding the joint torques. |
'tau'
|
qd_key
|
str
|
input key holding the joint velocities. |
'qd'
|
Examples:
>>> from dense_armor.core.signals.preprocessing.joints import JointPower
>>> jp = JointPower()
>>> out = jp.transform_one({"tau": [1.0, 2.0], "qd": [3.0, 4.0]})
>>> out["power"], out["power_total"]
([3.0, 8.0], 11.0)
Source code in dense_armor/core/signals/preprocessing/joints.py
learn_one ¶
No state to update; kept for the Transformer interface.
transform_one ¶
Return the per-joint power and the total power.
Source code in dense_armor/core/signals/preprocessing/joints.py
text ¶
Online text features: tokenization, bag of words, TF-IDF, hashing.
All four are :class:~dense_armor.roles.Transformer subclasses: they
read a string (or a token list) from one key and write their result
under another. Input is a plain str or a dict holding it.
Tokenizer ¶
Tokenizer(
lowercase: bool = True,
ngrams: int = 1,
text_key: str = "text",
tokens_key: str = "tokens",
stop_words: Iterable[str] | None = None,
)
Bases: Transformer
Lower-case word tokens, with optional n-grams.
Memory is constant; no state is kept between calls.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lowercase
|
bool
|
convert the text to lower case. |
True
|
ngrams
|
int
|
maximum n-gram order (1 = unigrams only). |
1
|
text_key
|
str
|
dict key holding the text string. |
'text'
|
tokens_key
|
str
|
dict key written with the token list. |
'tokens'
|
stop_words
|
Iterable[str] | None
|
words removed from the word list before the
n-grams are formed, so no n-gram contains a removed
word. |
None
|
Examples:
>>> from dense_armor.core.signals.preprocessing.text import Tokenizer
>>> tk = Tokenizer(ngrams=2)
>>> tk.transform_one({"text": "Hello world"})["tokens"]
['hello', 'world', 'hello world']
Source code in dense_armor/core/signals/preprocessing/text.py
learn_one ¶
transform_one ¶
Split the text into words (and n-grams) and lower-case them.
Source code in dense_armor/core/signals/preprocessing/text.py
BagOfWords ¶
Bases: Transformer
Term counts of one document, from a token list.
Memory grows with the number of distinct tokens in the document only; the counts dict is rebuilt on every call.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tokens_key
|
str
|
dict key holding the token list. |
'tokens'
|
counts_key
|
str
|
dict key written with the |
'counts'
|
Examples:
>>> from dense_armor.core.signals.preprocessing.text import BagOfWords
>>> bw = BagOfWords()
>>> bw.transform_one({"tokens": ["a", "b", "a"]})["counts"]
{'a': 2, 'b': 1}
Source code in dense_armor/core/signals/preprocessing/text.py
TFIDF ¶
TFIDF(
smooth_idf: bool = False,
tokens_key: str = "tokens",
counts_key: str = "counts",
scores_key: str = "scores",
norm: str | None = None,
)
Bases: Transformer
Online TF-IDF following Silajev 2026, section 1.
The paper defines, for a term t in document i with raw
counts d_i and length |d_i|:
.. math::
\mathrm{TF\!\cdot\!IDF}(t, i)
= \frac{d_i(t)}{|d_i|} \ln\!\left(\frac{N}{\mathrm{DF}(t)}\right)
where N is the number of documents seen so far and
\mathrm{DF}(t) is the number of documents containing t.
The term frequency is the relative frequency in the document
(count divided by document length), and the idf is ln(N / DF)
with no +1 smoothing. A term present in every document has
DF(t) = N, so its idf is ln(1) = 0 and the term vanishes
from the score, exactly as the paper states.
smooth_idf=True replaces the idf with ln(1 + N / DF); the
smoothed variant is not the paper's formula and is provided only
to avoid zero scores for terms that appear in every document.
Memory grows with the vocabulary: one counter per distinct term
seen, so the total is O(V) for V distinct terms.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
smooth_idf
|
bool
|
if True, use |
False
|
tokens_key
|
str
|
dict key holding the token list. |
'tokens'
|
counts_key
|
str
|
optional dict key holding a precomputed count dict; when present it is used instead of recounting. |
'counts'
|
scores_key
|
str
|
dict key written with |
'scores'
|
norm
|
str | None
|
|
None
|
Examples:
>>> from dense_armor.core.signals.preprocessing.text import TFIDF
>>> tf = TFIDF()
>>> _ = tf.learn_one({"tokens": ["a", "b"]})
>>> _ = tf.learn_one({"tokens": ["a"]})
>>> out = tf.transform_one({"tokens": ["a", "b"]})
>>> out["scores"]["a"]
0.0
>>> round(out["scores"]["b"], 6)
0.346574
References
Silajev, I. (2026). TF-IDF and BM25 are exact KL divergences. arXiv:2609.14016, section 1.
Source code in dense_armor/core/signals/preprocessing/text.py
learn_one ¶
Count one document towards N and DF.
Source code in dense_armor/core/signals/preprocessing/text.py
transform_one ¶
Return the TF-IDF scores of the current document.
Source code in dense_armor/core/signals/preprocessing/text.py
FeatureHasher ¶
FeatureHasher(
n_features: int = 1024,
seed: int = 0,
counts_key: str = "counts",
hashed_key: str = "hashed",
)
Bases: Transformer
Signed feature hashing (Weinberger et al. 2009, Theorem 3).
For each term j the hasher draws an index h(j) in
{1, ..., m} and a sign xi(j) in {-1, +1} from one
SHA-256 digest. The hashed feature vector is
.. math::
\phi_i(x) = \sum_{j : h(j) = i} \xi(j) x_j.
The complete statement of Theorem 3 (equation 4 of the paper) is
the following. Let epsilon < 1 be a fixed constant and let
x be an instance with ||x||_2 = 1. If
.. math::
m \geq \frac{72 \log(1/\delta)}{\epsilon^2}
\quad\text{and}\quad
\|x\|_\infty \leq
\frac{\epsilon}{18\sqrt{\log(1/\delta)\log(m/\delta)}},
then
.. math::
\Pr\!\left[\,
\bigl|\,\|x\|_\phi^2 - 1\,\bigr| \geq \epsilon
\,\right] \leq 2\delta.
The bound is what sizes n_features: for a target distortion
epsilon and a failure probability 2\delta, m must grow
like log(1/\delta) / \epsilon^2 and the largest coordinate of
x must stay below the stated threshold.
Memory is fixed by the hash space: one accumulator slot per bucket
in the current document, so the total is O(m).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_features
|
int
|
hash space size |
1024
|
seed
|
int
|
hash seed; different seeds give independent hashes. |
0
|
counts_key
|
str
|
dict key holding the term counts or scores. |
'counts'
|
hashed_key
|
str
|
dict key written with the hashed vector as a dict. |
'hashed'
|
Examples:
>>> from dense_armor.core.signals.preprocessing.text import FeatureHasher
>>> fh = FeatureHasher(n_features=8, seed=0)
>>> out = fh.transform_one({"counts": {"a": 1.0}})
>>> len(out["hashed"])
1
References
Weinberger, K., Dasgupta, A., Attenberg, J., Langford, J., Smola, A. (2009). Feature hashing for large scale multitask learning. ICML, Theorem 3 and equation 4.
Source code in dense_armor/core/signals/preprocessing/text.py
learn_one ¶
transform_one ¶
Hash the term weights into a lower-dimensional sparse vector.
Source code in dense_armor/core/signals/preprocessing/text.py
select ¶
Online feature selection.
VarianceThreshold drops features whose running variance is below a
threshold. SelectKBest keeps the k features with the highest
absolute running Pearson correlation with the target; the ranking is
recomputed on every transform_one from the current statistics, so
the kept set changes as the stream evolves.
VarianceThreshold ¶
Bases: Transformer
Drop features whose running variance is at or below threshold.
The variance is the unbiased running variance. A feature never seen passes through unchanged, so the first sample is never dropped by accident.
Memory grows with the number of features (one accumulator per
feature); the total is O(d) for d features.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
threshold
|
float
|
variance floor; features with |
0.0
|
features
|
list[str] | None
|
explicit feature order. |
None
|
Examples:
>>> from dense_armor.core.signals.preprocessing.select import VarianceThreshold
>>> vt = VarianceThreshold(threshold=0.1)
>>> for v in [1.0, 2.0, 3.0, 4.0, 5.0]:
... _ = vt.learn_one({"x": v, "c": 7.0})
>>> sorted(vt.transform_one({"x": 3.0, "c": 7.0}).keys())
['x']
Source code in dense_armor/core/signals/preprocessing/select.py
learn_one ¶
Update the running variance of each feature.
Source code in dense_armor/core/signals/preprocessing/select.py
transform_one ¶
Keep only the features above the variance threshold.
Source code in dense_armor/core/signals/preprocessing/select.py
SelectKBest ¶
Bases: Transformer
Keep the k features with the highest absolute running correlation.
learn_one takes the target y and updates, for each feature,
a running Pearson correlation with y. transform_one ranks
the features by |corr| and keeps the top k. Features never
seen pass through unchanged.
Memory grows with the number of features (one accumulator per
feature); the total is O(d) for d features.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
k
|
int
|
number of features to keep. |
10
|
features
|
list[str] | None
|
explicit feature order. |
None
|
dtype
|
Any
|
|
None
|
Examples:
>>> from dense_armor.core.signals.preprocessing.select import SelectKBest
>>> sk = SelectKBest(k=1)
>>> for i in range(20):
... _ = sk.learn_one({"a": float(i), "b": 1.0}, y=2.0 * i)
>>> sorted(sk.transform_one({"a": 1.0, "b": 1.0}).keys())
['a']
Source code in dense_armor/core/signals/preprocessing/select.py
learn_one ¶
Update the running correlation of each feature with y.
Source code in dense_armor/core/signals/preprocessing/select.py
transform_one ¶
Keep the k features with the highest absolute correlation.
Source code in dense_armor/core/signals/preprocessing/select.py
imbalance ¶
Queue-based resampling for online class imbalance.
The algorithm keeps two fixed-length queues, one per class, and at each
time step trains the wrapped classifier on the union of the two. The
per-class queue bounds the effective class ratio: after warm-up the
union is balanced (L positives and L negatives), even if the
raw stream is 1 % positive. A queue that is not yet full simply does
not contribute, so the first samples are learned as they arrive.
Algorithm 1 of Malialis, Panayiotou, Polycarpou (2018), p. 5, maps to this class as follows:
- input
L: constructor argumentqueue_size. - loop over time steps:
learn_oneis called once per step. - receive example
x^t: outsidelearn_one(the caller has it). - predict class
y_hat^t: outsidelearn_one(predict_one/predict_proba_one, delegated to the wrapped classifier). - receive true label
y^t: the second argument oflearn_one. z^t = (x^t, y^t): built insidelearn_one.- if
y^t == 0: append to the negative queue. - else: append to the positive queue.
q^t = q_p^t union q_n^t: the union of the two queues.- calculate cost on
q^t: delegated to the wrapped classifier, which trains on each element of the union. - update classifier:
learn_oneon the wrapped classifier, once per element of the union.
The wrapper adds no state beyond the two queues, so memory is O(L)
per class, fixed by queue_size.
References¶
Malialis, K., Panayiotou, C., Polycarpou, M. M. (2018). Queue-based resampling for online class imbalance learning. ICANN, section 3 and Algorithm 1 on p. 5.
QueueResampler ¶
Bases: Classifier
Resampling wrapper for imbalanced online streams.
learn_one appends the labelled sample to the queue of its
class, then trains the wrapped classifier once per element of the
union of the two queues. predict_one and predict_proba_one
delegate straight to the wrapped classifier.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
classifier
|
Any
|
the wrapped classifier. |
required |
queue_size
|
int
|
length |
25
|
positive
|
Any
|
label of the positive class. |
1
|
Examples:
>>> from dense_armor.core.signals.preprocessing.imbalance import QueueResampler
>>> from dense_armor.roles import Classifier
>>> class Counter(Classifier):
... def __init__(self):
... self.n_seen_ = 0
... def learn_one(self, x, y, t=None):
... self.n_seen_ += 1
... return self
... def predict_one(self, x, t=None):
... return 0
>>> qr = QueueResampler(Counter(), queue_size=3)
>>> for i in range(10):
... _ = qr.learn_one({"x": i}, y=1 if i == 4 else 0)
>>> qr.classifier.n_seen_ > 10
True
Cost: 25 microseconds per call (median of 9600 calls, one Windows
CPU thread). budget_s is 5 ms because check_p99_within_budget
takes the p99 of 24 calls, which is their maximum: over 400 runs of
that check the value was 27 microseconds at the median and 166
microseconds at the 99th percentile, with one run at 2.4 ms and one
CI run at 2.75 ms, a pause of the runner and not the cost of the code.
References
Malialis, K., Panayiotou, C., Polycarpou, M. M. (2018). ICANN, Algorithm 1 on p. 5.
Source code in dense_armor/core/signals/preprocessing/imbalance.py
learn_one ¶
Append the sample to its queue and train on the union.
Source code in dense_armor/core/signals/preprocessing/imbalance.py
predict_one ¶
predict_proba_one ¶
Delegate to the wrapped classifier.
Details¶
- Scalers keep one statistic per feature and per joint; a feature never seen, or with zero spread, passes unchanged.
TFIDF(smooth_idf=True)uses \(\ln(1 + N/\text{DF})\); this smoothing is not in Silajev (2026) and is off by default.JointDerivativeskeeps the lastorder + 1valid samples; missing samples (NaN) are skipped and counted inn_missing.- Sources: Silajev, I. (2026), "TF-IDF and BM25 are exact KL divergences", arXiv:2609.14016. Weinberger, K. et al. (2009), "Feature hashing for large scale multitask learning", ICML, arXiv:0902.2206. Malialis, K., Panayiotou, C., Polycarpou, M. (2018), "Queue-based resampling for online class imbalance learning", ICANN, arXiv:1809.10388.