Skip to content

Releases: Nodibell/SwiftSci

v1.4.0: High-Performance Engine, Feature Importances, RFE & DocC

Choose a tag to compare

@Nodibell Nodibell released this 22 Jul 22:49

🚀 SwiftSci v1.4.0 Release Notes

📦 Key Additions & Features

  • SystemsCSVParser (SwiftDataFrame): High-performance zero-copy memory-mapped RFC 4180 DFA byte parser, speeding up CSV ingestion by ~10× on large datasets.
  • Vectorized Byte Parsers (SwiftDataFrame): Zero-allocation ASCII parsers (VectorizedByteParsers) for fast Double, Int, and string decoding from unmanaged byte buffers.
  • vDSP Reductions (SwiftDataFrame): Accelerated TypedColumn<Double> mean(), variance(), and stdDev() using Apple Accelerate vDSP reductions.
  • DataFrame Index Filtering & Argsort (SwiftDataFrame): Added filterRows(by:) index-based boolean mask filtering and argsort() column index sorting.
  • Recursive Feature Elimination RFE (SwiftPreprocessing): Added RecursiveFeatureElimination (RFE) for iterative feature selection based on estimator feature importances.
  • Feature Importances & Model Persistence (SwiftML): Added Gini featureImportances property to DecisionTreeClassifier, DecisionTreeRegressor, RandomForestClassifier, RandomForestRegressor, and added Codable serialization (save(to:) / load(from:)) across classical estimators.
  • NLP Text Tokenizers & Feature Extraction (SwiftNLP): Added NGramTokenizer (word & char n-grams) and HashingVectorizer (MurmurHash3 memory-bounded token hashing).
  • Time Series Windowing (SwiftForecast): Added ExpandingWindow feature transformer for cumulative time-series feature generation.
  • Swift DocC Integration & Multi-Module Site: Integrated swift-docc-plugin (v1.5.0) and deployed unified 10-module static web documentation to GitHub Pages.

🛠️ Fixes & Concurrency Improvements

  • GradientBoostedTrees Bounds Check (SwiftML): Enforced bounds checking in GradientBoostedTreesRegressor.
  • Seeded Random Number Generators (SwiftPreprocessing): Fixed deterministic seeding in SMOTE and RandomUndersampler using LCG.
  • SelectKBest ANOVA Scoring (SwiftPreprocessing): Fixed ANOVA F-statistic calculation in SelectKBest and added explicit SwiftStats dependency to SwiftPreprocessing.
  • CalibratedClassifier Concurrency (SwiftML): Converted CalibratedClassifier to actor to guarantee thread safety under Swift 6 strict concurrency rules.
  • Wired Memory Scaling (SwiftPreprocessing): Dynamically scaled WiredMemoryManager default limits using ProcessInfo.processInfo.activeProcessorCount.

📊 Benchmark Performance Summary (v1.4.0 vs Python)

Benchmark Test Swift (ms) Python (ms) Speedup Winner
ARIMA(1,1,1) Fit (50k pts) 2.228 ms 206.414 ms 92.66x 🟢 Swift
ARIMA(1,1,1) Forecast (horizon=24) 2.297 ms 209.709 ms 91.28x 🟢 Swift
Holt-Winters Fit (50k pts, period=12) 6.823 ms 138.947 ms 20.37x 🟢 Swift
Random Forest Fit (1k×4, 50 trees) 4.580 ms 24.217 ms 5.29x 🟢 Swift
KernelSHAP Explain (5 feats, 100 coalitions) 0.148 ms 0.452 ms 3.05x 🟢 Swift
Kalman Filter 1D (10k obs) 56.508 ms 84.692 ms 1.50x 🟢 Swift
Mean (vDSP, 1M elements) 0.083 ms 0.119 ms 1.44x 🟢 Swift

🌐 Live Documentation: https://nodibell.github.io/SwiftSci/

Full Changelog: v1.3.0...v1.4.0

v1.3.0 — Sklearn Parity Roadmap Release

Choose a tag to compare

@Nodibell Nodibell released this 22 Jul 14:01

SwiftSci v1.3.0 — Sklearn Parity Roadmap Release 🚀

SwiftSci v1.3.0 achieves complete functional parity with Core Scikit-Learn patterns, introducing estimator pipelines, subset column routing, randomized hyperparameter search, outlier detection, imbalanced dataset sampling, probability calibration, and time-series feature transformers.

🌟 What's New

🔗 Estimator Pipelines & Subset Routing (SwiftML & SwiftPreprocessing)

  • ClassificationPipeline & RegressionPipeline: Chain zero or more PreprocessingTransformer steps directly into a final estimator for leak-free model training and evaluation.
  • ColumnTransformer: Route specific subsets of DataFrame columns to independent preprocessing transformers and concatenate outputs seamlessly.

🌲 Outlier Detection (SwiftCluster)

  • IsolationForest: Random partition isolation trees for anomaly detection and score ranking.
  • LocalOutlierFactor (LOF): kNN local reachability density ratio anomaly scoring.

⚖️ Imbalanced Learning (SwiftPreprocessing)

  • SMOTE: Synthetic Minority Over-sampling Technique using k-nearest neighbor interpolation.
  • RandomUndersampler: Random majority class sub-sampling dataset balancer.

🎲 Hyperparameter Tuning & Probability Calibration (SwiftOptimize & SwiftML)

  • RandomizedSearchCV: Parallel randomized hyperparameter search integrated with KFold cross-validation.
  • CalibratedClassifier: Platt scaling logistic calibration wrapper over raw decision boundaries.

📈 Class Probabilities & Extended Metrics (SwiftML & SwiftOptimize)

  • ClassifierEstimator.predictProbability: Standardized 2D class probability outputs across DecisionTreeClassifier, RandomForestClassifier, and LogisticRegression.
  • Extended Metrics: balancedAccuracy, matthewsCorrelationCoefficient (MCC), cohenKappa, logLoss, brierScore, rocCurve, rocAUC, and prCurve.

⏱️ Feature Engineering, Selection & NLP (SwiftPreprocessing, SwiftForecast & SwiftNLP)

  • VarianceThreshold & SelectKBest: Feature variance filtering and top K feature ranking.
  • InteractionFeatures & DateFeatures: Pairwise feature product terms and date component extractions.
  • LagTransformer & RollingWindow: Lagged feature matrix builder and sliding window statistics.
  • CountVectorizer: Document term frequency count matrix generator.
  • DatasetUtilities: Synthetic dataset generators (makeClassification, makeRegression, makeMoons).

📊 Benchmark Performance Summary (v1.3.0 vs Python)

Benchmark Test Swift (ms) Python (ms) Speedup Winner
ARIMA(1,1,1) Fit (50k pts) 2.280 ms 215.527 ms 94.53x 🟢 Swift
Holt-Winters Fit (50k pts, period=12) 6.811 ms 148.627 ms 21.82x 🟢 Swift
KernelSHAP Explain (5 feats, 100 coalitions) 0.075 ms 0.426 ms 5.68x 🟢 Swift
Random Forest Fit (1k×4, 50 trees) 4.516 ms 25.475 ms 5.64x 🟢 Swift
Mean (vDSP, 1M elements) 0.081 ms 0.121 ms 1.49x 🟢 Swift
Pearson Correlation (500k elements) 0.856 ms 1.256 ms 1.47x 🟢 Swift
Isolation Forest Fit (1k×10, 100 trees) 14.048 ms 16.510 ms 1.18x 🟢 Swift
StdDev (vDSP, 1M elements) 0.477 ms 0.539 ms 1.13x 🟢 Swift
Variance (vDSP, 1M elements) 0.501 ms 0.520 ms 1.04x 🟢 Swift

📦 Installation

Add SwiftSci to your Package.swift:

dependencies: [
    .package(url: "https://github.com/Nodibell/SwiftSci.git", from: "1.3.0")
]

Full Changelog: v1.2.0...v1.3.0

v1.2.0 — SwiftSci Package Rename, Joseph Form Kalman Filter & UTF-8 BPE Tokenizer

Choose a tag to compare

@Nodibell Nodibell released this 22 Jul 13:18

SwiftSci v1.2.0

📦 What's Changed

🏷️ Package Rename & Branding

  • SwiftSci Rename: Main Swift Package renamed from SwiftAnalytics to SwiftSci (name: "SwiftSci") for cleaner ecosystem branding while preserving target module names (SwiftDataFrame, SwiftStats, SwiftML, SwiftForecast, etc.).

📐 Numerical Stabilization & Core Upgrades

  • Joseph Form Kalman Filter (SwiftForecast): Updated covariance matrix updates in filter() and smooth() to the numerically stable Joseph form P = (I - KH) P_pred (I - KH)^T + K R K^T, preserving symmetry and positive-definiteness under long filtering runs.
  • UTF-8 Byte BPE Tokenizer (SwiftNLP): Refactored BPETokenizer bpe() algorithm to operate directly on word.utf8 bytes with GPT-2 byte-to-unicode character encoding (makeByteEncoder), fixing incorrect tokenization for non-ASCII input.

📊 DataFrame Enhancements (SwiftDataFrame)

  • DataFrame.addColumn(_:as:using:): Added row-closure builder for computing new columns per-row over DataFrameRow, delegating to withColumn.
  • DataFrameError.partialCastFailure: Added explicit error case thrown when partial element casting fails in castColumn (failed out of total), preventing silent data loss.
  • DataFrame Invariant Diagnostics: Refactored DataFrame.gathered(at:) to trap with preconditionFailure on internal length invariant violations instead of returning an empty DataFrame. Removed duplicate private rows(at:).
  • DataFrame.sample Randomization: Updated sample(n:seed:ordered:) to return randomly shuffled rows by default (ordered: false) while allowing index order preservation via ordered: true.

📊 Benchmark Performance Summary (SwiftSci vs Python)

Benchmark Test Swift (ms) Python (ms) Speedup Winner
Mean (vDSP, 1M elements) 0.082 ms 0.121 ms 1.47x 🟢 Swift
Pearson Correlation (500k elements) 0.868 ms 1.256 ms 1.45x 🟢 Swift
ARIMA(1,1,1) Fit (50k pts) 2.323 ms 215.527 ms 92.78x 🟢 Swift
ARIMA Forecast Horizon=24 2.456 ms 211.880 ms 86.26x 🟢 Swift
Holt-Winters Fit (50k pts, period=12) 6.841 ms 148.627 ms 21.73x 🟢 Swift
Random Forest Fit (1k×4, 50 trees) 5.025 ms 25.475 ms 5.07x 🟢 Swift
KernelSHAP Explain (5 feats, 100 coalitions) 0.192 ms 0.426 ms 2.22x 🟢 Swift
Kalman Filter 1D (10k obs, Joseph Form) 62.349 ms 85.547 ms 1.37x 🟢 Swift
LLM Forward Pass (seqLen=64) 0.636 ms 0.528 ms 0.83x 🔴 PyTorch
CSV Read (100k rows, 5 cols) 177.509 ms 19.340 ms 0.11x 🔴 Pandas
CSV Stream Read (chunk=10k) 238.699 ms 22.525 ms 0.09x 🔴 Pandas
  • CI Gate Status: PASSED ✅ (0 gated regressions detected).

Full Changelog: v1.1.0...v1.2.0

v1.1.0 — Streaming CSV Parser, SafeTensors & GARCH

Choose a tag to compare

@Nodibell Nodibell released this 22 Jul 13:02

What's Changed in v1.1.0

🚀 Highlights

  • Streaming CSV Parser (SwiftDataFrame): Parallel, chunk-buffered streaming CSV reader returning AsyncThrowingStream<DataFrame, Error> via Swift TaskGroup worker threads for low-memory, high-speed parsing of large files.
  • SafeTensors & GGUF Parser (SwiftLLM): Native zero-copy binary weight parsers for local AI model inference, mapping model parameters from binary headers directly into MLXArray memory.
  • SARIMA & GARCH Models (SwiftForecast): Added SARIMAModel (Seasonal ARIMA) with seasonal differencing and conditional least squares, and GARCHModel (Generalized Autoregressive Conditional Heteroskedasticity) with coordinate descent MLE parameter optimization.
  • Swift 6 Strict Concurrency & Package Standardization: Fully verified under -strict-concurrency=complete. Cleaned up SwiftPM build flags to allow seamless integration as a package dependency.

🧹 Refactoring

  • Cleaned up legacy compiler directives across LAPACK wrappers in SwiftForecast and SwiftCluster.
  • Removed legacy SwiftPrivacy primitives in preparation for apple/swift-homomorphic-encryption binding in v1.2.

Full Changelog: v1.0.0...v1.1.0

v1.0.0 Stable release

Choose a tag to compare

@Nodibell Nodibell released this 17 Jul 11:20

First stable release of SwiftAnalytics. Fully optimized for Apple Silicon (Accelerate vDSP/MLX) under Swift 6 strict concurrency.