AuDoLab.subclasses.one_class_svm¶
- class AuDoLab.subclasses.one_class_svm.One_Class_SVM[source]¶
Bases:
object- static choose_classifier(df, classifier, i)[source]¶
Returns dataframe where documents that are classified to target class have 1, otherwise, 0
- Args:
df (pd.Dataframe): dataframe of target documents
classifier (list): list of all possible o-svm classifiers
i (int): index of which classifier is chosen/preferred
- Returns:
pd.dataframe: documents that are classified as belonging to target
- static classification(training, predicting, nus, quality_train=0.85, min_pred=0.05, max_pred=0.2, gamma='auto', kernel='rbf')[source]¶
Returns the classifiers that fullfill the required conditions.
- Args:
training (DataFrame): training dataset of preprocessed documents
predicting (DataFrame): target dataset of preprccessed documents
- nus (list of floats): hyperparameters over which are looped. For
each nu the classifier is trained
- quality_train (float, optional): percentage of training data that
seems to belong to target class. Default: 0.85. Defaults to 0.85.
- min_pred (float, optional): percentage of target data that has to be
at least classified as belonging to target class for classifier to be considered. Default: 0.0. Defaults to 0.05.
- max_pred (float, optional): percentage of target class that is
maximally allowed to be classified as belonging to
target class for classifier to be considered.. Defaults to 0.2.
gamma (str, optional): Hyperparamter of O-SVM. Defaults to “auto”.
- kernel (str, optional): Kernel function used in O_SVM. Defaults to
“rbf”.
- Returns:
- pd.DataFrame: DataFrame with stored classifiers that fulfill
conditions