def setUpClass(cls):
        cls.dataset = load_loan_defaulters()
        cls.design_matrix = [row[:-1] for row in cls.dataset]
        cls.target_values = [row[-1] for row in cls.dataset]

        cls.clf = NaiveBayes(cls.extract_features)
        cls.clf.fit(cls.design_matrix, cls.target_values)
Esempio n. 2
0
def main():
    dataset = load_loan_defaulters()
    design_matrix = [row[:-1] for row in dataset]
    target_values = [row[-1] for row in dataset]
    clf = NaiveBayes(extract_features)
    clf.fit(design_matrix, target_values)
    prediction = clf.predict_record([1, 1, 50700])
    negation_word = " not " if prediction == 0.0 else ""
    print("testing negative sentiment" + negation_word + "of the tweet")
Esempio n. 3
0
def main():
    dataset = load_loan_defaulters()
    design_matrix = [row[:-1] for row in dataset]
    target_values = [row[-1] for row in dataset]
    clf = NaiveBayes(extract_features)
    clf.fit(design_matrix, target_values)
    prediction = clf.predict_record([1, 1, 50700])
    negation_word = " not " if prediction == 0.0 else ""
    print("We predict this person will" + negation_word +
          "default on their loans.")
Esempio n. 4
0
def main():
    dataset = load_loan_defaulters()
    # dataset = load_load_dataset("creditcard.csv")
    design_matrix = [row[:-1] for row in dataset]
    target_values = [row[-1] for row in dataset]
    clf = NaiveBayes(extract_features)
    clf.fit(design_matrix, target_values)
    scores = cross_val_score(clf, df, y, cv=10)
    prediction = clf.predict_record([
        0, -1.3598071336738, -0.0727811733098497, 2.53634673796914,
        1.37815522427443, -0.338320769942518, 0.462387777762292,
        0.239598554061257, 0.0986979012610507, 0.363786969611213,
        0.0907941719789316, -0.551599533260813, -0.617800855762348,
        -0.991389847235408, -0.311169353699879, 1.46817697209427,
        -0.470400525259478, 0.207971241929242, 0.0257905801985591,
        0.403992960255733, 0.251412098239705, -0.018306777944153,
        0.277837575558899, -0.110473910188767, 0.0669280749146731,
        0.128539358273528, -0.189114843888824, 0.133558376740387,
        -0.0210530534538215, 15998980980.64, 0
    ])
    print("Credit Card Category: ", prediction)