Ejemplo n.º 1
0
        model = MLPClassifier(alpha=c, max_iter=100000)
        b = pd.DataFrame()
        b["binSpread"] = y_cvTest
        model.fit(X=x_cvTrain, y=y_cvTrain)
        for p in model.predict_proba(x_cvTest):
            if (model.classes_[1] == 1):
                predictions.append(p[1])
            else:
                predictions.append(p[0])
        b["PFITS"] = predictions
        predictions = []
        allSums.append(
            testClassification(b,
                               300,
                               'Kelly',
                               Year=False,
                               Week=False,
                               odds=-105,
                               betType="Spread",
                               printOption=False))
        allScores.append(model.score(x_cvTest, y_cvTest))
        counter += 1
    print(c, np.average(allScores), np.average(allSums))
    if (np.average(allScores) > best):
        bestC = c
        best = np.average(allScores)
    allScores = []
    allSums = []
    counter = 0
print("The best C was", bestC)
model = MLPClassifier(max_iter=100000, alpha=bestC)
b = pd.DataFrame()
import pandas as pd
import numpy as np
from cfbFcns import standardizeTeamName
from evalPredictions import testClassification

#Spread Part
a = pd.read_csv(
    './csv_Data/LogisticPythonPredictionsLRWeek5+Leave-One-OutNoStepwiseScaled.csv',
    encoding="ISO-8859-1")
testClassification(a,
                   300,
                   'Kelly',
                   Year=True,
                   Week=True,
                   odds=-105,
                   betType="Spread")

a = pd.read_csv(
    './csv_Data/LogisticPythonPredictionsLRWeek5+Leave-One-OutNoStepwiseScaledC0.25.csv',
    encoding="ISO-8859-1")
testClassification(a,
                   300,
                   'Kelly',
                   Year=True,
                   Week=True,
                   odds=-105,
                   betType="Spread")

a = pd.read_csv(
    './csv_Data/LogisticPythonPredictionsLRWeek5+Leave-One-OutNoStepwiseScaledC0.1.csv',
    encoding="ISO-8859-1")
Ejemplo n.º 3
0
model = LogisticRegression(max_iter=100000)
X_train, X_test, y_train, y_test = train_test_split(temp,
                                                    Y,
                                                    test_size=0.33,
                                                    random_state=42)
model.fit(X=X_train, y=y_train)
for p in model.predict_proba(X_test):
    if (model.classes_[1] == 1):
        predictions.append(p[1])
    else:
        predictions.append(p[0])
b = pd.DataFrame()
b["binTotal"] = y_test
b["PFITS"] = predictions
predictions = []
netWin = testClassification(b, 300, 'Standard', betType="O/U")
best = netWin
bestCols = []
removedCols = []
noImprovement = True
colCount = 0
removedCount = 0
bestImproved = 0
for col in temp.columns:
    bestCols.append(col)
    colCount += 1
random.shuffle(bestCols)
X = temp.copy()
print("Starting Removal of Features")
while (bestImproved < colCount):
    print(bestImproved, colCount)
Ejemplo n.º 4
0
# for p in model.predict_proba(x1.reshape(-1,1)):
#     if (model.classes_[1] == 1):
#         predictions.append(p[1])
#         if (p[1] > 0.5122):
#             z.append(p[1])
#     else:
#         predictions.append(p[0])
bSpread["PFITS"] = x
bSpread["binSpread"] = y
print(
    "SPREAD ------------------------------------------------------------------------"
)
testClassification(bSpread,
                   300,
                   'Kelly',
                   Year=False,
                   Week=False,
                   odds=-105,
                   betType="Spread",
                   printOption=True)
print(
    "-------------------------------------------------------------------------------"
)

predictions = []
allSums = []
x = []
y = []
z = []
allScores = []
a = pd.read_csv('./new_csv_Data/bigboyBinClassificationTotalsALTTrain.csv',
                encoding="ISO-8859-1")
                trainRows.append(j)
        tempTrainX = X_train.iloc[trainRows]
        tempTrainY = y_train.iloc[trainRows]
        tempValX = X_train.iloc[valRows]
        tempValY = y_train.iloc[valRows]
        b = pd.DataFrame()
        b["binSpread"] = tempValY
        model.fit(X = tempTrainX, y = tempTrainY)
        for p in model.predict_proba(tempValX):
            if (model.classes_[1] == 1):
                predictions.append(p[1])
            else:
                predictions.append(p[0])
        b["PFITS"] = predictions
        predictions = []
        cvSum += testClassification(b, 300, 'Kelly', Year = False, Week = False, odds = -105, betType = "Spread", print = False)
    allSums.append(cvSum)
    cvSum = 0
print ("Initial cvSum =", np.average(allSums))
best = np.average(allSums)
bestCols = []
removedCols = []
noImprovement = True
colCount = 1
removedCount = 0
bestImproved = 0
for col in xCols:
    if ("Elo" not in col):
        removedCols.append(col)
        removedCount += 1
bestCols.append("Elo_diff_aboveAvg")
Ejemplo n.º 6
0
best = 0
bestCols = []
temp = X.copy()
model = LogisticRegression(max_iter = 100000)
X_train, X_test, y_train, y_test = train_test_split(temp, Y, test_size=0.33, random_state=42)
model.fit(X = X_train, y = y_train)
for p in model.predict_proba(X_test):
    if (model.classes_[1] == 1):
        predictions.append(p[1])
    else:
        predictions.append(p[0])
b = pd.DataFrame()
b["binSpread"] = y_test
b["PFITS"] = predictions
predictions = []
netWin = testClassification(b, 300, 'Standard')
best = netWin
bestCols = []
removedCols = []
noImprovement = True
colCount = 0
removedCount = 0
bestImproved = 0
for col in temp.columns:
    bestCols.append(col)
    colCount += 1
random.shuffle(bestCols)
X = temp.copy()
print ("Starting Removal of Features")
while (bestImproved < colCount):
    print (bestImproved, colCount)