This open access book explores how machine learning can enhance both quantitative and qualitative research in sociology. By developing algorithms tailored to specific data, machine learning enables social scientists to uncover patterns, generate new theories, calibrate indicators, and strengthen causal inference. The book offers an accessible introduction to the principles and applications of supervised and unsupervised learning (Part I), followed by empirical case studies across key areas of sociological research. In the social prediction section (Parts II-IV), it illustrates how supervised learning can 1) impute missing indicators, 2) derive theories directly from data, and 3) improve causal inference through counterfactual construction. In the culture modeling section (Parts V-VI), it shows how unsupervised machine learning can map the structure of large-scale cultural texts--such as online novels and film databases--making complex cultural patterns visible across time and space.