def sgdClass(X_train, X_test, y_train, y_test, kaggle): clf = SGDClassifier(loss='hinge', max_iter=100000, tol=1e-7, shuffle=True, alpha=10, n_jobs=3) clf.fit(X_train, y_train) y_pred = clf.predict(X_test) mp.finalize(y_test, y_pred, kaggle)
def logRes(X_train, X_test, y_train, y_test, kaggle): clf = LogisticRegression(C=17, max_iter=100000, tol=1e-6, solver='newton-cg', multi_class='multinomial', fit_intercept=False, random_state=42) clf.fit(X_train, y_train) y_pred = clf.predict(X_test) mp.finalize(y_test, y_pred, kaggle)
def randFost(X_train, X_test, y_train, y_test, kaggle): clf = RandomForestClassifier(n_estimators=500, criterion="gini", bootstrap=True, min_samples_split=4, max_depth=55, max_features='sqrt', random_state=42) clf.fit(X_train, y_train) y_pred = clf.predict(X_test) mp.finalize(y_test, y_pred, kaggle)
def supportVM(X_train, X_test, y_train, y_test, kaggle): clf = svm.SVC(kernel='rbf', gamma='scale', C=17) clf.fit(X_train, y_train) y_pred = clf.predict(X_test) mp.finalize(y_test, y_pred, kaggle)
''' Gave 2nd place private score 0.61691 with public score 0.66017, still overfiting ''' model.add(Dense(224, activation='relu', input_dim=258)) model.add(Dropout(0.6)) model.add(Dense(128, activation='relu', kernel_regularizer=regularizers.l2(0.001))) model.add(Dense(64, activation='relu', kernel_regularizer=regularizers.l2(0.001))) model.add(Dense(8, activation='softmax')) model.compile(loss='categorical_crossentropy', optimizer=rmsp, metrics=[mp.f1, 'accuracy']) model.fit(X_train, y_train, epochs=100, batch_size=256, verbose=2, class_weight=counts, callbacks=[tensorboard]) model.save('3130230_model_' + str(time.time()) + '.h5') y_pred = model.predict_classes(X_test) mp.finalize(y_test, y_pred, kaggle) ''' Gave highest personal public score (0,66467)-> (high overfit) private score 0.61050 model.add(Dense(224, activation='relu', input_dim=258)) model.add(Dropout(0.7)) model.add(Dense(128, activation='relu')) model.add(Dropout(0.6)) model.add(Dense(8, activation='softmax')) model.summary() model.compile(loss='categorical_crossentropy', optimizer=rmsp, metrics=['accuracy']) model.fit(X_train, y_train, epochs=100, batch_size=256, class_weight=counts, verbose=2) '''