Showing
2 changed files
with
11 additions
and
2 deletions
... | @@ -237,6 +237,7 @@ if __name__ == "__main__": | ... | @@ -237,6 +237,7 @@ if __name__ == "__main__": |
237 | if args.reduction is not None: | 237 | if args.reduction is not None: |
238 | X_test = reduc.transform(X_test) | 238 | X_test = reduc.transform(X_test) |
239 | y_pred = myClassifier.predict(X_test) | 239 | y_pred = myClassifier.predict(X_test) |
240 | + best_parameters = myClassifier.best_estimator_.get_params() | ||
240 | print(" Done!") | 241 | print(" Done!") |
241 | 242 | ||
242 | print("Saving report...") | 243 | print("Saving report...") |
... | @@ -253,6 +254,8 @@ if __name__ == "__main__": | ... | @@ -253,6 +254,8 @@ if __name__ == "__main__": |
253 | oFile.write(str(confusion_matrix(y_test, y_pred)) + '\n') | 254 | oFile.write(str(confusion_matrix(y_test, y_pred)) + '\n') |
254 | oFile.write('Classification report: \n') | 255 | oFile.write('Classification report: \n') |
255 | oFile.write(classification_report(y_test, y_pred) + '\n') | 256 | oFile.write(classification_report(y_test, y_pred) + '\n') |
257 | + for param in sorted(best_parameters.keys()): | ||
258 | + oFile.write("\t%s: %r\n" % (param, best_parameters[param])) | ||
256 | print(" Done!") | 259 | print(" Done!") |
257 | 260 | ||
258 | print("Training and testing done in: %fs" % (time() - t0)) | 261 | print("Training and testing done in: %fs" % (time() - t0)) | ... | ... |
... | @@ -54,14 +54,16 @@ __author__ = 'CMendezC' | ... | @@ -54,14 +54,16 @@ __author__ = 'CMendezC' |
54 | # --outputModelPath /home/compu2/bionlp/lcg-bioinfoI-bionlp/clasificacion-automatica/structural-domain-dataset/models | 54 | # --outputModelPath /home/compu2/bionlp/lcg-bioinfoI-bionlp/clasificacion-automatica/structural-domain-dataset/models |
55 | # --outputModelFile SVM-lineal-model.mod | 55 | # --outputModelFile SVM-lineal-model.mod |
56 | # --outputReportPath /home/compu2/bionlp/lcg-bioinfoI-bionlp/clasificacion-automatica/structural-domain-dataset/reports | 56 | # --outputReportPath /home/compu2/bionlp/lcg-bioinfoI-bionlp/clasificacion-automatica/structural-domain-dataset/reports |
57 | -# --outputReportFile SVM-lineal.txt | 57 | +# --outputReportFile SVM-linear.txt |
58 | # --classifier SVM | 58 | # --classifier SVM |
59 | # --saveData | 59 | # --saveData |
60 | # --kernel linear | 60 | # --kernel linear |
61 | # --reduction SVD200 | 61 | # --reduction SVD200 |
62 | # --removeStopWords | 62 | # --removeStopWords |
63 | # --vectorizer b | 63 | # --vectorizer b |
64 | -# python training-crossvalidation-testing-dom.py --inputPath /home/compu2/bionlp/lcg-bioinfoI-bionlp/clasificacion-automatica/structural-domain-dataset --inputTrainingData trainData.txt --inputTrainingClasses trainClasses.txt --inputTestingData testData.txt --inputTestingClasses testClasses.txt --outputModelPath /home/compu2/bionlp/lcg-bioinfoI-bionlp/clasificacion-automatica/structural-domain-dataset/models --outputModelFile SVM-lineal-model.mod --outputReportPath /home/compu2/bionlp/lcg-bioinfoI-bionlp/clasificacion-automatica/structural-domain-dataset/reports --outputReportFile SVM-lineal.txt --classifier SVM --kernel linear --saveData --vectorizer b | 64 | +# --ngrinitial 2 |
65 | +# --ngrfinal 2 | ||
66 | +# python training-crossvalidation-testing-dom.py --inputPath /home/compu2/bionlp/lcg-bioinfoI-bionlp/clasificacion-automatica/structural-domain-dataset --inputTrainingData trainData.txt --inputTrainingClasses trainClasses.txt --inputTestingData testData.txt --inputTestingClasses testClasses.txt --outputModelPath /home/compu2/bionlp/lcg-bioinfoI-bionlp/clasificacion-automatica/structural-domain-dataset/models --outputModelFile SVM-lineal-model.mod --outputReportPath /home/compu2/bionlp/lcg-bioinfoI-bionlp/clasificacion-automatica/structural-domain-dataset/reports --outputReportFile SVM-linear.txt --classifier SVM --kernel linear --saveData --vectorizer b --ngrinitial 2 --ngrfinal 2 --removeStopWords | ||
65 | # --reduction SVD200 | 67 | # --reduction SVD200 |
66 | # --removeStopWords | 68 | # --removeStopWords |
67 | 69 | ||
... | @@ -283,6 +285,7 @@ if __name__ == "__main__": | ... | @@ -283,6 +285,7 @@ if __name__ == "__main__": |
283 | if args.reduction is not None: | 285 | if args.reduction is not None: |
284 | X_test = reduc.transform(X_test) | 286 | X_test = reduc.transform(X_test) |
285 | y_pred = myClassifier.predict(X_test) | 287 | y_pred = myClassifier.predict(X_test) |
288 | + best_parameters = myClassifier.best_estimator_.get_params() | ||
286 | print(" Done!") | 289 | print(" Done!") |
287 | 290 | ||
288 | print("Saving report...") | 291 | print("Saving report...") |
... | @@ -299,6 +302,9 @@ if __name__ == "__main__": | ... | @@ -299,6 +302,9 @@ if __name__ == "__main__": |
299 | oFile.write(str(confusion_matrix(y_test, y_pred)) + '\n') | 302 | oFile.write(str(confusion_matrix(y_test, y_pred)) + '\n') |
300 | oFile.write('Classification report: \n') | 303 | oFile.write('Classification report: \n') |
301 | oFile.write(classification_report(y_test, y_pred) + '\n') | 304 | oFile.write(classification_report(y_test, y_pred) + '\n') |
305 | + for param in sorted(best_parameters.keys()): | ||
306 | + oFile.write("\t%s: %r\n" % (param, best_parameters[param])) | ||
307 | + | ||
302 | print(" Done!") | 308 | print(" Done!") |
303 | 309 | ||
304 | print("Training and testing done in: %fs" % (time() - t0)) | 310 | print("Training and testing done in: %fs" % (time() - t0)) | ... | ... |
-
Please register or login to post a comment