byu-dml / metalearn

BYU's python library of useable tools for metalearning
MIT License
22 stars 6 forks source link

Targets column requires a name #183

Closed emrysshevek closed 5 years ago

emrysshevek commented 5 years ago

We require the targets passed into compute to be a pandas Series, but it also seems like the series currently requires a name in order to function. Is this really necessary? Should we make it so that we can pass in targets without names?

Example of failure

import pandas as pd
import numpy as np
from metalearn import Metafeatures
x = pd.DataFrame(np.random.rand(8,2))
y = pd.Series(['a','a','a','a','b','b','b','b'])
Metafeatures().compute(x,y)

Traceback (most recent call last): File "", line 1, in File "metalearn/metafeatures/metafeatures.py", line 158, in compute value, compute_time = self._get_resource(metafeature_id) File "metalearn/metafeatures/metafeatures.py", line 387, in _get_resource args, total_time = self._get_arguments(resource_id) File "metalearn/metafeatures/metafeatures.py", line 421, in _get_arguments argument, compute_time = self._get_resource(argument) File "metalearn/metafeatures/metafeatures.py", line 390, in _get_resource computed_resources = f(**args) File "metalearn/metafeatures/metafeatures.py", line 567, in _get_binned_numeric_features_and_class_with_no_missing_values (df[feature],df[Y_sample.name]) File "pandas-0.23.4-py3.6-linux-x86_64.egg/pandas/core/frame.py", line 2688, in getitem return self._getitem_column(key) File "pandas-0.23.4-py3.6-linux-x86_64.egg/pandas/core/frame.py", line 2698, in _getitem_column result = self._constructor(self._data.get(key)) File "pandas-0.23.4-py3.6-linux-x86_64.egg/pandas/core/internals.py", line 4130, in get raise TypeError("cannot label index with a null key") TypeError: cannot label index with a null key

bjschoenfeld commented 5 years ago

fixed with a528be45609c03845af6d968389cdfa0564b053b