A portable gait analysis and activity-monitoring system for the evaluation of activities of daily life could facilitate clinical and research studies. This current study developed a small sensor unit comprising an accelerometer and a gyroscope in order to detect shank and foot segment motion and orientation during different walking conditions. The kinematic data obtained in the pre-swing phase were used to classify five walking conditions: stair ascent, stair descent, level ground, upslope and downslope. The kinematic data consisted of anterior–posterior acceleration and angular velocity measured from the shank and foot segments. A machine learning technique known as support vector machine (SVM) was applied to classify the walking conditions. SVM was also compared with other machine learning methods such as artificial neural network (ANN), radial basis function network (RBF) and Bayesian belief network (BBN). The SVM technique was shown to have a higher performance in classification than the other three methods. The results using SVM showed that stair ascent and stair descent could be distinguished from each other and from the other walking conditions with 100% accuracy by using a single sensor unit attached to the shank segment. For classification results in the five walking conditions, performance improved from 78% using the kinematic signals from the shank sensor unit to 84% by adding signals from the foot sensor unit. The SVM technique with the portable kinematic sensor unit could automatically recognize the walking condition for quantitative analysis of the activity pattern.