DocumentationNeurondB Documentation

Classification Algorithms

Logistic Regression

Binary classification using logistic regression with gradient descent.

Train Logistic Regression

Train model

-- Train with gradient descent
SELECT train_logistic_regression(
    'logistic_train',    -- Training table
    'features',          -- Feature column
    'label',             -- Target column
    500,                 -- Max iterations
    0.01,                -- Learning rate
    0.01                 -- Regularization (L2 penalty)
) AS coefficients;

Evaluate Model

Evaluate on test data

-- Evaluate on test data with threshold = 0.5
SELECT evaluate_logistic_regression(
    'logistic_test',     -- Test table
    'features',          -- Feature column
    'label',             -- Target column
    :coefficients,       -- Model coefficients
    0.5                  -- Classification threshold
) AS test_metrics;

Random Forest

Ensemble method using multiple decision trees for robust classification.

Train Random Forest

SELECT train_random_forest_classifier(
    'training_data',     -- Training table
    'features',          -- Feature column
    'label',             -- Target column
    100,                 -- Number of trees
    10                   -- Max depth
) AS model_id;

K-Nearest Neighbors

Instance-based learning that classifies based on nearest neighbors.

KNN classification

SELECT predict_knn(
    'training_data',     -- Training table
    'features',          -- Feature column
    'label',             -- Target column
    query_features,      -- Query vector
    5                    -- K neighbors
) AS predicted_label;

Next Steps