def main():
	print 'logistic_regression2_pca'
	train_x,train_y,kaggle_test = getNumpy()
	# train_x = train_x[:100]
	# train_y = train_y[:100]
	# kaggle_test = kaggle_test[:100]
	logistic_regression2_pca(train_x, train_y, kaggle_test)
Beispiel #2
0
def main():
	train_x,train_y,kaggle_test = getNumpy()
	print 'svm_3_pca'
	# train_x = train_x[:100]
	# train_y = train_y[:100]
	# kaggle_test = kaggle_test[:100]
	svm_3_pca(train_x, train_y, kaggle_test)
def main():
	train_x,train_y,test_x = getNumpy()
	# train_x = train_x[:10]
	# train_y = train_y[:10]
	# test_x = test_x[:10]
	X_train, X_valid, Y_train, Y_valid = train_test_split(train_x, train_y,test_size=0.2,random_state=0)
	print 'logistic_regression'
	logistic_regression(X_train,X_valid,Y_train,Y_valid,train_x,train_y,test_x)
        cost_batch, output_train = train(X_batch, y_batch)
        costs += [cost_batch]
        preds = np.argmax(output_train, axis=-1)
        correct += np.sum(y_batch == preds)

    return np.mean(costs), correct / float(num_samples)


def eval_epoch(X, y):
    output_eval, transform_eval = eval(X)
    preds = np.argmax(output_eval, axis=-1)
    acc = np.mean(preds == y)
    return acc, transform_eval

from load_numpy import getNumpy
X,Y,testx = getNumpy()
X_train, X_test, Y_train, Y_test = train_test_split(X, Y,test_size=0.2,random_state=0)
valid_accs, train_accs, test_accs = [], [], []
try:
    for n in range(NUM_EPOCHS):
        train_cost, train_acc = train_epoch(X_train, Y_train)
        # valid_acc, valid_trainsform = eval_epoch(data['X_valid'], data['y_valid'])
        test_acc, test_transform = eval_epoch(X_test, Y_test)
        # valid_accs += [valid_acc]
        test_accs += [test_acc]
        train_accs += [train_acc]

        if (n+1) % 20 == 0:
            new_lr = sh_lr.get_value() * 0.7
            print "New LR:", new_lr
            sh_lr.set_value(lasagne.utils.floatX(new_lr))
Beispiel #5
0
from load_numpy import getNumpy
from test_classifier import svm1
from preprocesses import pca
from rbm import rbm
from sklearn.cross_validation import train_test_split
train_x,train_y,test_x = getNumpy()
train_x_transform = pca(train_x,100)
X_train, X_valid, Y_train, Y_valid = train_test_split(train_x_transform, train_y,test_size=0.2,random_state=0)

# svm1(train_x_transform,train_y)
rbm(train_x,train_y)