To provide robots with the flexibility they need to cope with various environments, motion generation techniques using deep learning have been proposed. Generalization in deep learning is expected to enable flexible processing in unknown situations and flexible motion generation. Motion generation models have been proposed to realize specific robot tasks, and their operation successes in unknown situations have been reported. However, their generalization performances have not been analyzed or verified in detail. In this paper, we analyze the internal state of a deep neural network using principal component analysis and verify the generalization of motion against environmental change, specifically a repositioned door knob. The results revealed that the motion primitives were structured in accordance with the position of the door knob. In addition, motion with high generalization performance was obtained by adaptive transition of motion primitives in accordance with changes in the door knob position. The robot was able to successfully perform a door-open-close task at various door knob positions.