How is machine learning used for prediction?

Machine learning is used for prediction by training models on historical data with known inputs and outputs, so the model learns the patterns and relations between them, then applies this understanding to new data to predict future results. For example, it can be used to predict stock prices by analysing past financial data, to forecast the weather by studying meteorological data, and to predict customer behaviour, such as the likelihood of buying a product. Machine learning thus works as a powerful tool for turning past and present data into future insights that support decision making.