Thanks!
edit: typo
Kamikaze attacks did not begin until October 1944, well after Japan had lost any ability to effectively combat the American navy and air forces on an even playing field. Having fallen far behind in production capability Japanese leadership realized they had no hopes of winning the war. They were basically a last ditch effort to stop the American advance and be able to broker a peace in favorable terms to Japan. It also allowed for the use of far less experienced pilots with Japan having run low on experienced combat pilots. So they came as a surprise as they hadn't been used in the first years of the war, although things like bonsai charges that were more or less suicide charges were common so it wasn't an unprecedented tactic, it just used a new tool.
I know I've posted this before, but this article is a good overview of the defensive actions against the kamikazes. The achieved hit ratios of the suicide attackers is good to note when looking at the Japanese preparations for the invasion of the home islands.