New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating Weka implementations. #95

Merged
merged 11 commits into from Jul 29, 2017

Minor Style fixes

  • Loading branch information...
Iron-Stark committed Jul 23, 2017
commit e7cc809f87d882e4833e46151ba8f2f47e951cc6
View
@@ -2318,7 +2318,7 @@ methods:
['datasets/abalone7_train.csv', 'datasets/abalone7_test.csv', 'datasets/abalone7_labels.csv'],
['datasets/satellite_train.csv', 'datasets/satellite_test.csv', 'datasets/satellite_labels.csv'],
['datasets/ecoli_train.csv', 'datasets/ecoli_test.csv', 'datasets/ecoli_labels.csv'] ]
LOGISTICREGRESSION:
LogisticRegression:
run: ['metric']
iteration: 3
script: methods/weka/logistic_regression.py
@@ -80,7 +80,7 @@ def RunMetrics(self, options):
":methods/weka" + " DECISIONSTUMP -t " + self.dataset[0] + " -T " +
self.dataset[1])
# Run command with the nessecary arguments and return its output as a byte
# Run command with the necessary arguments and return its output as a byte
# string. We have untrusted input so we disable all shell based features.
try:
s = subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=False,
@@ -1,6 +1,7 @@
'''
@file logistic_regression.py
@author Anand Soni
Class to benchmark the weka Logistic Regression method.
'''
@@ -35,7 +36,7 @@
'''
This class implements the Logistic Regression benchmark.
'''
class LOGISTICREGRESSION(object):
class LogisticRegression(object):
'''
Create the Logistic Regression benchmark instance.
@@ -49,6 +49,13 @@ def __init__(self, dataset, timeout=0, path=os.environ["JAVAPATH"],
self.dataset = dataset
self.path = path
self.timeout = timeout
def __del__(self):
Log.Info("Clean up.", self.verbose)
filelist = ["weka_predicted.csv"]
for f in filelist:
if os.path.isfile(f):
os.remove(f)
'''
Random Forest. If the method has been successfully completed return
@@ -52,7 +52,7 @@ public static void main(String args[]) {
// Add pseudo class to the test set if no class information is provided.
if (testData.numAttributes() < trainData.numAttributes()) {
List<String> labelslist = new ArrayList<String>();
for (int i=0;i<trainData.classAttribute().numValues();i++) {
for (int i = 0; i < trainData.classAttribute().numValues(); i++) {
labelslist.add(trainData.classAttribute().value(i));
}
@@ -52,7 +52,7 @@ public static void main(String args[]) {
// Add pseudo class to the test set if no class information is provided.
if (testData.numAttributes() < trainData.numAttributes()) {
List<String> labelslist = new ArrayList<String>();
for (int i=0;i<trainData.classAttribute().numValues();i++) {
for (int i = 0; i < trainData.classAttribute().numValues(); i++) {
labelslist.add(trainData.classAttribute().value(i));
}
@@ -52,7 +52,7 @@ public static void main(String args[]) {
// Add pseudo class to the test set if no class information is provided.
if (testData.numAttributes() < trainData.numAttributes()) {
List<String> labelslist = new ArrayList<String>();
for (int i=0;i<trainData.classAttribute().numValues();i++) {
for (int i = 0; i < trainData.classAttribute().numValues(); i++) {
labelslist.add(trainData.classAttribute().value(i));
}
@@ -52,7 +52,7 @@ public static void main(String args[]) {
// Add pseudo class to the test set if no class information is provided.
if (testData.numAttributes() < trainData.numAttributes()) {
List<String> labelslist = new ArrayList<String>();
for (int i=0;i<trainData.classAttribute().numValues();i++) {
for (int i = 0; i < trainData.classAttribute().numValues(); i++) {
labelslist.add(trainData.classAttribute().value(i));
}
@@ -52,7 +52,7 @@ public static void main(String args[]) {
// Add pseudo class to the test set if no class information is provided.
if (testData.numAttributes() < trainData.numAttributes()) {
List<String> labelslist = new ArrayList<String>();
for (int i=0;i<trainData.classAttribute().numValues();i++) {
for (int i = 0; i < trainData.classAttribute().numValues(); i++) {
labelslist.add(trainData.classAttribute().value(i));
}
@@ -52,7 +52,7 @@ public static void main(String args[]) {
// Add pseudo class to the test set if no class information is provided.
if (testData.numAttributes() < trainData.numAttributes()) {
List<String> labelslist = new ArrayList<String>();
for (int i=0;i<trainData.classAttribute().numValues();i++) {
for (int i = 0; i < trainData.classAttribute().numValues(); i++) {
labelslist.add(trainData.classAttribute().value(i));
}
@@ -168,7 +168,7 @@ def setUp(self):
self.timeout = 240
module = Loader.ImportModuleFromPath("methods/weka/logistic_regression.py")
obj = getattr(module, "LOGISTICREGRESSION")
obj = getattr(module, "LogisicRegression")
self.instance = obj(self.dataset, verbose=self.verbose, timeout=self.timeout)
'''
ProTip! Use n and p to navigate between commits in a pull request.