def vary_sf_ratio_against_random():
    if (not os.path.isfile('../measuredivergence/modeldata.tsv')):
        with open('../measuredivergence/modeldata.tsv', mode='w', encoding='utf-8') as f:
            outline = 'name\tsize\tratio\taccuracy\tfeatures\tregularization\n'
            f.write(outline)
    size = 80
    for iteration in [5, 6, 7]:
        ceiling = 105
        if (iteration == 7):
            ceiling = 5
        for pct in range(0, ceiling, 5):
            ratio = (pct / 100)
            name = ((((('iter' + str(iteration)) + '_size') + str(size)) + '_ratio') + str(pct))
            vocabpath = (('../measuredivergence/vocabularies/' + name) + '.txt')
            tags4positive = {'sf_loc', 'sf_oclc'}
            tags4negative = {'random'}
            (metadata, masterdata, classvector, classdictionary, orderedIDs, authormatches, vocablist) = get_ratio_data(vocabpath, size, ratio, tags4positive, tags4negative, excludebelow=0, excludeabove=3000)
            c_range = [5e-05, 0.0003, 0.001, 0.004, 0.012, 0.2, 0.8]
            featurestart = 1000
            featureend = 6000
            featurestep = 300
            modelparams = ('logistic', 16, featurestart, featureend, featurestep, c_range)
            (matrix, maxaccuracy, metadata, coefficientuples, features4max, best_regularization_coef) = versatiletrainer2.tune_a_model(metadata, masterdata, classvector, classdictionary, orderedIDs, authormatches, vocablist, tags4positive, tags4negative, modelparams, name, (('../measuredivergence/modeloutput/' + name) + '.csv'), write_fullmodel=False)
            with open('../measuredivergence/modeldata.tsv', mode='a', encoding='utf-8') as f:
                outline = (((((((((((name + '\t') + str(size)) + '\t') + str(ratio)) + '\t') + str(maxaccuracy)) + '\t') + str(features4max)) + '\t') + str(best_regularization_coef)) + '\n')
                f.write(outline)
def vary_sf_ratio_against_random():
    if (not os.path.isfile('../measuredivergence/modeldata.tsv')):
        with open('../measuredivergence/modeldata.tsv', mode='w', encoding='utf-8') as f:
            outline = 'name\tsize\tratio\taccuracy\tfeatures\tregularization\n'
            f.write(outline)
    size = 80
    for iteration in [5, 6, 7]:
        ceiling = 105
        if (iteration == 7):
            ceiling = 5
        for pct in range(0, ceiling, 5):
            ratio = (pct / 100)
            name = ((((('iter' + str(iteration)) + '_size') + str(size)) + '_ratio') + str(pct))
            vocabpath = (('../measuredivergence/vocabularies/' + name) + '.txt')
            tags4positive = {'sf_loc', 'sf_oclc'}
            tags4negative = {'random'}
            (metadata, masterdata, classvector, classdictionary, orderedIDs, authormatches, vocablist) = get_ratio_data(vocabpath, size, ratio, tags4positive, tags4negative, excludebelow=0, excludeabove=3000)
            c_range = [5e-05, 0.0003, 0.001, 0.004, 0.012, 0.2, 0.8]
            featurestart = 1000
            featureend = 6000
            featurestep = 300
            modelparams = ('logistic', 16, featurestart, featureend, featurestep, c_range)
            (matrix, maxaccuracy, metadata, coefficientuples, features4max, best_regularization_coef) = versatiletrainer2.tune_a_model(metadata, masterdata, classvector, classdictionary, orderedIDs, authormatches, vocablist, tags4positive, tags4negative, modelparams, name, (('../measuredivergence/modeloutput/' + name) + '.csv'), write_fullmodel=False)
            with open('../measuredivergence/modeldata.tsv', mode='a', encoding='utf-8') as f:
                outline = (((((((((((name + '\t') + str(size)) + '\t') + str(ratio)) + '\t') + str(maxaccuracy)) + '\t') + str(features4max)) + '\t') + str(best_regularization_coef)) + '\n')
                f.write(outline)