week4/shopping/shopping.py
def evaluate(labels, predictions):
    """
    Given a list of actual labels and a list of predicted labels,
    return a tuple (sensitivity, specificty).

    Assume each label is either a 1 (positive) or 0 (negative).

    `sensitivity` should be a floating-point value from 0 to 1
    representing the "true positive rate": the proportion of
    actual positive labels that were accurately identified.

    `specificity` should be a floating-point value from 0 to 1
    representing the "true negative rate": the proportion of
    actual negative labels that were accurately identified.
    """
    tn, fp, fn, tp = confusion_matrix(labels, predictions).ravel()
    sensitivity = tp / (tp + fn)
    specificity = tn / (tn + fp)

    return sensitivity, specificity

    Given a list of actual labels and a list of predicted labels,
    return a tuple (sensitivity, specificty).

    Assume each label is either a 1 (positive) or 0 (negative).

    `sensitivity` should be a floating-point value from 0 to 1
    representing the "true positive rate": the proportion of
    actual positive labels that were accurately identified.

    `specificity` should be a floating-point value from 0 to 1
    representing the "true negative rate": the proportion of
    actual negative labels that were accurately identified.
    
Given a list of actual labels and a list of predicted labels,
return a tuple (sensitivity, specificty).

Assume each label is either a 1 (positive) or 0 (negative).

`sensitivity` should be a floating-point value from 0 to 1
representing the "true positive rate": the proportion of
actual positive labels that were accurately identified.

`specificity` should be a floating-point value from 0 to 1
representing the "true negative rate": the proportion of
actual negative labels that were accurately identified.
Given a list of actual labels and a list of predicted labels return a tuple ( sensitivity specificty ) . Assume each label is either a 1 ( positive ) or 0 ( negative ) . ` sensitivity ` should be a floating - point value from 0 to 1 representing the " true positive rate " : the proportion of actual positive labels that were accurately identified . ` specificity ` should be a floating - point value from 0 to 1 representing the " true negative rate " : the proportion of actual negative labels that were accurately identified .
def evaluate(labels, predictions):
    tn, fp, fn, tp = confusion_matrix(labels, predictions).ravel()
    sensitivity = tp / (tp + fn)
    specificity = tn / (tn + fp)
    return sensitivity, specificity
def evaluate ( labels , predictions ) : tn , fp , fn , tp = confusion_matrix ( labels , predictions ) . ravel ( ) sensitivity = tp / ( tp + fn ) specificity = tn / ( tn + fp ) return sensitivity , specificity
Given a list of actual labels and a list of predicted labels,
return a tuple (sensitivity, specificty).
Given a list of actual labels and a list of predicted labels return a tuple ( sensitivity specificty ) .
"""
    Given a list of actual labels and a list of predicted labels,
    return a tuple (sensitivity, specificty).

    Assume each label is either a 1 (positive) or 0 (negative).

    `sensitivity` should be a floating-point value from 0 to 1
    representing the "true positive rate": the proportion of
    actual positive labels that were accurately identified.

    `specificity` should be a floating-point value from 0 to 1
    representing the "true negative rate": the proportion of
    actual negative labels that were accurately identified.
    """
labels
predictions