Skip to content

'ecole.core.observation.NodeBipartiteObs' object has no attribute 'variable_features' #364

@nguyenminhtuong

Description

@nguyenminhtuong

Describe the bug

I run the example at https://github.com/ds4dm/ecole/blob/master/examples/branching-imitation/example.ipynb
and encounter this error 'ecole.core.observation.NodeBipartiteObs' object has no attribute 'variable_features'

image

`---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In[11], line 1
----> 1 observation = train_data[0]

File ~/anaconda3/envs/mypython39/lib/python3.9/site-packages/torch_geometric/data/dataset.py:258, in Dataset.getitem(self, idx)
248 r"""In case :obj:idx is of type integer, will return the data object
249 at index :obj:idx (and transforms it in case :obj:transform is
250 present).
251 In case :obj:idx is a slicing object, e.g., :obj:[2:5], a list, a
252 tuple, or a :obj:torch.Tensor or :obj:np.ndarray of type long or
253 bool, will return a subset of the dataset at the specified indices."""
254 if (isinstance(idx, (int, np.integer))
255 or (isinstance(idx, Tensor) and idx.dim() == 0)
256 or (isinstance(idx, np.ndarray) and np.isscalar(idx))):
--> 258 data = self.get(self.indices()[idx])
259 data = data if self.transform is None else self.transform(data)
260 return data

Cell In[8], line 68, in GraphDataset.get(self, index)
66 edge_indices = sample_observation.edge_features.indices.astype(np.int32)
67 edge_features = np.expand_dims(sample_observation.edge_features.values, axis=-1)
---> 68 variable_features = sample_observation.variable_features
70 # We note on which variables we were allowed to branch, the scores as well as the choice
71 # taken by strong branching (relative to the candidates)
72 candidates = np.array(sample_action_set, dtype=np.int32)

AttributeError: 'ecole.core.observation.NodeBipartiteObs' object has no attribute 'variable_features'`

Setting

  • OS: Ubuntu Linux WSL2 on Window 10
  • Python version: 3.9
  • Ecole version: not sure how to view ecole version, I just install using conda install -c conda-forge ecole

To Reproduce

Just run the jupyter notebook at https://github.com/ds4dm/ecole/blob/master/examples/branching-imitation/example.ipynb

Expected behavior

Note that the expected result should be this
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions