Use the ConnectApi.SmartDataDiscovery.predict method to get predictions on Salesforce objects. For more information, see Get Predictions in Apex.