We describe a new stochastic search algorithm for linear regression models called the bounded mode stochastic search (BMSS).We make use of BMSS to perform variable selection and classification as well as to construct sparse dependency networks.Furthermore, we show how to determine genetic networks from genomewide data that involve any combination of continuous and discrete variables.We illustrate our methodology with several real-world data sets.