Exemplo n.º 1
0
def runFineTunedKNeighbors():
    bestRegressor = KNeighborsRegressor(
        n_neighbors=65,
        leaf_size=46,
        weights='uniform',
        algorithm='kd_tree',
    )

    machineLearning.runRegressor(bestRegressor, "kNeighborsTwitter",
                                 jsonFileNames)
Exemplo n.º 2
0
def runFineTunedBagging():
    bestRegressor = BaggingRegressor(
        n_estimators=100,
        max_samples=100,
        max_features=5,
        bootstrap=True,
        bootstrap_features=True,
        warm_start=True
    )

    machineLearning.runRegressor(bestRegressor, "bagging", jsonFileNames)
Exemplo n.º 3
0
def runFineTunedBaggingRegressor():
    bestRegressor = BaggingRegressor(n_estimators=100,
                                     max_samples=100,
                                     max_features=5,
                                     bootstrap=True,
                                     bootstrap_features=True,
                                     warm_start=True)

    machineLearning.runRegressor(bestRegressor,
                                 "BaggingRegressorReddit",
                                 jsonFileNames,
                                 dataSource='reddit')
Exemplo n.º 4
0
def runFineTunedKNeighbors():
    bestRegressor = KNeighborsRegressor(
        n_neighbors=85,
        leaf_size=46,
        weights="uniform",
        algorithm="ball_tree",
    )

    machineLearning.runRegressor(bestRegressor,
                                 "kNeighborsReddit",
                                 jsonFileNames,
                                 dataSource='reddit')
Exemplo n.º 5
0
def runFineTunedRandomForest():
    bestRegressor = RandomForestRegressor(
        n_estimators=490,
        max_depth=3,
        min_samples_split=202,
        min_samples_leaf=77,
        max_leaf_nodes=5,
        min_weight_fraction_leaf=.1,
        max_features="sqrt",
        random_state=43,
    )

    machineLearning.runRegressor(bestRegressor, "randomForest", jsonFileNames, dataSource='reddit')
Exemplo n.º 6
0
def runFineTunedSGD():
    bestRegressor = SGDRegressor(
        loss = 'huber',
        penalty = 'l2',
        alpha = 20.00001,
        l1_ratio = 0.0,
        fit_intercept = True,
        shuffle = False,
        epsilon = 1.0000000000000001e-05,
        learning_rate = 'invscaling'
    )

    machineLearning.runRegressor(bestRegressor, "SGD", jsonFileNames)
Exemplo n.º 7
0
def runFineTunedSGD():
    bestRegressor = SGDRegressor(loss='huber',
                                 penalty='l1',
                                 alpha=90.000010000000003,
                                 l1_ratio=0.0,
                                 fit_intercept=True,
                                 shuffle=True,
                                 epsilon=10.00001,
                                 learning_rate='invscaling')

    machineLearning.runRegressor(bestRegressor,
                                 "SGD",
                                 jsonFileNames,
                                 dataSource='reddit')
Exemplo n.º 8
0
def runFineTunedRandomForest():
    bestRegressor = RandomForestRegressor(
        n_estimators=250,
        max_depth=3,
        min_samples_split=202,
        min_samples_leaf=33,
        max_leaf_nodes=7,
        min_weight_fraction_leaf=.1,
        max_features="sqrt",
        random_state=43,
    )

    machineLearning.runRegressor(bestRegressor, "randomForestPercentAverage",
                                 jsonFileNames)
Exemplo n.º 9
0
# ______________________________________________________
#

# Fill this grid with only the best parameter values, as every single combination will be run
parameterGrid = {
    "C": [1000, 0.01, 10],
    "fit_intercept": [False],
    "solver": ['lbfgs', 'liblinear'],
    "verbose": [56, 68, 84, 24],
    "warm_start": [False],
    "random_state": [92, 12, 20, 56]
}

machineLearning.tuneParameters(parameterGrid, classifierName, classifier,
                               jsonFileNames, decentNValue)

# ______________________________________________________
# RUN THE MODEL WITH BEST PARAMETERS
# ______________________________________________________
#

bestClassifier = LogisticRegression(C=0.01,
                                    fit_intercept=False,
                                    solver='lbfgs',
                                    verbose=84,
                                    warm_start=False,
                                    random_state=92)

machineLearning.runRegressor(bestClassifier, "LogisticRegression",
                             jsonFileNames)
Exemplo n.º 10
0
    # "max_depth": [2, 3],
    # "min_samples_split": [74, 130],
    # "min_samples_leaf": [35, 59],
    # "max_leaf_nodes": [2, 8],
    # "min_weight_fraction_leaf": [0.2, 0.4],
    # "max_features": ["auto", "log2"]
    'priors': [None]
}

machineLearning.tuneParameters(parameterGrid, classifierName, classifier, jsonFileNames, decentNValue)

# ______________________________________________________
# RUN THE MODEL WITH BEST PARAMETERS
# ______________________________________________________
#

bestClassifier = GaussianNB(
    # n_estimators=15,
    # max_depth=2,
    # min_samples_split=120,
    # min_samples_leaf=15,
    # max_leaf_nodes=80,
    # min_weight_fraction_leaf=.2,
    # random_state=0,
    # max_features="auto",
    priors=None
)

machineLearning.runRegressor(bestClassifier, "GaussNB", jsonFileNames)

Exemplo n.º 11
0
#     'bootstrap_features': [True],
#     'oob_score': [False],
#     'warm_start': [True],
#     'n_jobs': [-1],
#     'random_state': [0],
#     'verbose': [1]
# }
# #
# machineLearning.tuneParameters(parameterGrid, classifierName, classifier, jsonFileNames, decentNValue)
#
# # ______________________________________________________
# # RUN THE MODEL WITH BEST PARAMETERS
# # ______________________________________________________
# #
#
bestClassifier = BaggingClassifier(base_estimator=None,
                                   n_estimators=50,
                                   max_samples=1000,
                                   max_features=5,
                                   bootstrap=True,
                                   bootstrap_features=True,
                                   oob_score=False,
                                   warm_start=True,
                                   n_jobs=-1,
                                   random_state=0,
                                   verbose=1)
#
machineLearning.runRegressor(bestClassifier, "BaggingClassifier",
                             jsonFileNames)
#