Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
nguyenminhtuong opened this issue Aug 8, 2023 · 4 comments
Labels
type/bug 🐛 Something isn't working

Comments

@nguyenminhtuong
Copy link

nguyenminhtuong commented Aug 8, 2023

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

@nguyenminhtuong nguyenminhtuong added the type/bug 🐛 Something isn't working label Aug 8, 2023
@nguyenminhtuong
Copy link
Author

I have been able to solve this problem. Somehow this command

image

Does not install ecole 0.8.1 or 0.8.0 but install 0.7.3 instead. This has lead me to change all variables that have the name variable_features to column_features

Now I am trying to install 0.8.1 but I am not really successful

@TianXuan1zxh
Copy link

Hello, can you tell me how you resolved this AttributeError? Just because of an issue with the ecole version?

@Jackieziao
Copy link

I think just replace the variable_features to colomn_features

@Yige-Lei
Copy link

Yige-Lei commented Jun 4, 2024

I have also encountered this problem. It's because the version of ecole(like 0.7.3) is too old.
You can first update your conda to the latest version(like 24.5.0) and then install 0.8.1ecole with conda install -c conda-forge ecoleor simply with conda install ecole. The latest version of conda can install 0.8.1ecole, but the old version of conda(like 23.7.4) can only install 0.7.3ecole. Hope this helps you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug 🐛 Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants