PINE LIBRARY
Zaktualizowano CyberLearningLib

# CyberLearningLib v4
CyberLearningLib provides online learning primitives for Pine Script traders building adaptive machine learning indicators, including circular training buffers, feature scaling, stochastic gradient descent (SGD), and distance metrics for k-nearest neighbors (kNN) algorithms.
## What it does
LearningLib delivers four core components: circular training buffers for memory-efficient sample storage (O(1) push/read), feature scalers with exponentially weighted moving average (EWMA) normalization, SGD optimizers with gradient clipping and multiple loss functions (squared, hinge, logistic, Huber), and distance metrics for kNN classification (Euclidean, Manhattan, Cosine, Mahalanobis, Chebyshev). Traders use these tools to build indicators that learn from historical price patterns—for example, a kNN classifier predicting next-bar direction based on the 10 most similar historical setups, with features auto-scaled via EWMA to handle non-stationary markets.
The library outputs trained model weights (SGD state vector), scaled feature vectors (normalized to [0,1] or z-scores), distance matrices for kNN queries, and sample metadata (timestamp, sample type, trade direction). All data structures use circular buffers to maintain constant memory usage regardless of training duration, critical for long-running indicators on TradingView's 50,000 float limit.
## How it works
The training buffer uses a circular array with write-head indexing: when capacity is reached, new samples overwrite the oldest. Each sample stores a feature vector (array<float>), label (float, regression target or {-1,+1} for classification), weight (float, for importance sampling), timestamp (bar_index), sample type (enum: LIVE/SIMULATED/SHADOW/BACKFILL), trade direction (LONG/SHORT/FLAT), and two free metadata integers for custom categorization. The `read(offset)` method retrieves samples in reverse chronological order (0 = most recent), while `read_chrono(pos)` accesses samples in insertion order (0 = oldest).
Feature scaling supports three methods:
1. **EWMA normalization**: Maintains running mean/variance via `μ_t = (1-α)μ_{t-1} + αx_t`, scales features to z-scores
2. **Min-max scaling**: Tracks rolling min/max over window, normalizes to [0,1]
3. **Percentile-based**: Uses IQR (interquartile range) for outlier-resistant scaling
SGD updates follow the standard formula `w_t = w_{t-1} - η∇L(w)` where η is learning rate and ∇L is loss gradient. Supported loss functions:
- **Squared**: `0.5(y - ŷ)²`, gradient = `-(y - ŷ)`
- **Hinge**: `max(0, 1 - y·ŷ)` for y ∈ {-1,+1}, gradient = `-y` if margin violated
- **Logistic**: `log(1 + exp(-y·ŷ))`, gradient = `-y / (1 + exp(y·ŷ))`
- **Huber**: Squared loss for small errors (|err| ≤ δ), linear for large errors (robust to outliers)
Gradient clipping prevents exploding gradients: `g_clipped = g / max(1, ||g|| / threshold)`. The library also provides gated SGD updates that skip parameter changes when innovation (measurement error) is below a threshold, reducing overfitting to noise.
Distance metrics compute similarity between feature vectors for kNN:
- **Euclidean**: `√Σ(x_i - y_i)²`
- **Manhattan**: `Σ|x_i - y_i|`
- **Cosine**: `1 - (x·y) / (||x|| ||y||)` (angle-based, scale-invariant)
- **Mahalanobis**: `√((x-y)'Σ⁻¹(x-y))` where Σ is covariance (accounts for feature correlations)
- **Chebyshev**: `max_i |x_i - y_i|` (L∞ norm)
## Why this is original
CyberLearningLib is the only TradingView library providing a complete online learning toolkit with memory-efficient circular buffers and production-ready SGD implementations. Existing ML libraries either use linear arrays (memory grows unbounded), lack feature scaling (assume stationary data), or implement only Euclidean distance (ignoring feature correlations).
Unique features:
- **Circular training buffers**: O(1) push/read with constant memory, critical for indicators running 24/7 on crypto markets. No other Pine library offers circular indexing with chronological/reverse-chronological access.
- **Sample type tracking**: LIVE/SIMULATED/SHADOW/BACKFILL enum enables mixed training sets (e.g., "train on LIVE samples only, use SIMULATED for validation"). Essential for walk-forward optimization and out-of-sample testing.
- **Gated SGD updates**: Skip weight updates when innovation < threshold, preventing overfitting during low-volatility regimes. Based on Kalman filter innovation gating, not found in standard ML libraries.
- **Huber loss with configurable δ**: Robust regression loss that transitions from squared (δ-sensitive) to linear (outlier-resistant). Most Pine implementations use fixed δ=1.0; this library exposes δ as parameter.
- **Mahalanobis distance with shrinkage**: Accounts for feature correlations via inverse covariance, with Ledoit-Wolf shrinkage to prevent singular matrix errors. No other Pine library implements this (most use Euclidean only).
The library is designed for composition: training buffers feed into feature scalers, scaled features feed into SGD or kNN, distances feed into weighted voting. This modular design enables complex workflows (e.g., "scale features via EWMA, train linear SVM via hinge loss, classify new samples via kNN with Mahalanobis distance") without code duplication.
## How to use it
```pine
//version=6
indicator("CyberLearningLib Demo", overlay=false)
import cybermediaboy/CyberLearningLib/4 as LL
import cybermediaboy/NumLib/5 as N
// Example 1: Circular training buffer
var tb = LL.f_buffer_new(capacity=100, nfeat=3)
if not na(close)
var features = array.from(ta.rsi(close, 14), ta.atr(14), volume)
float label = close[1] < close ? 1.0 : -1.0 // Next-bar direction
var sample = LL.f_sample_new(features, label, LL.SampleType.LIVE,
LL.TradeDirection.LONG, meta_a=0, meta_b=0)
tb.push(sample)
// Read most recent sample
var recent = tb.read(0)
if not na(recent)
plot(recent.label, "Last Label", color.blue)
// Example 2: Feature scaling (EWMA)
var scaler = LL.f_scaler_new(nfeat=3, alpha=0.1)
if not na(close)
var raw_features = array.from(close, volume, ta.rsi(close, 14))
var scaled = scaler.scale(raw_features)
plot(array.get(scaled, 0), "Scaled Close", color.orange)
// Example 3: SGD training (hinge loss for binary classification)
var sgd = LL.f_sgd_new(nfeat=3, learning_rate=0.01, loss=LL.LossKind.HINGE)
if tb.filled >= 10
var train_sample = tb.read(0)
if not na(train_sample)
sgd.update(train_sample.features, train_sample.label, clip_threshold=5.0)
float prediction = sgd.predict(train_sample.features)
plot(prediction, "SGD Prediction", color.green)
// Example 4: kNN distance calculation
if tb.filled >= 2
var s1 = tb.read(0)
var s2 = tb.read(1)
if not na(s1) and not na(s2)
float dist_euclidean = LL.f_distance(s1.features, s2.features, LL.DistanceKind.EUCLIDEAN)
float dist_cosine = LL.f_distance(s1.features, s2.features, LL.DistanceKind.COSINE)
plot(dist_euclidean, "Euclidean Dist", color.red)
plot(dist_cosine, "Cosine Dist", color.purple)
```
## Inputs, outputs, expected behavior
**Training buffer** (`f_buffer_new`, `push`, `read`, `read_chrono`):
- **Inputs**: `capacity` (int, 50-1000 typical), `nfeat` (int, feature dimension), `offset/pos` (int, sample index)
- **Outputs**: TBSample (struct with features, label, metadata) or na if index out of bounds
- **Edge cases**: Returns na for invalid offsets, overwrites oldest sample at capacity, `filled` count saturates at capacity
**Feature scaler** (`f_scaler_new`, `scale`, `update`):
- **Inputs**: `nfeat` (int), `alpha` (float, EWMA decay 0.01-0.3 typical), `features` (array<float>)
- **Outputs**: Scaled feature vector (array<float>, z-scores or [0,1] normalized)
- **Edge cases**: Returns unscaled features on first call (no history), handles NA elements via nz()
**SGD optimizer** (`f_sgd_new`, `update`, `predict`):
- **Inputs**: `nfeat` (int), `learning_rate` (float, 0.001-0.1 typical), `loss` (enum), `features/label` (float), `clip_threshold` (float, 1.0-10.0)
- **Outputs**: Prediction (float, unbounded for regression, {-1,+1} for classification after sign()), updated weights (internal state)
- **Edge cases**: Gradient clipping prevents exploding weights, returns 0.0 prediction before first update
**Distance metrics** (`f_distance`, `f_distance_mahalanobis`):
- **Inputs**: `x/y` (array<float>, same length), `kind` (enum), `cov_inv` (array<float>, tri-packed inverse covariance for Mahalanobis)
- **Outputs**: Distance (float, ≥0 for Euclidean/Manhattan/Chebyshev, [0,2] for Cosine, unbounded for Mahalanobis)
- **Edge cases**: Returns NA if array lengths mismatch, Mahalanobis requires non-singular covariance (use shrinkage if needed)
**Sample filtering** (`by_type`, `by_direction`):
- **Inputs**: `tb` (TrainingBuffer), `st` (SampleType enum), `dir` (TradeDirection enum)
- **Outputs**: Filtered array<TBSample> (subset of buffer matching criteria)
- **Edge cases**: Returns empty array if no matches, preserves chronological order
## Limitations
1. **Fixed feature dimension**: Training buffers and scalers require `nfeat` declared at initialization. Changing feature count mid-stream requires creating a new buffer/scaler. Dynamic feature sets (e.g., "use 3 features on stocks, 5 on crypto") are not supported.
2. **No automatic hyperparameter tuning**: Learning rate, loss function, gradient clip threshold, and EWMA alpha must be manually specified. The library does not provide grid search, cross-validation, or adaptive learning rate schedules (e.g., Adam, RMSprop). Users must tune via backtesting.
3. **SGD assumes i.i.d. samples**: Stochastic gradient descent converges optimally when samples are independent and identically distributed. Financial time series violate this (autocorrelation, regime changes). For non-stationary data, consider using gated updates or periodically resetting weights.
4. **Mahalanobis distance requires covariance matrix**: Computing inverse covariance for N features requires O(N³) operations and N(N+1)/2 storage. For high-dimensional features (N > 10), this becomes computationally expensive. Use Euclidean or Cosine distance for N > 10, or apply PCA to reduce dimensionality first.
5. **No mini-batch SGD**: The library implements single-sample (online) SGD only. Mini-batch updates (averaging gradients over K samples) are not supported. For noisy gradients, increase EWMA alpha in feature scaling or use Huber loss instead of squared loss.
6. **Circular buffer overwrites without warning**: When capacity is reached, `push()` silently overwrites the oldest sample. If you need to preserve all historical data, implement external archiving (e.g., export to CSV via log.info) before buffer fills.
7. **Distance metrics do not handle missing features**: If a feature vector contains NA, distance functions return NA. The library does not impute missing values (mean, median, forward-fill). Users must handle NA via nz() or filtering before calling distance functions.
CyberLearningLib provides online learning primitives for Pine Script traders building adaptive machine learning indicators, including circular training buffers, feature scaling, stochastic gradient descent (SGD), and distance metrics for k-nearest neighbors (kNN) algorithms.
## What it does
LearningLib delivers four core components: circular training buffers for memory-efficient sample storage (O(1) push/read), feature scalers with exponentially weighted moving average (EWMA) normalization, SGD optimizers with gradient clipping and multiple loss functions (squared, hinge, logistic, Huber), and distance metrics for kNN classification (Euclidean, Manhattan, Cosine, Mahalanobis, Chebyshev). Traders use these tools to build indicators that learn from historical price patterns—for example, a kNN classifier predicting next-bar direction based on the 10 most similar historical setups, with features auto-scaled via EWMA to handle non-stationary markets.
The library outputs trained model weights (SGD state vector), scaled feature vectors (normalized to [0,1] or z-scores), distance matrices for kNN queries, and sample metadata (timestamp, sample type, trade direction). All data structures use circular buffers to maintain constant memory usage regardless of training duration, critical for long-running indicators on TradingView's 50,000 float limit.
## How it works
The training buffer uses a circular array with write-head indexing: when capacity is reached, new samples overwrite the oldest. Each sample stores a feature vector (array<float>), label (float, regression target or {-1,+1} for classification), weight (float, for importance sampling), timestamp (bar_index), sample type (enum: LIVE/SIMULATED/SHADOW/BACKFILL), trade direction (LONG/SHORT/FLAT), and two free metadata integers for custom categorization. The `read(offset)` method retrieves samples in reverse chronological order (0 = most recent), while `read_chrono(pos)` accesses samples in insertion order (0 = oldest).
Feature scaling supports three methods:
1. **EWMA normalization**: Maintains running mean/variance via `μ_t = (1-α)μ_{t-1} + αx_t`, scales features to z-scores
2. **Min-max scaling**: Tracks rolling min/max over window, normalizes to [0,1]
3. **Percentile-based**: Uses IQR (interquartile range) for outlier-resistant scaling
SGD updates follow the standard formula `w_t = w_{t-1} - η∇L(w)` where η is learning rate and ∇L is loss gradient. Supported loss functions:
- **Squared**: `0.5(y - ŷ)²`, gradient = `-(y - ŷ)`
- **Hinge**: `max(0, 1 - y·ŷ)` for y ∈ {-1,+1}, gradient = `-y` if margin violated
- **Logistic**: `log(1 + exp(-y·ŷ))`, gradient = `-y / (1 + exp(y·ŷ))`
- **Huber**: Squared loss for small errors (|err| ≤ δ), linear for large errors (robust to outliers)
Gradient clipping prevents exploding gradients: `g_clipped = g / max(1, ||g|| / threshold)`. The library also provides gated SGD updates that skip parameter changes when innovation (measurement error) is below a threshold, reducing overfitting to noise.
Distance metrics compute similarity between feature vectors for kNN:
- **Euclidean**: `√Σ(x_i - y_i)²`
- **Manhattan**: `Σ|x_i - y_i|`
- **Cosine**: `1 - (x·y) / (||x|| ||y||)` (angle-based, scale-invariant)
- **Mahalanobis**: `√((x-y)'Σ⁻¹(x-y))` where Σ is covariance (accounts for feature correlations)
- **Chebyshev**: `max_i |x_i - y_i|` (L∞ norm)
## Why this is original
CyberLearningLib is the only TradingView library providing a complete online learning toolkit with memory-efficient circular buffers and production-ready SGD implementations. Existing ML libraries either use linear arrays (memory grows unbounded), lack feature scaling (assume stationary data), or implement only Euclidean distance (ignoring feature correlations).
Unique features:
- **Circular training buffers**: O(1) push/read with constant memory, critical for indicators running 24/7 on crypto markets. No other Pine library offers circular indexing with chronological/reverse-chronological access.
- **Sample type tracking**: LIVE/SIMULATED/SHADOW/BACKFILL enum enables mixed training sets (e.g., "train on LIVE samples only, use SIMULATED for validation"). Essential for walk-forward optimization and out-of-sample testing.
- **Gated SGD updates**: Skip weight updates when innovation < threshold, preventing overfitting during low-volatility regimes. Based on Kalman filter innovation gating, not found in standard ML libraries.
- **Huber loss with configurable δ**: Robust regression loss that transitions from squared (δ-sensitive) to linear (outlier-resistant). Most Pine implementations use fixed δ=1.0; this library exposes δ as parameter.
- **Mahalanobis distance with shrinkage**: Accounts for feature correlations via inverse covariance, with Ledoit-Wolf shrinkage to prevent singular matrix errors. No other Pine library implements this (most use Euclidean only).
The library is designed for composition: training buffers feed into feature scalers, scaled features feed into SGD or kNN, distances feed into weighted voting. This modular design enables complex workflows (e.g., "scale features via EWMA, train linear SVM via hinge loss, classify new samples via kNN with Mahalanobis distance") without code duplication.
## How to use it
```pine
//version=6
indicator("CyberLearningLib Demo", overlay=false)
import cybermediaboy/CyberLearningLib/4 as LL
import cybermediaboy/NumLib/5 as N
// Example 1: Circular training buffer
var tb = LL.f_buffer_new(capacity=100, nfeat=3)
if not na(close)
var features = array.from(ta.rsi(close, 14), ta.atr(14), volume)
float label = close[1] < close ? 1.0 : -1.0 // Next-bar direction
var sample = LL.f_sample_new(features, label, LL.SampleType.LIVE,
LL.TradeDirection.LONG, meta_a=0, meta_b=0)
tb.push(sample)
// Read most recent sample
var recent = tb.read(0)
if not na(recent)
plot(recent.label, "Last Label", color.blue)
// Example 2: Feature scaling (EWMA)
var scaler = LL.f_scaler_new(nfeat=3, alpha=0.1)
if not na(close)
var raw_features = array.from(close, volume, ta.rsi(close, 14))
var scaled = scaler.scale(raw_features)
plot(array.get(scaled, 0), "Scaled Close", color.orange)
// Example 3: SGD training (hinge loss for binary classification)
var sgd = LL.f_sgd_new(nfeat=3, learning_rate=0.01, loss=LL.LossKind.HINGE)
if tb.filled >= 10
var train_sample = tb.read(0)
if not na(train_sample)
sgd.update(train_sample.features, train_sample.label, clip_threshold=5.0)
float prediction = sgd.predict(train_sample.features)
plot(prediction, "SGD Prediction", color.green)
// Example 4: kNN distance calculation
if tb.filled >= 2
var s1 = tb.read(0)
var s2 = tb.read(1)
if not na(s1) and not na(s2)
float dist_euclidean = LL.f_distance(s1.features, s2.features, LL.DistanceKind.EUCLIDEAN)
float dist_cosine = LL.f_distance(s1.features, s2.features, LL.DistanceKind.COSINE)
plot(dist_euclidean, "Euclidean Dist", color.red)
plot(dist_cosine, "Cosine Dist", color.purple)
```
## Inputs, outputs, expected behavior
**Training buffer** (`f_buffer_new`, `push`, `read`, `read_chrono`):
- **Inputs**: `capacity` (int, 50-1000 typical), `nfeat` (int, feature dimension), `offset/pos` (int, sample index)
- **Outputs**: TBSample (struct with features, label, metadata) or na if index out of bounds
- **Edge cases**: Returns na for invalid offsets, overwrites oldest sample at capacity, `filled` count saturates at capacity
**Feature scaler** (`f_scaler_new`, `scale`, `update`):
- **Inputs**: `nfeat` (int), `alpha` (float, EWMA decay 0.01-0.3 typical), `features` (array<float>)
- **Outputs**: Scaled feature vector (array<float>, z-scores or [0,1] normalized)
- **Edge cases**: Returns unscaled features on first call (no history), handles NA elements via nz()
**SGD optimizer** (`f_sgd_new`, `update`, `predict`):
- **Inputs**: `nfeat` (int), `learning_rate` (float, 0.001-0.1 typical), `loss` (enum), `features/label` (float), `clip_threshold` (float, 1.0-10.0)
- **Outputs**: Prediction (float, unbounded for regression, {-1,+1} for classification after sign()), updated weights (internal state)
- **Edge cases**: Gradient clipping prevents exploding weights, returns 0.0 prediction before first update
**Distance metrics** (`f_distance`, `f_distance_mahalanobis`):
- **Inputs**: `x/y` (array<float>, same length), `kind` (enum), `cov_inv` (array<float>, tri-packed inverse covariance for Mahalanobis)
- **Outputs**: Distance (float, ≥0 for Euclidean/Manhattan/Chebyshev, [0,2] for Cosine, unbounded for Mahalanobis)
- **Edge cases**: Returns NA if array lengths mismatch, Mahalanobis requires non-singular covariance (use shrinkage if needed)
**Sample filtering** (`by_type`, `by_direction`):
- **Inputs**: `tb` (TrainingBuffer), `st` (SampleType enum), `dir` (TradeDirection enum)
- **Outputs**: Filtered array<TBSample> (subset of buffer matching criteria)
- **Edge cases**: Returns empty array if no matches, preserves chronological order
## Limitations
1. **Fixed feature dimension**: Training buffers and scalers require `nfeat` declared at initialization. Changing feature count mid-stream requires creating a new buffer/scaler. Dynamic feature sets (e.g., "use 3 features on stocks, 5 on crypto") are not supported.
2. **No automatic hyperparameter tuning**: Learning rate, loss function, gradient clip threshold, and EWMA alpha must be manually specified. The library does not provide grid search, cross-validation, or adaptive learning rate schedules (e.g., Adam, RMSprop). Users must tune via backtesting.
3. **SGD assumes i.i.d. samples**: Stochastic gradient descent converges optimally when samples are independent and identically distributed. Financial time series violate this (autocorrelation, regime changes). For non-stationary data, consider using gated updates or periodically resetting weights.
4. **Mahalanobis distance requires covariance matrix**: Computing inverse covariance for N features requires O(N³) operations and N(N+1)/2 storage. For high-dimensional features (N > 10), this becomes computationally expensive. Use Euclidean or Cosine distance for N > 10, or apply PCA to reduce dimensionality first.
5. **No mini-batch SGD**: The library implements single-sample (online) SGD only. Mini-batch updates (averaging gradients over K samples) are not supported. For noisy gradients, increase EWMA alpha in feature scaling or use Huber loss instead of squared loss.
6. **Circular buffer overwrites without warning**: When capacity is reached, `push()` silently overwrites the oldest sample. If you need to preserve all historical data, implement external archiving (e.g., export to CSV via log.info) before buffer fills.
7. **Distance metrics do not handle missing features**: If a feature vector contains NA, distance functions return NA. The library does not impute missing values (mean, median, forward-fill). Users must handle NA via nz() or filtering before calling distance functions.
Informacje o Wersji
v2Added:
method weight_norm(m)
Compute L2 weight norm (for diagnostics/regularization tracking)
Namespace types: SGDState
Parameters:
m (SGDState)
method decay_lr(m, factor, every_n)
Decay learning rate by factor every N updates (step-based LR schedule)
Namespace types: SGDState
Parameters:
m (SGDState)
factor (float)
every_n (int)
method snapshot(m)
Create weight snapshot (returns copy of weights array)
Namespace types: SGDState
Parameters:
m (SGDState)
method restore(m, snap)
Restore weights from snapshot (also clears momentum to avoid jumps)
Namespace types: SGDState
Parameters:
m (SGDState)
snap (array<float>)
method health_check(m, lo, hi, floor, barssince, cooldown)
Health check: clip weights, detect inversion, reset if starving
Namespace types: SGDState
Parameters:
m (SGDState)
lo (float): lower bound for weight clipping
hi (float): upper bound for weight clipping
floor (float): reset value when all weights negative (inversion recovery)
barssince (int): bars since last fire (starvation detection)
cooldown (int): min bars between resets (prevents thrashing)
Returns: [inverted, reset_done] — inverted=true if all weights negative; reset_done=true if reset triggered
Informacje o Wersji
v3Added:
f_cov3_from_stats_shrink(n_eff, sx0, sx1, sx2, sxx00, sxx11, sxx22, sxx01, sxx02, sxx12, mu0, mu1, mu2, ridge, shrinkage)
Parameters:
n_eff (float)
sx0 (float)
sx1 (float)
sx2 (float)
sxx00 (float)
sxx11 (float)
sxx22 (float)
sxx01 (float)
sxx02 (float)
sxx12 (float)
mu0 (float)
mu1 (float)
mu2 (float)
ridge (float)
shrinkage (float)
f_var_from_stats_shrink(n_eff, sx, sxx, mu, ridge, shrinkage)
Parameters:
n_eff (float)
sx (float)
sxx (float)
mu (float)
ridge (float)
shrinkage (float)
f_inv_sym3_tri(a, b, c, d, e, f, eps)
Parameters:
a (float)
b (float)
c (float)
d (float)
e (float)
f (float)
eps (float)
Informacje o Wersji
v4Added:
f_weighted_kmeans4_stats(x_in, y_in, z_in, v_in, w_in, k_count, use_v, seed_base, iterations, min_admitted, clip_abs)
Parameters:
x_in (array<float>)
y_in (array<float>)
z_in (array<float>)
v_in (array<float>)
w_in (array<float>)
k_count (int)
use_v (bool)
seed_base (int)
iterations (int)
min_admitted (int)
clip_abs (float)
Informacje o Wersji
v5Added:
f_pack_gaussian5_i16(mu, sigma, n_eff, prior, scale)
Parameters:
mu (array<float>)
sigma (matrix<float>)
n_eff (float)
prior (float)
scale (float)
f_unpack_gaussian5_i16(data, base, scale)
Parameters:
data (string)
base (int)
scale (float)
Informacje o Wersji
v6Added:
f_probability_floor_normalize(probabilities, count, floor_value)
Parameters:
probabilities (array<float>)
count (int)
floor_value (float)
f_hmm_transition_em_step(transition, previous, filtered, predicted, count, eta, diagonal_prior, off_diagonal_prior)
Parameters:
transition (matrix<float>)
previous (array<float>)
filtered (array<float>)
predicted (array<float>)
count (int)
eta (float)
diagonal_prior (float)
off_diagonal_prior (float)
f_gaussian_stats_ewma(sum_x, sum_xx, n_eff, observation, responsibility, lambda_eff, admission_weight, prior_weighted, full_cov_dims)
Parameters:
sum_x (array<float>)
sum_xx (matrix<float>)
n_eff (float)
observation (array<float>)
responsibility (float)
lambda_eff (float)
admission_weight (float)
prior_weighted (bool)
full_cov_dims (int)
f_gaussian_stats_seed(mean, covariance, n_eff)
Parameters:
mean (array<float>)
covariance (matrix<float>)
n_eff (float)
f_gaussian_mstep3_diag(mean, seed_mean, covariance, inverse, sum_x, sum_xx, n_eff, active_dims, ridge_main, ridge_aux, shrinkage, min_n_eff, anchor)
Parameters:
mean (array<float>)
seed_mean (array<float>)
covariance (matrix<float>)
inverse (matrix<float>)
sum_x (array<float>)
sum_xx (matrix<float>)
n_eff (float)
active_dims (array<bool>)
ridge_main (float)
ridge_aux (float)
shrinkage (float)
min_n_eff (float)
anchor (float)
Biblioteka Pine
W zgodzie z duchem TradingView autor opublikował ten kod Pine jako bibliotekę open-source, aby inni programiści Pine z naszej społeczności mogli go ponownie wykorzystać. Ukłony dla autora. Można korzystać z tej biblioteki prywatnie lub w innych publikacjach open-source, jednak ponowne wykorzystanie tego kodu w publikacjach podlega Zasadom serwisu.
Wyłączenie odpowiedzialności
Informacje i publikacje nie stanowią i nie powinny być traktowane jako porady finansowe, inwestycyjne, tradingowe ani jakiekolwiek inne rekomendacje dostarczane lub zatwierdzone przez TradingView. Więcej informacji znajduje się w Warunkach użytkowania.
Biblioteka Pine
W zgodzie z duchem TradingView autor opublikował ten kod Pine jako bibliotekę open-source, aby inni programiści Pine z naszej społeczności mogli go ponownie wykorzystać. Ukłony dla autora. Można korzystać z tej biblioteki prywatnie lub w innych publikacjach open-source, jednak ponowne wykorzystanie tego kodu w publikacjach podlega Zasadom serwisu.
Wyłączenie odpowiedzialności
Informacje i publikacje nie stanowią i nie powinny być traktowane jako porady finansowe, inwestycyjne, tradingowe ani jakiekolwiek inne rekomendacje dostarczane lub zatwierdzone przez TradingView. Więcej informacji znajduje się w Warunkach użytkowania.