LinearClassifierBase<T>
Base Classes · AiDotNet.Classification.Linear
Provides a base implementation for linear classifiers.
Inheritance: ClassifierBase<T> → ProbabilisticClassifierBase<T> → LinearClassifierBase<T>
Implements: IGradientComputable<T, Matrix<T>, Vector<T>>
Known derived types: PassiveAggressiveClassifier<T>, PerceptronClassifier<T>, RidgeClassifier<T>, SGDClassifier<T>
For Beginners
Linear classifiers are one of the simplest forms of machine learning:
How they work:
- Each feature gets a weight (importance score)
- Multiply each feature by its weight and sum them up
- Add a bias term
- If the result is positive, predict one class; otherwise, the other
The training process adjusts the weights to correctly classify training examples.
Advantages:
- Fast to train and predict
- Work well with many features
- Easy to interpret (weight = feature importance)
- Often surprisingly effective
How It Works
Linear classifiers learn a linear decision function: f(x) = w * x + b where w is the weight vector and b is the bias (intercept).
Methods
| Method | Summary |
|---|---|
IFullModel<T, Matrix<T>, Vector<T>> WithParameters(Vector<T> parameters) |
|
Matrix<T> PredictLogProbabilities(Matrix<T> input) |
|
Matrix<T> PredictProbabilities(Matrix<T> input) |
|
ModelMetadata<T> GetModelMetadata() |
|
Vector<T> ComputeGradients(Matrix<T> input, Vector<T> target, ILossFunction<T> lossFunction) |
|
Vector<T> DecisionFunctionBatch(Matrix<T> input) |
Computes decision function values for all samples. |
Vector<T> Predict(Matrix<T> input) |
|
void ApplyGradients(Vector<T> gradients, T learningRate) |