Repository navigation
Quiver 1.7.0
Quiver 1.7.0
Overview
This release adds BernoulliNaiveBayes, a classifier for yes/no features such as whether a message contains a given word. It joins GaussianNaiveBayes and KNearestNeighbors under the shared Classifier protocol. Fitted logistic regression models can now print their own formula, and models fit without an intercept print correctly.
Panel now supports row-by-row iteration with a standard for loop, and the retrieval types, seeded generator and row iterator are Sendable, so they can cross actors and tasks in Swift 6 apps without warnings. Quiver now builds and tests on Linux (Swift 5.9 and 6.4) and Windows (Swift 6.1 and 6.4).
Matrix routines now judge singularity relative to the size of the matrix, so rank-deficient designs with large entries are caught and well-conditioned matrices with tiny entries are no longer rejected. This release is additive, with the behavior changes listed below.
Feature — Bernoulli Naive Bayes
Classifies samples from binary (0 or 1) features, such as word-presence flags in text, using per-class feature probabilities with additive smoothing.
BernoulliNaiveBayes.fit(features:labels:alpha:)— fits per-class priors and feature probabilities.alphais the smoothing constant and defaults to1.0.predict(_:)— returns the most probable label for each sample.predictProbabilities(_:)/predictLogProbabilities(_:)— return normalized per-class probability estimates, or their logarithms, for each sample.classes,featureCount,alpha— the fitted state. EachClassStatsentry carries itslabel,prior,featureProbabilities, andcount.
BernoulliNaiveBayes conforms to Classifier, Codable, Equatable, and Sendable, and shares its tie-breaking with GaussianNaiveBayes, so equal scores resolve to the same label every time.
Feature — Iterating Panel rows
Reads a Panel one observation at a time without indexing into columns.
Panel.Row— a single row withcolumnNames,values, and asubscript(column:)that returns the value for a named column.Panelconforms toSequence, sofor row in paneland the standardmap,filter, andreducework directly. Note that the standardfilterreturns[Panel.Row], whilefiltered(where:)continues to return aPanel.
Feature — Logistic regression equation
LogisticRegression.equation(form:)— renders the fit as a readable formula..logOdds(the default) prints the linear score, such aslog-odds = -0.20 + 3.10x;.probabilitywraps the same score in the sigmoid, such asp = σ(-0.20 + 3.10x).LogisticRegression.EquationForm— the two supported forms.
Feature — Concurrency
EmbeddingIndex (with its Entry and Snapshot types), RetrievalResult, and RetrievedHit conform to Sendable when their Label does. SeededRandomNumberGenerator and Panel.Iterator conform unconditionally. An index can be captured in a server route or passed between actors without warnings under Swift 6.
Feature — Distributions
Distributions.t.pdf(x:df:)— probability density of the t-distribution atx, withdfdegrees of freedom. Evaluated in log space so largedfand far-tailxstay accurate. Returnsnilwhendfis not positive.
Feature — Linux and Windows support
Quiver is a pure Swift package with no external dependencies and now builds and passes its test suite on Linux (Swift 5.9 and 6.4) and Windows (Swift 6.1 and 6.4). Continuous integration runs both on every change.
Change — Scale-aware singular matrix detection
luDecomposed(), determinant, logDeterminant, inverted() and the non-throwing inverse now share one singular-pivot cutoff that scales with the largest entry in the matrix, replacing a fixed cutoff. Rank-deficient matrices with large entries, such as a design that includes both square feet and square meters, now throw MatrixError.singular instead of returning meaningless coefficients. Well-conditioned matrices with very small entries are no longer reported as singular. A 0.0 determinant and MatrixError.singular now describe the same matrices, including for 2×2 inputs.
Change — Models without an intercept
Coefficients adds hasIntercept, which defaults to true. Models fit with intercept: false now print an equation() in which the first weight is a weight rather than an intercept. ResidualModel forwards the wrapped model's setting. Code that conforms to Coefficients outside Quiver needs no changes.
Change — Mode ordering
Array.mode() returns tied values in the order they first appear in the array. Previously the order of tied values could change between launches.
Change — Documentation
Added Quiver on Linux, a guide to building and testing Quiver in a Linux container. More than twenty existing articles received accuracy corrections to statistical, machine learning, and mathematical claims, including Naive Bayes probabilities described as normalized estimates rather than calibrated ones.
Fixed
- Fixed
Array.mode()returning tied values in a different order on each launch. - Fixed a rank-deficient matrix with large entries passing the singular check in
luDecomposed(),determinant, andinverted(). - Fixed a well-conditioned matrix with very small entries being reported as singular.
- Fixed
equation()printing the first weight as an intercept for models fit without one. - Fixed
GaussianNaiveBayesdescription wording for a single class or feature ("1 class, 1 feature"). - Fixed
Quiver.versionto report"1.7.0".
Documentation
New conceptual guides:
- Quiver on Linux (Utilities) — building and testing in a Linux container, and checking filename case sensitivity.
New API and topic pages:
- Naive Bayes (Models) — expanded to cover
BernoulliNaiveBayesalongsideGaussianNaiveBayes. - Working with Panels (Data Preparation) — new section on iterating rows.
- Logistic Regression (Models) — new section on reading the fitted equation.
Expanded pages: Linear Regression, Gradient Descent, Retrieving Context for Generation, Quiver Notebook, and Notebook Datasets, plus the Machine Learning, Statistics, Probability, Regularization, Optimization, Inferential Statistics, Model Interpretation, Eigenvalues, Determinants, Calculus, and Rendering Math primers.