alpbench.util.pytorch_tabnet.metrics¶
Functions
|
Implements unsupervised loss function. |
|
|
|
Check if custom metrics are provided. |
Classes
|
AUC. |
|
Accuracy. |
Balanced Accuracy. |
|
|
LogLoss. |
|
Mean Absolute Error. |
|
Mean Squared Error. |
|
|
|
Container holding a list of metrics. |
|
Root Mean Squared Error. |
|
Root Mean squared logarithmic error regression loss. |
|
Container holding a list of metrics. |
Unsupervised metric |
|
Unsupervised metric |
- class alpbench.util.pytorch_tabnet.metrics.BalancedAccuracy[source]¶
Bases:
MetricBalanced Accuracy.
- class alpbench.util.pytorch_tabnet.metrics.MetricContainer(metric_names, prefix='')[source]¶
Bases:
objectContainer holding a list of metrics.
- Parameters:
- class alpbench.util.pytorch_tabnet.metrics.RMSLE[source]¶
Bases:
MetricRoot Mean squared logarithmic error regression loss. Scikit-implementation: https://scikit-learn.org/stable/modules/generated/sklearn.metrics.mean_squared_log_error.html Note: In order to avoid error, negative predictions are clipped to 0. This means that you should clip negative predictions manually after calling predict.
- class alpbench.util.pytorch_tabnet.metrics.UnsupMetricContainer(metric_names, prefix='')[source]¶
Bases:
objectContainer holding a list of metrics.
- Parameters:
y_pred (torch.Tensor or np.array) – Reconstructed prediction (with embeddings)
embedded_x (torch.Tensor) – Original input embedded by network
obf_vars (torch.Tensor) – Binary mask for obfuscated variables. 1 means the variables was obfuscated so reconstruction is based on this.
- class alpbench.util.pytorch_tabnet.metrics.UnsupervisedMetric[source]¶
Bases:
MetricUnsupervised metric
- __call__(y_pred, embedded_x, obf_vars)[source]¶
Compute MSE (Mean Squared Error) of predictions.
- Parameters:
y_pred (torch.Tensor or np.array) – Reconstructed prediction (with embeddings)
embedded_x (torch.Tensor) – Original input embedded by network
obf_vars (torch.Tensor) – Binary mask for obfuscated variables. 1 means the variables was obfuscated so reconstruction is based on this.
- Returns:
MSE of predictions vs targets.
- Return type:
- class alpbench.util.pytorch_tabnet.metrics.UnsupervisedNumpyMetric[source]¶
Bases:
MetricUnsupervised metric
- __call__(y_pred, embedded_x, obf_vars)[source]¶
Compute MSE (Mean Squared Error) of predictions.
- Parameters:
y_pred (torch.Tensor or np.array) – Reconstructed prediction (with embeddings)
embedded_x (torch.Tensor) – Original input embedded by network
obf_vars (torch.Tensor) – Binary mask for obfuscated variables. 1 means the variables was obfuscated so reconstruction is based on this.
- Returns:
MSE of predictions vs targets.
- Return type:
- alpbench.util.pytorch_tabnet.metrics.UnsupervisedLoss(y_pred, embedded_x, obf_vars, eps=1e-09)[source]¶
Implements unsupervised loss function. This differs from orginal paper as it’s scaled to be batch size independent and number of features reconstructed independent (by taking the mean)
- Parameters:
y_pred (torch.Tensor or np.array) – Reconstructed prediction (with embeddings)
embedded_x (torch.Tensor) – Original input embedded by network
obf_vars (torch.Tensor) – Binary mask for obfuscated variables. 1 means the variable was obfuscated so reconstruction is based on this.
eps (float) – A small floating point to avoid ZeroDivisionError This can happen in degenerated case when a feature has only one value
- Returns:
loss – Unsupervised loss, average value over batch samples.
- Return type:
torch float