| |
- builtins.object
-
- LinearDiscriminantAnalysis
- LogisticRegression
- Perceptron
- QuadraticDiscriminantAnalysis
class LinearDiscriminantAnalysis(builtins.object) |
|
LinearDiscriminantAnalysis(solver='svd', priors=None)
Implements Linear Discriminant Analysis.
A classifier with a linear decision boundary, generated by fitting class conditional densities to the data and using Bayes' rule.
Args:
solver: (str) - {'svd', 'lsqr', 'eigen'}, default='svd'. Solver to use for the LDA.
priors: (np.ndarray), optional - Prior probabilities of the classes (default is None). |
|
Methods defined here:
- __init__(self, solver='svd', priors=None)
- Initializes the Linear Discriminant Analysis model.
Args:
solver: (str) - {'svd', 'lsqr', 'eigen'}, default='svd'. Solver to use for the LDA.
priors: (np.ndarray), optional - Prior probabilities of the classes (default is None).
- decision_function(self, X)
- Computes the log-likelihood of each class for the input data. The decision function is the log-likelihood of each class.
Args:
X: (np.ndarray) - Test feature data.
Returns:
scores: (np.ndarray) - Log-likelihood of each class for the input samples.
- fit(self, X, y)
- Fits the LDA model to the training data.
Args:
X: (np.ndarray) - Training feature data.
y: (np.ndarray) - Training target data.
- predict(self, X)
- Predicts class labels for the input data.
Args:
X: (np.ndarray) - Test feature data.
Returns:
predictions: (np.ndarray) - Predicted class labels.
Data descriptors defined here:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
|
class LogisticRegression(builtins.object) |
|
LogisticRegression(learning_rate=0.01, max_iter=1000)
Implements Logistic Regression using gradient descent. Supports binary and multiclass classification.
Args:
learning_rate: (float) - Learning rate for gradient updates (default is 0.01).
max_iter: (int) - Maximum number of iterations (default is 1000). |
|
Methods defined here:
- __init__(self, learning_rate=0.01, max_iter=1000)
- Initializes the classifier with specified hyperparameters.
Args:
learning_rate (float, optional): The step size for updating weights during training. Defaults to 0.01.
max_iter (int, optional): The maximum number of iterations for the training process. Defaults to 1000.
- fit(self, X, y)
- Fits the Logistic Regression model to the training data.
Args:
X: (np.ndarray) - Training feature data of shape (n_samples, n_features).
y: (np.ndarray) - Training target data of shape (n_samples,).
- predict(self, X)
- Predicts class labels for the input data.
Args:
X: (np.ndarray) - Test feature data.
Returns:
predictions: (np.ndarray) - Predicted class labels.
Data descriptors defined here:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
|
class Perceptron(builtins.object) |
|
Perceptron(max_iter=1000, learning_rate=0.01)
Implements the Perceptron algorithm for binary and multiclass classification.
Args:
max_iter: (int) - Maximum number of iterations (default is 1000).
learning_rate: (float) - Learning rate for weight updates (default is 0.01). |
|
Methods defined here:
- __init__(self, max_iter=1000, learning_rate=0.01)
- Initializes the classifier with the specified maximum number of iterations and learning rate.
Args:
max_iter (int, optional): The maximum number of iterations for the training process. Defaults to 1000.
learning_rate (float, optional): The learning rate for the optimization algorithm. Defaults to 0.01.
- fit(self, X, y)
- Fits the Perceptron model to the training data.
Args:
X: (np.ndarray) - Training feature data of shape (n_samples, n_features).
y: (np.ndarray) - Training target data of shape (n_samples,).
- predict(self, X)
- Predicts class labels for the input data.
Args:
X: (np.ndarray) - Test feature data.
Returns:
predictions: (np.ndarray) - Predicted class labels.
Data descriptors defined here:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
|
class QuadraticDiscriminantAnalysis(builtins.object) |
|
QuadraticDiscriminantAnalysis(priors=None, reg_param=0.0)
Implements Quadratic Discriminant Analysis.
The quadratic term allows for more flexibility in modeling the class conditional
A classifier with a quadratic decision boundary, generated by fitting class conditional densities to the data and using Bayes' rule.
Args:
priors: (np.ndarray), optional - Prior probabilities of the classes (default is None).
reg_param: (float), optional - Regularization parameter (default is 0.0). |
|
Methods defined here:
- __init__(self, priors=None, reg_param=0.0)
- Initialize the Quadratic Discriminant Analysis model with the specified prior probabilities and regularization parameter.
Args:
priors: (np.ndarray), optional - Prior probabilities of the classes (default is None).
reg_param: (float), optional - Regularization parameter (default is 0.0).
- decision_function(self, X)
- Apply decision function to an array of samples.
The decision function is the log-likelihood of each class.
Args:
X: (np.ndarray) - Test feature data.
Returns:
scores: (np.ndarray) - Log-likelihood of each class for the input samples.
- fit(self, X, y)
- Fit the model according to the given training data. Uses the means and covariance matrices of each class.
Args:
X: (np.ndarray) - Training feature data.
y: (np.ndarray) - Training target data.
- predict(self, X)
- Perform classification on an array of test vectors X.
Args:
X: (np.ndarray) - Test feature data.
Returns:
predictions: (np.ndarray) - Predicted class labels.
Data descriptors defined here:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
| |