Skip to content

Commit

Permalink
third fixed production
Browse files Browse the repository at this point in the history
  • Loading branch information
植木快 committed Sep 3, 2015
1 parent 410a6c3 commit c191d6a
Show file tree
Hide file tree
Showing 15 changed files with 96,963 additions and 4,862 deletions.
3 changes: 2 additions & 1 deletion create_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
from pybrain.tools.shortcuts import buildNetwork
from pybrain.supervised.trainers import BackpropTrainer
from pybrain.datasets import SupervisedDataSet
from pybrain.structure.modules import SigmoidLayer
from sklearn.ensemble import RandomForestClassifier
from sklearn import svm
import feature
Expand All @@ -45,7 +46,7 @@ def create_NN_classifier(genes, positive_dataset, negative_dataset):
ds = SupervisedDataSet(indim, 1)
for i in xrange(len(train_labels)):
ds.appendLinked(train_dataset[i], [train_labels[i]])
net = buildNetwork(indim, node_num, 1)
net = buildNetwork(indim, node_num, 1, outclass=SigmoidLayer, bias=True)
trainer = BackpropTrainer(net, ds, learningrate=learning_rate)
trainer.trainUntilConvergence(maxEpochs=maxEpochs_for_trainer)
return net
Expand Down
5 changes: 3 additions & 2 deletions cross_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from pybrain.tools.shortcuts import buildNetwork
from pybrain.supervised.trainers import BackpropTrainer
from pybrain.datasets import SupervisedDataSet
from pybrain.structure.modules import SigmoidLayer
from sklearn.ensemble import RandomForestClassifier
from sklearn import svm
import numpy
Expand All @@ -15,7 +16,7 @@ class CrossValidation(object):
"""
Gene Scale in GA has to be (0, n). n is greater than 0.
"""
def __init__(self, bindres_file, pssms_file, log_file, method, fold=5, undersampling=True, shuffle=True, maxEpochs_for_trainer=5, geneScale=(0, 10)):
def __init__(self, bindres_file, pssms_file, log_file, method, fold=5, undersampling=True, shuffle=True, maxEpochs_for_trainer=10, geneScale=(0, 10)):
if geneScale[0] != 0 or geneScale[1] <= geneScale[0]:
raise ValueError("Gene Scale in GA has to be (0, n). n is greater than 0.")
if method != "neuralNetwork" and method != "randomForest" and method != "SVM":
Expand Down Expand Up @@ -117,7 +118,7 @@ def neuralNetwork_eval_func(self, chromosome):
ds = SupervisedDataSet(indim, 1)
for i in xrange(len(train_labels)):
ds.appendLinked(train_dataset[i], [train_labels[i]])
net = buildNetwork(indim, node_num, 1)
net = buildNetwork(indim, node_num, 1, outclass=SigmoidLayer, bias=True)
trainer = BackpropTrainer(net, ds, learningrate=learning_rate)
trainer.trainUntilConvergence(maxEpochs=self.maxEpochs_for_trainer)
decision_values = [net.activate(test_dataset[i]) for i in xrange(len(test_labels))]
Expand Down
Binary file modified cross_validation.pyc
Binary file not shown.
28 changes: 14 additions & 14 deletions output/SVM.pkl

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion output/SVM_best_chromosome.tsv
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#method cost gamma window_size decision_value
SVM 256 0.0078125 1 -0.94674091758
SVM 1024 0.0078125 10 -0.53006984705
2,100 changes: 1,500 additions & 600 deletions output/SVM_prediction_output.txt

Large diffs are not rendered by default.

499 changes: 219 additions & 280 deletions output/log.txt

Large diffs are not rendered by default.

260 changes: 130 additions & 130 deletions output/neuralNetwork.pkl

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion output/neuralNetwork_best_chromosome.tsv
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#method node_num learning_rate window_size decision_value
neuralNetwork 5 0.046 1 0.545129728059
neuralNetwork 28 0.064 8 0.314267765707
2,100 changes: 1,500 additions & 600 deletions output/neuralNetwork_prediction_output.txt

Large diffs are not rendered by default.

93,700 changes: 91,130 additions & 2,570 deletions output/randomForest.pkl

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion output/randomForest_best_chromosome.tsv
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#method n_estimators max_features window_size decision_value
randomForest 281 24 3 0.0
randomForest 1001 27 5 0.0
1,018 changes: 959 additions & 59 deletions output/randomForest_prediction_output.txt

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions test/bindingData.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
http://purl.uniprot.org/uniprot/AAAAAA 1 22 43 64 85 106 127 148 169 190
http://purl.uniprot.org/uniprot/BBBBBB 2 23 44 65 86 107 128 149 170 191
http://purl.uniprot.org/uniprot/CCCCCC 3 24 45 66 87 108 129 150 171 192
http://purl.uniprot.org/uniprot/AAAAAA 1 22 43 64 85 106 127 148 169 190 211 232 253 274 295 316 337 358 379 400 421 442 463 484
http://purl.uniprot.org/uniprot/BBBBBB 2 23 44 65 86 107 128 149 170 191 212 233 254 275 296 317 338 359 380 401 422 443 464 485
http://purl.uniprot.org/uniprot/CCCCCC 3 24 45 66 87 108 129 150 171 192 213 234 255 276 297 318 339 360 381 402 423 444 465 486
2,100 changes: 1,500 additions & 600 deletions test/pssms_random_score.txt

Large diffs are not rendered by default.

0 comments on commit c191d6a

Please sign in to comment.