2

I'm using IPython's UI with appropriate libraries (Anaconda, pandas, numpy)

I've declared a pandas object df, I've changed it so that the first column is the desired value I wish to predict but my code still continues to stop at line 10. Line 11 does not run. Instead, the Terminal IPython window quits and displays this error:

~/anaconda/bin/python.app: line 3: 45581 Killed: 9               ~/anaconda/python.app/Contents/MacOS/python "$@"

Start of code

In [1]: import pandas as pd

In [2]: import numpy as np

In [3]: df = pd.read_csv('train.csv', header=0)

In [4]: cols = list(df)

In [5]: cols.insert(0, cols.pop(cols.index('Cover_Type'))) %Cover type is column I wanted to bring to column position 1 or value I'm predicting

In [6]: cols

In [7]: df = df.ix[:, cols]

In [8]: df

In [9]: forest = RandomForestClassifier(n_estimators = 100)

In [10]: forest = forest.fit(train_data[0::,1::],train_data[0::,0])

In [11]: output = forest.predict(test_data)

In [12]: train_data = df.values

In [13]: train_data
1
  • Where train_data comes from? What is dimensions of train_data? Maybe this error caused by sort of memory limitations? Commented Nov 11, 2015 at 11:33

1 Answer 1

1

You are using train Data in line 10 which is not available. You assign it later on.

First assign train data , then use it in forest.fit

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.