Skip to content

lesson04 script notebook comments #29

@elcorto

Description

@elcorto

These are small and don't need to be addressed immediately. Just want to keep them somewhere.

  • [4] I'd use == 0 rather than < 1, so df.species_.cat.codes == 0, only here maybe use >:

    df["not_adelie"] = (df.species_.cat.codes >= 1).astype(np.int8)

    but even then using != 0 is probably more general.

  • [16] the output of KNeighborsClassifier.predict_proba() has shape
    (n_queries, n_classes), and n_classes=2 (is_adelie 0 or 1), so I'd use
    index "1" instead of "-1" to stress that there are two classes only and that
    column 1 corresponds to class 1 (=true). Also used here
    https://scikit-learn.org/stable/modules/model_evaluation.html#binary-case

    pos_pred_probs = knn.predict_proba(X_test)[:,1]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions