CompTIA DataX DY0-001 (V1) Practice Question

Your data-science team uses Sphinx with the napoleon extension to build API documentation directly from Numpy/Google-style docstrings. A teammate submits the following code:

def compute_auc(y_true, y_prob):
    """compute_auc(y_true, y_prob) -> float
    Uses scikit-learn's roc_auc_score to compute AUC"""

The docstring violates established conventions and will not render correctly in the generated docs. Which revised docstring best follows PEP 257 and common Numpy/Google guidelines so that automated tools can capture the function's contract unambiguously?

  • """COMPUTE_AUC(Y_TRUE, Y_PROB)
    
    Returns
    -------
    float
        Area under curve.
    """
    
  • """Returns AUC. Implementation details:
    
    - Calls roc_auc_score inside a Cython loop
    - TODO: Optimize with SIMD
    """
    
  • """compute_auc(y_true, y_prob) -> float Uses roc_auc_score"""
    
  • """Compute the area under the ROC curve (AUC).
    
    Parameters
    ----------
    y_true : array-like of shape (n_samples,)
        Ground-truth binary labels (0 or 1).
    y_prob : array-like of shape (n_samples,)
        Predicted probabilities for the positive class.
    
    Returns
    -------
    float
        AUC score in the range .
    
    Raises
    ------
    ValueError
        If y_true and y_prob have different lengths.
    """
    
CompTIA DataX DY0-001 (V1)
Operations and Processes
Your Score:
Settings & Objectives
Random Mixed
Questions are selected randomly from all chosen topics, with a preference for those you haven’t seen before. You may see several questions from the same objective or domain in a row.
Rotate by Objective
Questions cycle through each objective or domain in turn, helping you avoid long streaks of questions from the same area. You may see some repeat questions, but the distribution will be more balanced across topics.

Check or uncheck an objective to set which questions you will receive.

SAVE $64
$529.00 $465.00
Bash, the Crucial Exams Chat Bot
AI Bot