def example(): """example of how you can use the functions in this file""" trialxmlpath = "../workspace/cluebotng/editsets/D/trial.xml" trainingset = trial_file_reader.parse_trial_file(trialxmlpath) exampleset = trainingset[0:10] examplefeature = user_talk_revision_count #user feature defined above x = join_edits_with_feature_on_user(examplefeature, exampleset) dump_to_csv(x, "examplefeature.csv")
def editid_to_featurevalues(feature_function, trialxmlpath = "../workspace/cluebotng/editsets/D/trial.xml"): """use this to get a new feature for the dataset stored into a file""" print 'reading training set from ' + trialxmlpath exampleset = trial_file_reader.parse_trial_file(trialxmlpath) print 'done reading training set' x = join_editid_with_feature(feature_function, exampleset) filename = feature_function.__name__ + '.dat' dump_to_csv(x, filename)
def feature_to_text(feature_function, number_of_examples=10, trialxmlpath = "../workspace/cluebotng/editsets/D/trial.xml"): """use this to get a new feature for the dataset stored into a file""" print 'reading training set from ' + trialxmlpath trainingset = trial_file_reader.parse_trial_file(trialxmlpath) print 'done reading training set' if number_of_examples <= 0: exampleset = trainingset[:] else: exampleset = trainingset[0:number_of_examples] x = join_edits_with_feature_on_user(feature_function, exampleset) filename = feature_function.__name__ + '.csv' dump_to_csv(x, filename)