Diagnosis of ultrafast ultraintense laser pulse characteristics by machine-learning-assisted electron spin