def compute_prs(ads_file): '''INTERFACE: Compute precision and recall for various combinations of model, alpha, beta, threshold for the set of ads dumped into a file. Args: ads_file: File containing dumped ads. Usually after merging across accounts. ''' adwiser = {"ads": adLib.load_ads(ads_file)} adwiser["prediction"] = adAnalyzer.analyze_ads(adwiser["ads"]) # Uncomment below line to try all possible thresholds. # adwiser["scores"] = adAnalyzer.get_scores(adwiser["prediction"]) adwiser["truth"] = adAnalyzer.true_ds_of_ad_list(adwiser["ads"]) adwiser["verification"] = adAnalyzer.verify_predictions(adwiser) adAnalyzer.aggregate_verifications(adwiser, True)
def show_verifications(ads_file): '''INTERFACE: Print the verifications of predictions made for the set of ads dumped into a file. Args: ads_file: File containing dumped ads. Usually after merging across accounts. ''' adwiser = {"ads": adLib.load_ads(ads_file)} adwiser["prediction"] = adAnalyzer.analyze_ads(adwiser["ads"]) adwiser["truth"] = adAnalyzer.true_ds_of_ad_list(adwiser["ads"]) adwiser["verification"] = adAnalyzer.verify_predictions(adwiser) for i in range(0, len(adwiser["ads"])): print adwiser["ads"][i].get_ad_str(), adwiser["prediction"][i] print adwiser["verification"][i] print