'dimension':X_train_bin.shape[1], 'bias': None, 'value': None, 'layer_type': 'binary', 'layer_name': 'input' }, 1: { 'dimension':200, 'bias': None, 'value': None, 'layer_type': 'binary', 'layer_name': 'hidden' } } learning_rate, weight_decay, momentum= step_iterator(0.01,0.001,-0.002), step_iterator(2e-5,2e-5,0), step_iterator(0.5,0.9,0.05) batch_func = batch_func_generator(X_train_bin, batch_size = 100) rbm = BinRBM(layers_dict = RBMlayers_dict, weight_list = None, random_state = None) print 'Training starts' rbm.fit(batch_func, PCD = False, error_function = 'recon',learning_rate = learning_rate, momentum = momentum, weight_decay = weight_decay, k = 1, perst_size = 100, n_iter = 500, verbose = True) combined = rbm.transform(X_train_bin) combined_test = rbm.transform(X_test_bin) parameters = {'alpha':[1e-1,1e-2,1e-3,1e-4,1e-5], 'n_iter': [10, 50 ,100]} clf = GridSearchCV(SGDClassifier(loss="hinge", penalty="l2", n_iter = 100, random_state = 500), parameters) clf.fit(combined,labels_train) y_pred = clf.predict(combined_test) print 'toplam: ', labels_test.shape[0], 'dogru: ', (y_pred == labels_test).sum() print clf.best_estimator_ parameters = [{'kernel': ['rbf'], 'gamma': [1e-1,1e-2,1e-3, 1e-4],
'dimension':B_train.shape[1], 'bias': None, 'value': None, 'layer_type': 'linear', 'layer_name': 'input' }, 1: { 'dimension':500, 'bias': None, 'value': None, 'layer_type': 'binary', 'layer_name': 'hidden' } } learning_rate, weight_decay, momentum= step_iterator(1,1,0), step_iterator(0,0,0), step_iterator(0,0,0) batch_func = batch_func_generator(R_train, batch_size = 50) rbmR = GaussRBM(layers_dict = RBMRlayers_dict, weight_list = None, random_state = random_state) print 'Training starts' rbmR.fit(batch_func, PCD = False, error_function = 'recon',learning_rate = learning_rate, momentum = momentum, weight_decay = weight_decay, k = 1, perst_size = 100, n_iter = 20, verbose = True) # sparsity_cond = True, sparsity_target = 0.01, sparsity_lambda = 1e-6) batch_func = batch_func_generator(G_train, batch_size = 50) rbmG = GaussRBM(layers_dict = RBMGlayers_dict, weight_list = None, random_state = random_state) print 'Training starts' rbmG.fit(batch_func, PCD = False, error_function = 'recon',learning_rate = learning_rate, momentum = momentum, weight_decay = weight_decay, k = 1, perst_size = 100, n_iter = 20, verbose = True) # sparsity_cond = True, sparsity_target = 0.01, sparsity_lambda = 1e-6) batch_func = batch_func_generator(B_train, batch_size = 50) rbmB = GaussRBM(layers_dict = RBMBlayers_dict, weight_list = None, random_state = random_state) print 'Training starts' rbmB.fit(batch_func, PCD = False, error_function = 'recon',learning_rate = learning_rate, momentum = momentum,