🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Logistic Regression from Scratch: all 10 questions

Quiz: Logistic Regression from Scratch · Question 7 of 10

What does this print? (code)

What does this print?

import numpy as np
p = np.array([0.2, 0.55, 0.8, 0.45])
print((p >= 0.5).astype(int).sum())
  1. A.1
  2. B.2
  3. C.3
  4. D.4
Answer & explanation

Correct answer: 2

Only 0.55 and 0.8 reach the threshold 0.5.

Can you get the rest right without peeking?

Take the timed Quiz: Logistic Regression from Scratch quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →