Pattern recognition with an adaptive network