Fix for ValueError: continuous format is not supported
See original GitHub issuein the indad/model.py line 78
the mask must be convert to int type, otherwise, it will get ValueError: continuous format is not supported
Here is the solution: I changed the mask type from float to int
pixel_labels.extend(mask.flatten().numpy().astype(int))
The initial function is like below
def evaluate(self, test_ds: VisionDataset) -> Tuple[float, float]:
"""Calls predict step for each test sample."""
image_preds = []
image_labels = []
pixel_preds = []
pixel_labels = []
for sample, mask, label in tqdm(test_ds, **TQDM_PARAMS):
z_score, fmap = self.predict(sample.unsqueeze(0))
image_preds.append(z_score.numpy())
image_labels.append(label)
pixel_preds.extend(fmap.flatten().numpy())
pixel_labels.extend(mask.flatten().numpy())
image_preds = np.stack(image_preds)
image_rocauc = roc_auc_score(image_labels, image_preds)
pixel_rocauc = roc_auc_score(pixel_labels, pixel_preds)
return image_rocauc, pixel_rocauc
Issue Analytics
- State:
- Created 2 years ago
- Comments:9 (6 by maintainers)
Top Results From Across the Web
ValueError: continuous format is not supported - Stack Overflow
I have written a simple function where I am using the average_precision_score from scikit-learn to compute average precision. My Code: def ...
Read more >ValueError: continuous format is not supported in ... - GitHub
If you run the following code: import numpy as np from sklearn.linear_model.ridge import RidgeClassifierCV classifier ...
Read more >ValueError: continuous is not supported
I am working on a regression problem and building a model using Random Forest Regressor but while trying to get the accuracy I...
Read more >Array NaN values? ValueError: continuous format is not ...
Hi, I do have this ValueError: continuous format is not supported problem again. fpr and tpr have a few hundred rows so I...
Read more >Valueerror: Continuous Format Is Not Supported For Knn
Got continuous is not supported error in RandomForestRegressor.I'm just trying to do a simple RandomForestRegressor example.But while testing the accuracy.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
FYI, the reduced datasets are not supposed to be run with the evaluate function. You better choose just “hazelnut” or “transistor” (the data is automatically downloaded)
The evaluation function comes in handy as it can give you a threshold for a certain desired recall. If you want to visualize your predictions, it’s easier to call
Or something like that. You can then use the threshold that you got from your aurocs to threshold the faulty pixels. Right now, you’ll have to extract the best threshold yourself.