Skip to content

TuRF value error #52

@J-Bleker

Description

@J-Bleker

Hello,

I am currently trying to use TuRF to get my feature importance scores, and my code is almost the same as the example code in the docs:

from skrebate.turf import TuRF
​
# Take x & y from dataframes
X = x.values
Y = y.values
​
# Take feature names as header
header = x.columns

# Implement TuRF with ReliefF as algorithm
tf = TuRF(core_algorithm="ReliefF", n_features_to_select=2, pct=0.5,verbose=True)
tf.fit(X, Y, header)

# Output

Created distance array in 0.03900003433227539 seconds.
Feature scoring under way ...
Completed scoring in 12.943000078201294 seconds.
Created distance array in 0.02700018882751465 seconds.
Feature scoring under way ...
Completed scoring in 6.190999984741211 seconds.
Created distance array in 0.004999876022338867 seconds.
Feature scoring under way ...
Completed scoring in 3.2160000801086426 seconds.
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-63-e796aad72373> in <module>()
      1 tf = TuRF(core_algorithm="ReliefF", n_features_to_select=2, pct=0.5,verbose=True)
----> 2 tf.fit(X, Y, header)

C:\ProgramData\Anaconda3\lib\site-packages\skrebate\turf.py in fit(self, X, y, headers)
    164                 self.feature_importances_.append(low_score - reduction * self._lost[i]) #append discounted score as a marker of when the feature was removed.
    165             else: #Feature made final cut
--> 166                 score_index = self.headers.index(i)
    167                 self.feature_importances_.append(core_fit.feature_importances_[score_index])
    168 

ValueError: 'mean_surface_score' is not in list

A very odd error in my opinion since I am certain all feature names are in the header. Anyone knows the solution to this error? Unfortunately i cannot supply my data but it is just a dataframe with about 150 samples, a certain number of features as columns and one column with the labels (X does not contain this column).

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions