This is my MWE for an algorithm however its throwing an error and I don't know how to get inputs and initialize. I want it to look like the attached image.
\documentclass[a4paper,10pt,twocolumn]{article}
\usepackage[utf8]{inputenc}
\usepackage{booktabs,lipsum}
\usepackage{algorithm}
\usepackage{algpseudocode}
\begin{document}
\begin{algorithm}
\caption{Algorithm 2: Boosted $K$ Nearest Neighbor}
\begin{algorithmic}[1]
% \qinput{Input:} \\
% \State $S={s_i}={\left(x_i,y_i\right)$
\For{t = 1 to T} \do
\State $S_t \gets S_{t-1}$
\For{$s_q \in S_t$} \do
\State $N_q \gets$ k nearest neighbors
\State of $s_q$ using $D(s_q,s_i)$
\State label($s_q$)$=argmax\sum_{s_i \in N_q}D(s_q,s_i)$;
\If{label($s_q$)$\ne y_q$}
\For{$s_i \in N_i$} \do
\If{$y_i \ne y_q$}
\State $w_{i}^{t} \gets w_{i}^{t} - \lambda/d(x_q,x_i)$;
\Else
\State $w_{i}^{t} \gets w_{i}^{t} + \lambda/d(x_q,x_i)$;
\EndIf
\EndFor
\EndIf
\EndFor
\If{label($s_q$)$=y_q \forall_{s_q}$}
\State break
\EndIf
\EndFor
\end{algorithmic}
\end{algorithm}
\end{document}


