Team Ai
Apppublic

freeEDU/Log-Decoder

sourceHugging Facemitupdated 3y agoView on Hugging Face
0likes
LR.cpython-38.pyc43 linesDownload Raw Back to __pycache__
1U

2���d��@s8dZddlZddlmZddlmZGdd�de�ZdS)uX3The implementation of the logistic regression model for anomaly detection.4 5Authors: 6    LogPAI Team7 8Reference: 9    [1] Peter Bodík, Moises Goldszmidt, Armando Fox, Hans Andersen. Fingerprinting 10        the Datacenter: Automated Classification of Performance Crises. The European 11        Conference on Computer Systems (EuroSys), 2010.12 13�N)�LogisticRegression�)�metricsc@s6eZdZddd�Zdd�Zd	d14�Zdd�Zd
d�ZdS)�LR�l2�d�{�G�z�?NcCst|||||d�|_dS)z� The Invariants Mining model for anomaly detection15 16        Attributes17        ----------18            classifier: object, the classifier for anomaly detection19        )�penalty�C�tol�class_weight�max_iterN)r�20classifier)�selfr	r21rrr
�r�0D:\freeEdu\Log Decoder\app\loglizer\models\LR.py�__init__s22�zLR.__init__cCstd�|j�||�dS)z�23        Arguments24        ---------25            X: ndarray, the event count matrix of shape num_instances-by-num_events26        z====== Model summary ======N)�printr�fit)r�X�yrrrrszLR.fitcCs|j�|�}|S�z� Predict anomalies with mined invariants27 28        Arguments29        ---------30            X: the input event count matrix31 32        Returns33        -------34            y_pred: ndarray, the predicted label vector of shape (num_instances,)35        )r�predict�rr�y_predrrrr(sz36LR.predictcCs|j�|�}|Sr)r�
predict_probarrrrr6szLR.predict_probacCs>td�|�|�}t||�\}}}td�|||��|||fS)Nz ====== Evaluation summary ======z6Precision: {:.3f}, recall: {:.3f}, F1-measure: {:.3f}37)rrr�format)rr�y_truer�	precision�recall�f1rrr�evaluateDs3839zLR.evaluate)rrrNr)�__name__�40__module__�__qualname__rrrrr!rrrrrs4142 43	r)	�__doc__�numpy�npZsklearn.linear_modelr�utilsr�objectrrrrr�<module>s