On using the ColumnFeatures class in ecole.observation.NodeBipartiteObs #155
-
Please help me in understanding the use of ColumnFeatures class in ecole.observation.NodeBipartiteObs? Is it to identify the features of each decision variable? If so, how do I use it in my code after collecting a NodeBipartiteObs object? Example: Let, observation be a NodeBipartiteObs object returned by ecole environment. One way to get the column features is by using observation.column_features which returns a numpy array. However, this gives only the feature values and does not tell which value is for which feature. How do we know the feature that a value corresponds to? Do I somehow make use of ColumnFeatures for this prurpose? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hello @Arun0013 , Yes, the Example: >> observation.column_features.__members__
{'objective': <ColumnFeatures.objective: 0>,
...
'is_basis_zero': <ColumnFeatures.is_basis_zero: 18>} Now to get the feature observation.column_features[:, int(observation.ColumnFeatures.is_basis_zero)] This is sort of a cheap way of doing a pandas Dataframe. |
Beta Was this translation helpful? Give feedback.
Hello @Arun0013 ,
Yes, the
ColumnFeatures
is meant to be used the way you describe. It is an enumeration. If you never usedenum
before, you can think of it as a way to give a name to numbers.So in this case, the number would be the
axis1
index in theobservation.column_features
array, and the name would be the description of what that feature represent.Example:
For
observation
,observation.column_features
axis0
are the possible variables to branch on, and theaxis1
some features of these variables.The following gives us the name of all features and their index: