What does “Index parameter outdated and will be removed (supposedly True) at 0.17” mean?

I am just starting to learn python and apologize if this is really a basic question / mistake.

I am doing a Kaggle biological response tutorial. I get this error

C: \ Anaconda \ Lib \ site-packages \ sklearn \ cross_validation.py: 65: DeprecationWarning: the index parameter is outdated and will be removed (assumed True) in 0.17 stacklevel = 1) Results: 0.458614231133

Does anyone know what that means? I killed him to death and did not find the answer.

script I run:

from sklearn.ensemble import RandomForestClassifier
from sklearn import cross_validation
import logloss
import numpy as np

def main():
    #read in  data, parse into training and target sets
    dataset = np.genfromtxt(open('train.csv','r'), delimiter=',', dtype='f8')[1:]
    target = np.array([x[0] for x in dataset])
    train = np.array([x[1:] for x in dataset])

    #In this case we'll use a random forest, but this could be any classifier
    cfr = RandomForestClassifier(n_estimators=100)

    #Simple K-Fold cross validation. 5 folds.
    #(Note: in older scikit-learn versions the "n_folds" argument is named "k".)
    cv = cross_validation.KFold(len(train), n_folds=5, indices=False)

    #iterate through the training and test cross validation segments and
    #run the classifier on each one, aggregating the results into a list
    results = []
    for traincv, testcv in cv:
        probas = cfr.fit(train[traincv], target[traincv]).predict_proba(train[testcv])
        results.append( logloss.llfun(target[testcv], [x[1] for x in probas]) )

    #print out the mean of the cross-validated results
    print "Results: " + str( np.array(results).mean() )
if __name__=="__main__":
    main()

I believe this is called:

__author__ = 'nickd'
import scipy as sp
def llfun(act, pred):
    epsilon = 1e-15
    pred = sp.maximum(epsilon, pred)
    pred = sp.minimum(1-epsilon, pred)
    ll = sum(act*sp.log(pred) + sp.subtract(1,act)*sp.log(sp.subtract(1,pred)))
    ll = ll * -1.0/len(act)
    return ll

Once again, it is unfortunate if this is the main material. I really have never done this before.

+4
source share
2 answers

, indices cross_validation.KFold, :

cv = cross_validation.KFold(len(train), n_folds=5, indices=False)

indices=True 0,17. , , , , , , TypeError 0.17, .

+5

, indices , , sklearn. (.. indices), .

0

Source: https://habr.com/ru/post/1599648/


All Articles