Following this instruction : 1. Strictly adhere to PEP-8 standards, ensuring code is…
- User
Following this instruction :
- Strictly adhere to PEP-8 standards, ensuring code is clean, well-structured, and follows Python's style guide for readability.
- Use appropriate modules like
typingfor type hints, ensuring code clarity, maintainability, and leveraging Python's standard libraries effectively. - Focus on time, space, robustness, scalability; write optimized, efficient code that can handle large datasets and scale seamlessly.
- Implement comprehensive error handling, catching exceptions gracefully, providing meaningful error messages, and ensuring code robustness under unexpected conditions.
- Ensure the developer agent writes advanced, maintainable Python code, balancing performance and readability while adhering to best practices.
NOTE: end to end develop using torch TASK :Image classification task , prediction or logits or labels
example :(keep this in the mind ) for batch in dataloader: images, targets = batch
one example type 1 outputs = model(**batch) loss = outputs.loss
second example type 2
data, target = data.to(device), target.to(device) output = model(data)
Using only
torch modulefor develop Generalised and robustness , scalable, Reusable NOTE: use only torch moduleAccuracy: Overall percentage of correct predictions. Top-k Accuracy: Accuracy considering the top-k predictions (e.g., Top-5 accuracy). Precision: Ratio of true positive predictions to all positive predictions. Recall (Sensitivity): Ratio of true positives to actual positives in the data. F1 Score: Harmonic mean of precision and recall. Area Under the ROC Curve (AUC-ROC): Measures model performance across various thresholds. Area Under the Precision-Recall Curve (AUC-PR): Measures model performance on imbalanced datasets. Log Loss (Cross-Entropy Loss): Evaluates the confidence of predictions with the true labels. Mean Absolute Error (MAE): Average absolute difference between predicted probabilities and actual labels. Mean Squared Error (MSE): Average squared difference between predicted and actual labels. Confusion Matrix: Matrix displaying true positives, true negatives, false positives, and false negatives. Balanced Accuracy: Average of recall obtained in each class, useful for imbalanced datasets. Matthews Correlation Coefficient (MCC): Measures correlation between predicted and actual labels; robust for imbalanced datasets. Kappa Statistic (Cohen’s Kappa): Measures agreement between predictions and actual labels, correcting for chance. Brier Score: Measures the accuracy of probabilistic predictions, sensitive to calibration. Expected Calibration Error (ECE): Measures the difference between predicted probabilities and actual accuracy. Classification Calibration Error (CCE): A recent measure (post-2023) evaluating how well the probability outputs are calibrated for each class. Uncertainty Calibration Error (UCE): Post-2023 measure for uncertainty calibration in models, especially in high-dimensional classes. Jaccard Index (Intersection over Union): Measures similarity between prediction and ground truth. True Skill Statistic (TSS): Useful for evaluating models on unbalanced data, balancing sensitivity and specificity. Hinge Loss: A metric used primarily with SVMs, but applied here for multiclass classifications. Average Precision (AP): Precision averaged across recall levels, especially useful in object-centric classification tasks. False Positive Rate (FPR): Rate of incorrect positive predictions among all negative samples. False Negative Rate (FNR): Rate of missed positive predictions among all actual positive samples. Negative Log Likelihood (NLL): Evaluates model’s confidence in the correct class, with lower values indicating better performance. Focal Loss: A metric that down-weights easy examples and focuses more on hard-to-classify examples, widely used for imbalanced datasets. Out-of-Distribution (OoD) Detection Accuracy: Evaluates the model’s ability to identify samples outside the training data classes (post-2023). Entropy: Measures the uncertainty of model predictions, with higher entropy indicating less confident predictions. Lift (Gains): Assesses model improvement over random guessing, especially in classifying rare classes. False Discovery Rate (FDR): Fraction of false positives among all positive predictions, useful for imbalanced classes.
- Assistant
- User
- Assistant