Exemplo n.º 1
0
from app.dame_utils import DameUtils

import argparse

parser = argparse.ArgumentParser()
parser.add_argument('ml',
                    choices=[
                        'nltk', 'svc', 'sgd', 'gaussianNB', 'multinomialNB',
                        'bernoulliNB', 'forest', 'tree', 'mlp'
                    ])
parser.add_argument('--noshow', dest='noshow', action='store_true')
parser.add_argument('--verbose', default=False, action="store_true")
args = parser.parse_args()

ds = DameSexmachine()
X = np.array(ds.features_list(path="files/names/allnoundefined.csv"))
y = ds.gender_list(path="files/names/allnoundefined.csv")
X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=42)

if (args.verbose):
    print(X)
    print(y)

if (args.ml == "svc"):
    svc = SVC(random_state=42)
    svc.fit(X_train, y_train)
    svc_disp = plot_roc_curve(svc, X_test, y_test)

elif (args.ml == "forest"):
    rfc = RandomForestClassifier(n_estimators=10, random_state=42)
    rfc.fit(X_train, y_train)
 def test_sexmachine_features_list_all(self):
     s = DameSexmachine()
     fl = s.features_list(path="files/names/all.csv")
     self.assertTrue(len(fl) > 1000)
Exemplo n.º 3
0
 def test_sexmachine_features_list_all_method_returns_correct_result(self):
     s = DameSexmachine()
     fl = s.features_list(path="files/names/all.csv")
     self.assertTrue(len(fl) > 1000)
 def test_sexmachine_features_list(self):
     s = DameSexmachine()
     fl = s.features_list()
     self.assertTrue(len(fl) > 20)
Exemplo n.º 5
0
 def test_sexmachine_features_list_method_returns_correct_result(self):
     s = DameSexmachine()
     fl = s.features_list()
     self.assertTrue(len(fl) > 20)