You would need to fit the StandardScaler before using transform or inverse_transform, which is missing in the posted code snippet. Either reuse the original scaler object or store the sc.mean_ and sc.scale_ and undo the normalization manually.