Skip to main content

Overview

The ML (Machine Learning) module provides classical machine learning algorithms for:
  • Classification
  • Regression
  • Clustering
  • Statistical modeling
This module implements traditional ML algorithms. For deep learning, see the DNN Module.

Key Concepts

StatModel Base Class

All ML algorithms inherit from StatModel:

TrainData Class

Encapsulates training data:

Classification Algorithms

Support Vector Machines (SVM)

SVM Types:
  • C_SVC: C-Support Vector Classification
  • NU_SVC: Nu-Support Vector Classification
  • ONE_CLASS: One-class SVM
  • EPS_SVR: Epsilon-Support Vector Regression
  • NU_SVR: Nu-Support Vector Regression
Kernel Types:
  • LINEAR: Linear kernel
  • POLY: Polynomial kernel
  • RBF: Radial Basis Function (Gaussian)
  • SIGMOID: Sigmoid kernel

K-Nearest Neighbors (KNN)

Decision Trees

Random Forest

Naive Bayes

Logistic Regression

Neural Networks

ANN_MLP (Multi-Layer Perceptron)

Clustering

K-Means

EM (Expectation Maximization)

Complete Example: SVM Classification

Model Persistence

Save Model

Load Model

Cross-Validation

Algorithm Selection Guide

AlgorithmTypeProsConsBest For
SVMClassification/RegressionEffective in high dimensionsSlow on large datasetsSmall to medium data
KNNClassification/RegressionSimple, no trainingSlow prediction, memory intensiveSmall datasets
Random ForestClassification/RegressionRobust, handles non-linearCan overfitGeneral purpose
Naive BayesClassificationFast, simpleAssumes independenceText classification
ANN_MLPClassification/RegressionPowerfulNeeds tuningComplex patterns
K-MeansClusteringFast, simpleNeeds K specifiedData segmentation

Best Practices

Normalize Features

Scale features to similar ranges for better performance

Cross-Validate

Use train/test split to avoid overfitting

Tune Parameters

Use grid search for optimal hyperparameters

Save Models

Persist trained models for reuse

See Also