Below is the error code that I am getting when I am trying to run my Python Code. Is it an issue with my installation? I have python 64-bit 3.6.0 installed and I'm sure I installed the 64-bit version of sci-kit. I also have numpy, scipy installed as prereqs.
Traceback (most recent call last):
File "C:/Users/kevinshen/Desktop/Kaggle/GettingStarted/makeSubmission.py", line 1, in <module>
from sklearn.ensemble import RandomForestClassifier
File "C:\Users\kevinshen\AppData\Local\Programs\Python\Python36\lib\site-packages\sklearn\__init__.py", line 57, in <module>
from .base import clone
File "C:\Users\kevinshen\AppData\Local\Programs\Python\Python36\lib\site-packages\sklearn\base.py", line 12, in <module>
from .utils.fixes import signature
File "C:\Users\kevinshen\AppData\Local\Programs\Python\Python36\lib\site-packages\sklearn\utils\__init__.py", line 11, in <module>
from .validation import (as_float_array,
File "C:\Users\kevinshen\AppData\Local\Programs\Python\Python36\lib\site-packages\sklearn\utils\validation.py", line 18, in <module>
from ..utils.fixes import signature
File "C:\Users\kevinshen\AppData\Local\Programs\Python\Python36\lib\site-packages\sklearn\utils\fixes.py", line 406, in <module>
if np_version < (1, 12, 0):
TypeError: '<' not supported between instances of 'str' and 'int
Python Code:
from sklearn.ensemble import RandomForestClassifier
from numpy import genfromtxt, savetxt
def main():
#create the training & test sets, skipping the header row with [1:]
dataset = genfromtxt(open('Data/train.csv','r'), delimiter=',', dtype='f8')[1:]
target = [x[0] for x in dataset]
train = [x[1:] for x in dataset]
test = genfromtxt(open('Data/test.csv','r'), delimiter=',', dtype='f8')[1:]
#create and train the random forest
#multi-core CPUs can use: rf = RandomForestClassifier(n_estimators=100, n_jobs=2)
rf = RandomForestClassifier(n_estimators=100)
rf.fit(train, target)
predicted_probs = [x[1] for x in rf.predict_proba(test)]
savetxt('Data/submission.csv', predicted_probs, delimiter=',', fmt='%f')
if __name__=="__main__":
main()