Moral88 0.6.0__py3-none-any.whl → 0.8.0__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
Moral88/__init__.py CHANGED
@@ -1 +0,0 @@
1
- from .regression import mean_absolute_error, mean_squared_error, r_squared
Moral88/regression.py CHANGED
@@ -101,7 +101,9 @@ class DataValidator:
101
101
  return y_true, y_pred
102
102
 
103
103
 
104
- class Metrics:
104
+ class metrics:
105
+ def __init__(self):
106
+ pass
105
107
  def mean_bias_deviation(self, y_true, y_pred, library=None, flatten=True):
106
108
  """
107
109
  Computes Mean Bias Deviation (MBD).
@@ -292,6 +294,7 @@ class Metrics:
292
294
  """
293
295
  y_true, y_pred = self.validator.validate_regression_targets(y_true, y_pred)
294
296
  y_true, y_pred = self.validator.validate_mae_mse_inputs(y_true, y_pred, library)
297
+ y_true = np.clip(y_true, 1e-8, None)
295
298
 
296
299
  if library == 'sklearn':
297
300
  from sklearn.metrics import mean_absolute_percentage_error as sklearn_mape
@@ -309,7 +312,7 @@ class Metrics:
309
312
  y_pred_tensor = tf.convert_to_tensor(y_pred, dtype=tf.float32)
310
313
  return tf.reduce_mean(tf.abs((y_true_tensor - y_pred_tensor) / tf.clip_by_value(y_true_tensor, 1e-8, tf.float32.max))).numpy() * 100
311
314
 
312
- return np.mean(np.abs((y_true - y_pred) / np.clip(y_true, 1e-8, None))) * 100
315
+ return np.mean(np.abs((y_true - y_pred) / np.clip(np.abs(y_true), 1e-8, None))) * 100
313
316
 
314
317
  def explained_variance_score(self, y_true, y_pred, library=None, flatten=True):
315
318
  """
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: Moral88
3
- Version: 0.6.0
3
+ Version: 0.8.0
4
4
  Summary: A library for regression evaluation metrics.
5
5
  Author: Morteza Alizadeh
6
6
  Author-email: alizadeh.c2m@gmail.com
@@ -0,0 +1,8 @@
1
+ Moral88/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ Moral88/regression.py,sha256=V4Iqug1rkACBvHoKZ2-4-CK-XK6VP20qok8rWqWjEdE,17302
3
+ Moral88/segmentation.py,sha256=v0yqxdrKbM9LM7wVKLjJ4HrhrSrilNNeWS6-oK_27Ag,1363
4
+ Moral88-0.8.0.dist-info/LICENSE,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
+ Moral88-0.8.0.dist-info/METADATA,sha256=rlMlw0Mt2e202Je7YqkoWNFNmsieOKfleNM2DcelDGw,407
6
+ Moral88-0.8.0.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
7
+ Moral88-0.8.0.dist-info/top_level.txt,sha256=-dyn5iTprnSUHbtMpvRO-prJsIoaRxao7wlfCHLSsv4,8
8
+ Moral88-0.8.0.dist-info/RECORD,,
@@ -1,8 +0,0 @@
1
- Moral88/__init__.py,sha256=vb-aPc9ZbnYNSy9qq2fVESI63E10pYsCrDpnV8OHWkg,74
2
- Moral88/regression.py,sha256=0aSRXLWur6tcC4xd806koyB2ktgPJodlOeXYCZZYDzE,17208
3
- Moral88/segmentation.py,sha256=v0yqxdrKbM9LM7wVKLjJ4HrhrSrilNNeWS6-oK_27Ag,1363
4
- Moral88-0.6.0.dist-info/LICENSE,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
- Moral88-0.6.0.dist-info/METADATA,sha256=6Y1H8Qh9wnrZVUr2gnoBYMnF5EsXY6ijMoS9bFZ21bE,407
6
- Moral88-0.6.0.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
7
- Moral88-0.6.0.dist-info/top_level.txt,sha256=-dyn5iTprnSUHbtMpvRO-prJsIoaRxao7wlfCHLSsv4,8
8
- Moral88-0.6.0.dist-info/RECORD,,