diff --git a/pycaret/anomaly.py b/pycaret/anomaly.py index 10ead4b3328afc278894560e79516de3855f1ceb..0736bc426683946a6ac163903d9935454d25821b 100644 --- a/pycaret/anomaly.py +++ b/pycaret/anomaly.py @@ -3565,12 +3565,33 @@ def get_outliers(data, else: ignore_features_pass = ignore_features - global X, data_, seed, n_jobs_param, logging_param + global X, data_, seed, n_jobs_param, logging_param, logger n_jobs_param = n_jobs logging_param = False + import logging + + logger = logging.getLogger('logs') + logger.setLevel(logging.DEBUG) + + # create console handler and set level to debug + if logger.hasHandlers(): + logger.handlers.clear() + + ch = logging.FileHandler('logs.log') + ch.setLevel(logging.DEBUG) + + # create formatter + formatter = logging.Formatter('%(asctime)s:%(levelname)s:%(message)s') + + # add formatter to ch + ch.setFormatter(formatter) + + # add ch to logger + logger.addHandler(ch) + data_ = data.copy() seed = 99 diff --git a/pycaret/utils.py b/pycaret/utils.py index 8fd9ac0f7d624e0eb1cc57c84a4a52195ae93b0f..47809b38f1c4e886c1657604fc3a58a2f7633484 100644 --- a/pycaret/utils.py +++ b/pycaret/utils.py @@ -2,7 +2,7 @@ # Author: Moez Ali # License: MIT -version_ = "pycaret-nightly-0.32" +version_ = "pycaret-nightly-0.33" def version(): print(version_) @@ -21,73 +21,79 @@ def check_metric(actual, prediction, metric, round=4): #metric calculation starts here - if metric == 'accuracy': + if metric == 'Accuracy': from sklearn import metrics result = metrics.accuracy_score(actual,prediction) result = result.round(round) - elif metric == 'recall': + elif metric == 'Recall': from sklearn import metrics result = metrics.recall_score(actual,prediction) result = result.round(round) - elif metric == 'precision': + elif metric == 'Precision': from sklearn import metrics result = metrics.precision_score(actual,prediction) result = result.round(round) - elif metric == 'f1': + elif metric == 'F1': from sklearn import metrics result = metrics.f1_score(actual,prediction) result = result.round(round) - elif metric == 'kappa': + elif metric == 'Kappa': from sklearn import metrics result = metrics.cohen_kappa_score(actual,prediction) result = result.round(round) - elif metric == 'auc': + elif metric == 'AUC': from sklearn import metrics result = metrics.roc_auc_score(actual,prediction) result = result.round(round) - elif metric == 'mae': + elif metric == 'MCC': + + from sklearn import metrics + result = metrics.matthews_corrcoef(actual,prediction) + result = result.round(round) + + elif metric == 'MAE': from sklearn import metrics result = metrics.mean_absolute_error(actual,prediction) result = result.round(round) - elif metric == 'mse': + elif metric == 'MSE': from sklearn import metrics result = metrics.mean_squared_error(actual,prediction) result = result.round(round) - elif metric == 'rmse': + elif metric == 'RMSE': from sklearn import metrics result = metrics.mean_squared_error(actual,prediction) result = np.sqrt(result) result = result.round(round) - elif metric == 'r2': + elif metric == 'R2': from sklearn import metrics result = metrics.r2_score(actual,prediction) result = result.round(round) - elif metric == 'rmsle': + elif metric == 'RMSLE': result = np.sqrt(np.mean(np.power(np.log(np.array(abs(prediction))+1) - np.log(np.array(abs(actual))+1), 2))) result = result.round(round) - elif metric == 'mape': + elif metric == 'MAPE': mask = actual != 0 result = (np.fabs(actual - prediction)/actual)[mask].mean() diff --git a/setup.py b/setup.py index 2e79e62d3e82ba939c1735feb6dc9f29d82937ec..65d7628c32dbc1689bcf00ac40d18ed0796e401f 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ with open('requirements.txt') as f: setup( name="pycaret-nightly", - version="0.32", + version="0.33", description="Nightly build of PyCaret - An open source, low-code machine learning library in Python.", long_description=readme(), long_description_content_type="text/markdown",